Received: by 2002:ad5:474a:0:0:0:0:0 with SMTP id i10csp8707634imu; Thu, 15 Nov 2018 16:23:15 -0800 (PST) X-Google-Smtp-Source: AJdET5e29qn0rMiojI+LgcSglMk4+5G85NECwMEkV0hiL7CcBWDWCC6T3M+/FynNcXR/hta2nHw7 X-Received: by 2002:a63:66c6:: with SMTP id a189mr7873663pgc.167.1542327794963; Thu, 15 Nov 2018 16:23:14 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1542327794; cv=none; d=google.com; s=arc-20160816; b=ARK11azs7+qfEj5iK0r9y2S1KU+zH2ygwpf+HKVYjQpXmlYZqCBrFFNSvr9D52e24y lUzpA4QmmmMFVHNLDJEWnLLWsJA9RlXZlSx537FAlDH80IQnEXUNMO/7MuN/v4Hh3Wm3 5a97TutzIEoA+LVbi3IpiLaisKgOT79QT5YJul0N1BQXSBpDFlvVI0+bidAgpyKVCKO6 jbaTuCmFRxhZ+NraMKK3Fom7+1GnukIm0muxqEXc3QojO8SKAWYGAVMU9kW2fKaVPjKz oc6WMKluahGAMdTAk6PS5V69XdAyTa2oheV7h356sKvhq1RuTPYBu3+clYT36FUKE4Qu nmVQ== 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; bh=k6RVFd+Vc0pfdcIaqX824O1heqiP0xSaSAehffCttMk=; b=EzHbq4y/tu641DBo/T1GYCNDwU/w8BAJTs8TbHhzUaOslh6FnG1k6/L6yq+5thvQQC p+ahhNjR8WZox754j/0tQdDNKlw8b0HFaLoZvj0YOuOVv4JAueZkaCkcU/hGaWjjYMSf MLd7NoRi/Lk8x8vAfLcQHsAv2tq8D9QUsg1X3sY2kurBHOQt6UewhLe3wthSXvBaST7d B5sJ0m0UvLBetsiMMqavDtvx396jpLYpQ7+/SDCzVREg5gTmQarrfiTGJNqJ6s9CrsIa ne6qYTTH3nELyIEHuBttN0P4yz9TxlcitJk/7QsanSHvF0+s+eAmEg7JnXuYPkqGCTnA jYYQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@osandov-com.20150623.gappssmtp.com header.s=20150623 header.b=wiTESMyL; 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 3si28108264pgf.124.2018.11.15.16.23.00; Thu, 15 Nov 2018 16:23:14 -0800 (PST) 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=pass header.i=@osandov-com.20150623.gappssmtp.com header.s=20150623 header.b=wiTESMyL; 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 S2389110AbeKPKab (ORCPT + 99 others); Fri, 16 Nov 2018 05:30:31 -0500 Received: from mail-pl1-f195.google.com ([209.85.214.195]:44674 "EHLO mail-pl1-f195.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726352AbeKPKaa (ORCPT ); Fri, 16 Nov 2018 05:30:30 -0500 Received: by mail-pl1-f195.google.com with SMTP id s5-v6so10241599plq.11 for ; Thu, 15 Nov 2018 16:20:24 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=osandov-com.20150623.gappssmtp.com; s=20150623; h=date:from:to:cc:subject:message-id:references:mime-version :content-disposition:in-reply-to:user-agent; bh=k6RVFd+Vc0pfdcIaqX824O1heqiP0xSaSAehffCttMk=; b=wiTESMyL5dqVRjbKaF3lqQafRzn4fD2CmMEEuGXYoy9BucJn1wjfdUQGcgIGszIxzw aSGoiV4BuM2mWpRoVdyMsKio4h1LfrHxwpAwDjfWqTiiooDZy4SiypGgXNwNHTSNEtNT AwhAoTqgxU+lWBiroMHUOFlupCBe6hrqs2rPDAIutpb+1jtSJG/4qNW1Vt2JMbj+34Hk fa3W8d3iXCJU7mXvImDoeUiGQY17fIuEU/rNtweFVtkjIKPeJ/0+bxRVWvDzSmngffLs MUQZm98vGL/G5DhQ1Xdg2XlfQRHxpEwftnHlu65FKAr0Ou5hT/0Hg4vfaJj9tG9USJR9 YmYA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:date:from:to:cc:subject:message-id:references :mime-version:content-disposition:in-reply-to:user-agent; bh=k6RVFd+Vc0pfdcIaqX824O1heqiP0xSaSAehffCttMk=; b=Kz/MWTeAREmEKN2/9KL4DVo8hWsUBdRzu+Jtk2d+jx3Lc6u+j0nV0lX6olxV3jsTAD iNZnp2iW0gKdgrAtDDA6gWngWLvBYjocWFkraMJacrjVFwqDHFUsfP9CLUtHxMXY2QxE Rtgrq64GZHJ8EpFjvjVdH8i5gaYQgjlhb9NPRbBWGBZSg9+w8rwbYMB15RMJ+Jfe+pKl Du9/mvUkYjdVUBR/Z66/T2+lEM6AtF2Oa+S1u3kNn7osYuGyMX/oRIJCMBFXLfmtFtCh zlbfcS33rHoUYA4K6aaMkre8aN6OxvlmrTYYRNd/AELECE+hw0sytMdXc6rpOgScNyaW XLWA== X-Gm-Message-State: AGRZ1gIiTrS5cDGUJyZSju90WHF/N6j7216YITsjCe4jUWKo43xUJgh9 jZj9yFwsfDGOB4G+KgGmQr3A1Q== X-Received: by 2002:a17:902:e01:: with SMTP id 1-v6mr8205945plw.251.1542327623756; Thu, 15 Nov 2018 16:20:23 -0800 (PST) Received: from vader ([64.114.255.97]) by smtp.gmail.com with ESMTPSA id m20sm4874872pgv.93.2018.11.15.16.20.22 (version=TLS1_2 cipher=ECDHE-RSA-CHACHA20-POLY1305 bits=256/256); Thu, 15 Nov 2018 16:20:23 -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> User-Agent: Mutt/1.10.1 (2018-07-13) Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org 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 >