Return-Path: Received: from mail-pl1-f196.google.com ([209.85.214.196]:41940 "EHLO mail-pl1-f196.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S2389057AbeKPKaa (ORCPT ); Fri, 16 Nov 2018 05:30:30 -0500 Received: by mail-pl1-f196.google.com with SMTP id p16-v6so10246805plr.8 for ; Thu, 15 Nov 2018 16:20:24 -0800 (PST) Date: Thu, 15 Nov 2018 16:20:20 -0800 From: Omar Sandoval To: Ming Lei Cc: Jens Axboe , linux-block@vger.kernel.org, linux-kernel@vger.kernel.org, linux-mm@kvack.org, Dave Chinner , Kent Overstreet , Mike Snitzer , dm-devel@redhat.com, Alexander Viro , linux-fsdevel@vger.kernel.org, Shaohua Li , linux-raid@vger.kernel.org, linux-erofs@lists.ozlabs.org, David Sterba , linux-btrfs@vger.kernel.org, "Darrick J . Wong" , linux-xfs@vger.kernel.org, Gao Xiang , Christoph Hellwig , Theodore Ts'o , linux-ext4@vger.kernel.org, Coly Li , linux-bcache@vger.kernel.org, Boaz Harrosh , Bob Peterson , cluster-devel@redhat.com Subject: Re: [PATCH V10 06/19] fs/buffer.c: use bvec iterator to truncate the bio Message-ID: <20181116002020.GA23828@vader> References: <20181115085306.9910-1-ming.lei@redhat.com> <20181115085306.9910-7-ming.lei@redhat.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20181115085306.9910-7-ming.lei@redhat.com> Sender: linux-ext4-owner@vger.kernel.org List-ID: On Thu, Nov 15, 2018 at 04:52:53PM +0800, Ming Lei wrote: > Once multi-page bvec is enabled, the last bvec may include more than one > page, this patch use bvec_last_segment() to truncate the bio. > > Cc: Dave Chinner > Cc: Kent Overstreet > Cc: Mike Snitzer > Cc: dm-devel@redhat.com > Cc: Alexander Viro > Cc: linux-fsdevel@vger.kernel.org > Cc: Shaohua Li > Cc: linux-raid@vger.kernel.org > Cc: linux-erofs@lists.ozlabs.org > Cc: David Sterba > Cc: linux-btrfs@vger.kernel.org > Cc: Darrick J. Wong > Cc: linux-xfs@vger.kernel.org > Cc: Gao Xiang > Cc: Christoph Hellwig > Cc: Theodore Ts'o > Cc: linux-ext4@vger.kernel.org > Cc: Coly Li > Cc: linux-bcache@vger.kernel.org > Cc: Boaz Harrosh > Cc: Bob Peterson > Cc: cluster-devel@redhat.com Reviewed-by: Omar Sandoval > Signed-off-by: Ming Lei > --- > fs/buffer.c | 5 ++++- > 1 file changed, 4 insertions(+), 1 deletion(-) > > diff --git a/fs/buffer.c b/fs/buffer.c > index 1286c2b95498..fa37ad52e962 100644 > --- a/fs/buffer.c > +++ b/fs/buffer.c > @@ -3032,7 +3032,10 @@ void guard_bio_eod(int op, struct bio *bio) > > /* ..and clear the end of the buffer for reads */ > if (op == REQ_OP_READ) { > - zero_user(bvec->bv_page, bvec->bv_offset + bvec->bv_len, > + struct bio_vec bv; > + > + bvec_last_segment(bvec, &bv); > + zero_user(bv.bv_page, bv.bv_offset + bv.bv_len, > truncated_bytes); > } > } > -- > 2.9.5 >