Received: by 2002:ac0:a5b6:0:0:0:0:0 with SMTP id m51-v6csp755056imm; Wed, 13 Jun 2018 07:49:42 -0700 (PDT) X-Google-Smtp-Source: ADUXVKLIgB0SoH7lDXMNiGwAjCOfL90N+zse7WZF26Hw6TvFCEJQcr+z1pFlW19FYdQar2xXhmYi X-Received: by 2002:a17:902:6847:: with SMTP id f7-v6mr5465435pln.173.1528901382762; Wed, 13 Jun 2018 07:49:42 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1528901382; cv=none; d=google.com; s=arc-20160816; b=hfTT+MUG/p2s/Uiu7U84iPEhnmSo0EA0ONagezKj2jrJLMJKTpBJ35ryyWd011HYvN ruYkUZxXBlxLDGA7puG+8nCyFRz7ch5G5aJ0XSoi8X00UEc452ALYZ0dmMaBkXRdxqzf /R3JqyP20eZiZ13Vsxy604x1AK7Vcdt0dB+HllMK2DOXyGJYO94M1e3AVaAlLbP6xtz/ bp+H6PnQFsBchOlevFr1pIZRlNRfXZcfptYHv0lIf7K6LUHdqoM/KSm30CE3DJuVEE7Y dOBrPbeUWQOO17xyQemgkgUOpxR4eU9ZMwQOpj85YYZ5+aQbwAZ/a8ndBBVbXD2iAwA5 biHg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:user-agent:in-reply-to :content-disposition:mime-version:references:message-id:subject:cc :to:from:date:dkim-signature:arc-authentication-results; bh=2KCaz3pxWGIudojwQMWRhZdC0E7l+STEb+DwGdQaK3I=; b=fx4LLGwQ/cb1VVfDDORat/gTpdms41NVXro/BknX1YZmgPeMxBJNX4x2AhDHY+tsul zsatLRJI+9O5udn5tH935uWtTGurtf7bFhjtTk4RgF1acBj35GsAw741Ma9pBeQAkLRU Vk/wBwXOz5n5TistF+xvI2k48I+/H3S5OCoJeyvsJDbfYqO6f6FQxHjIClDdJfdOeiLB jgnmMo1xMvWZUS3bSXeNywpg4Yqrt7uUQr1Rxo/jXcsXFrPYfxS5UYwz+pEylAK6DXTd UHTvAytYwhVdi65buXtljLVICoKu8YtLfZ3EgKnUbFyjh5yvWKJeSPMw6W6Y2aDpyNAb eMRA== ARC-Authentication-Results: i=1; mx.google.com; dkim=fail header.i=@infradead.org header.s=bombadil.20170209 header.b=EwTFtOCr; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id q3-v6si2918484plb.238.2018.06.13.07.49.28; Wed, 13 Jun 2018 07:49:42 -0700 (PDT) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; dkim=fail header.i=@infradead.org header.s=bombadil.20170209 header.b=EwTFtOCr; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S935897AbeFMOrt (ORCPT + 99 others); Wed, 13 Jun 2018 10:47:49 -0400 Received: from bombadil.infradead.org ([198.137.202.133]:47392 "EHLO bombadil.infradead.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S935691AbeFMOrr (ORCPT ); Wed, 13 Jun 2018 10:47:47 -0400 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=infradead.org; s=bombadil.20170209; h=In-Reply-To:Content-Type:MIME-Version :References:Message-ID:Subject:Cc:To:From:Date:Sender:Reply-To: Content-Transfer-Encoding:Content-ID:Content-Description:Resent-Date: Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID:List-Id: List-Help:List-Unsubscribe:List-Subscribe:List-Post:List-Owner:List-Archive; bh=2KCaz3pxWGIudojwQMWRhZdC0E7l+STEb+DwGdQaK3I=; b=EwTFtOCrCDHejav+hpVfDmmgr OGdBirc97OW0XIIT4GvZ099ANL5NjIvHyzOcnUnrU4wvGBaI7Erv6nlFAq8Y0IuYjT59Eog4ArMC6 efNoenUMkEC3xztmgkQmVNd2AeONdSh+zxqMJKwn0n6Hl6uWNxt841yZASKxTdrVZw/3KCVa1M/gI fZE9DIAMepYLUbIeXsnv13GAxSmgZxWAGc+Y4eb5ktrecya+ENvuhLScfeAXwOBwoy5MZmfNsk9ZV 74oYXfDrJftdtkeKISsClB7rZ9hyRnPHvgf7lgKsn8BXtXpZxTAPwyLSKPsSh/7b9pWyoU6HgaspE vmCkEAFPg==; Received: from hch by bombadil.infradead.org with local (Exim 4.90_1 #2 (Red Hat Linux)) id 1fT73m-000436-4s; Wed, 13 Jun 2018 14:47:42 +0000 Date: Wed, 13 Jun 2018 07:47:41 -0700 From: Christoph Hellwig To: Ming Lei Cc: Jens Axboe , Christoph Hellwig , Alexander Viro , Kent Overstreet , David Sterba , Huang Ying , linux-kernel@vger.kernel.org, linux-block@vger.kernel.org, linux-fsdevel@vger.kernel.org, linux-mm@kvack.org, Theodore Ts'o , "Darrick J . Wong" , Coly Li , Filipe Manana , Randy Dunlap Subject: Re: [PATCH V6 12/30] block: introduce bio_chunks() Message-ID: <20180613144741.GC4693@infradead.org> References: <20180609123014.8861-1-ming.lei@redhat.com> <20180609123014.8861-13-ming.lei@redhat.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20180609123014.8861-13-ming.lei@redhat.com> User-Agent: Mutt/1.9.2 (2017-12-15) X-SRS-Rewrite: SMTP reverse-path rewritten from by bombadil.infradead.org. See http://www.infradead.org/rpr.html Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org > +static inline unsigned bio_chunks(struct bio *bio) > +{ > + unsigned chunks = 0; > + struct bio_vec bv; > + struct bvec_iter iter; > > - return segs; > + /* > + * We special case discard/write same/write zeroes, because they > + * interpret bi_size differently: > + */ > + switch (bio_op(bio)) { > + case REQ_OP_DISCARD: > + case REQ_OP_SECURE_ERASE: > + case REQ_OP_WRITE_ZEROES: > + return 0; > + case REQ_OP_WRITE_SAME: > + return 1; > + default: > + bio_for_each_chunk(bv, bio, iter) > + chunks++; > + return chunks; Shouldn't this just return bio->bi_vcnt?