Received: by 2002:ad5:474a:0:0:0:0:0 with SMTP id i10csp8708902imu; Thu, 15 Nov 2018 16:24:55 -0800 (PST) X-Google-Smtp-Source: AJdET5fH8/NMG8Z5040fOG/K1HD4EBz2VrA3u1rpHL44mbwMWgkLEI+IWAjvYatOiOZyfIcykNGN X-Received: by 2002:a62:6d07:: with SMTP id i7-v6mr9077848pfc.146.1542327895341; Thu, 15 Nov 2018 16:24:55 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1542327895; cv=none; d=google.com; s=arc-20160816; b=NiwuSoqWXrZGK1dcUyJZYSeDbFdMON+oEYlwbRsOw/9uk4LgEjY1bgl0wS7R/CKZks o0y5Jo8O/qcIr/FO072My1uuwh914CUEXgcQKH0zxeeKLIlU1O7xmjEjkmIM8XzvcpcQ B5npNL8t9QHvF0PR8XdCkJYkqeVpVwUJ1YXRxz4iKWQ2cUyaV35dbIZQQFFC2WHqYqxu YiPVU804YG7rInqjs59zN8LJVrF8TwwbSuvkxU3E2pEH/HslnMUGSXa2Etk9Q7xKTMpK omFWCGhMWjlxp8pyUu02wO7oto8DFt6/xELCAROO4ltlSrIOYjoYqZ3gOsL+UEVXRP2R 4E1A== 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=+YFNdcmtgiMlpQBi7cSJ9gNwFvgbWvI00uoRMZ8sE4o=; b=lmyuWmWYtkcezbZiAbxkf0TBYv4kCr96WEdEuDkIPNLAvAgxyFTq4JaodRgRSRQPMx NkyHzcIZ/Yqsqj+PjS8NV9jHHc213KH9Eccdewfxp76bSMl4L31gbeXNcvktfRlSKg5k QjHgwBD4JDwWTFLphzGYV98pq6DXW+Om/cmWN/eljaakpGxLFV7/5HzwRUoTRNkPM89v ckMphUcOAsPcMmgUowxWXjYVL/b+nJpIPjgXlQmAv9faYIWwbSz/RLySCykz2DRJ1e7r Ss0SMYhJqsP5SUkW1wnXX3sTwL6wJrvyBm2bCTmu3Wgh4U0UhTFGUqrJTaljkvtjoMyf uwqg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@osandov-com.20150623.gappssmtp.com header.s=20150623 header.b=Rlo2Qjx5; 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 r11si8763478pli.175.2018.11.15.16.24.41; Thu, 15 Nov 2018 16:24:55 -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=Rlo2Qjx5; 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 S2389096AbeKPKeI (ORCPT + 99 others); Fri, 16 Nov 2018 05:34:08 -0500 Received: from mail-pl1-f195.google.com ([209.85.214.195]:38848 "EHLO mail-pl1-f195.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S2389043AbeKPKeI (ORCPT ); Fri, 16 Nov 2018 05:34:08 -0500 Received: by mail-pl1-f195.google.com with SMTP id e5so235301plb.5 for ; Thu, 15 Nov 2018 16:24:01 -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=+YFNdcmtgiMlpQBi7cSJ9gNwFvgbWvI00uoRMZ8sE4o=; b=Rlo2Qjx5laXVtcjHx9ekQicwjrYA03QkgQwPxkxgWbLx8sKaJjRgneJG0+8NiPXNGG 7/G0ajkM5ZCOHdoh0fvGjOT1nDhKECFH5iJ87Anst1VbPmdF4SusRdAqBlvrDs/FOwUk wc0sX/b/qZHlAyFLb7QD3dh2imJr4rmZWwfYtsW5WlGwQ1VwG96orQ8RLfm6USWxIUOF SC7P5y/FFJAzwejuWUsPU23WCtxY28w2P31SfLFajUmA5fda0gN814CeWb2xwqLv+K8p gYc+P+++MkD612wRvmUrANcbeuXIgedN5KO4aY1kjbuR1Ddrr0wG9FbMLzX0+h9ElGrV W+jg== 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=+YFNdcmtgiMlpQBi7cSJ9gNwFvgbWvI00uoRMZ8sE4o=; b=Ll3TsvXNXKk5dQUKuux8Hyke4BwgS73F7G9nXb2VBskF7UKuAfYBIJT4DWFPFFVY1c GPzzfMKcx8zkpGZ4DKdpkDFFiNtyOcM4K3JFcd5YFNH7/tQl/lRfr99OUZBluUVLjTQe fnnR+h7dy23xdJFV/Ld2fiC6hnwgZ3Wk6zyD40UaQ4xotqsLvGgJdXtaDyDMsvR5tFDy Fz+ySKLCfH+Ys53lknBNHaseDRBQ3+zNO6HHTRnsmLrhM9GurlhWEpFNzsqE+2lzN2FJ hV6hGSmxtHRHDsJ7KweOvvUujvjGnVIIKzx2t7hI9pWh/U4evwWKVJYOnIlFXs/oOrUC A1kg== X-Gm-Message-State: AGRZ1gLoYEYY4Cnzo+v08XsBxQ22DcNP0mBFntSX/1sir6IxImISlSqX tqcbBJJ98Iwv/m7g6miGNe6tmQ== X-Received: by 2002:a17:902:20b:: with SMTP id 11-v6mr8267761plc.147.1542327840622; Thu, 15 Nov 2018 16:24:00 -0800 (PST) Received: from vader ([64.114.255.97]) by smtp.gmail.com with ESMTPSA id w80-v6sm51261608pfk.11.2018.11.15.16.23.59 (version=TLS1_2 cipher=ECDHE-RSA-CHACHA20-POLY1305 bits=256/256); Thu, 15 Nov 2018 16:24:00 -0800 (PST) Date: Thu, 15 Nov 2018 16:23:56 -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 08/19] btrfs: move bio_pages_all() to btrfs Message-ID: <20181116002356.GC23828@vader> References: <20181115085306.9910-1-ming.lei@redhat.com> <20181115085306.9910-9-ming.lei@redhat.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20181115085306.9910-9-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:55PM +0800, Ming Lei wrote: > BTRFS is the only user of this helper, so move this helper into > BTRFS, and implement it via bio_for_each_segment_all(), since > bio->bi_vcnt may not equal to number of pages after multipage bvec > is enabled. Shouldn't you also get rid of bio_pages_all() in this patch? > 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 > Signed-off-by: Ming Lei > --- > fs/btrfs/extent_io.c | 14 +++++++++++++- > 1 file changed, 13 insertions(+), 1 deletion(-) > > diff --git a/fs/btrfs/extent_io.c b/fs/btrfs/extent_io.c > index 5d5965297e7e..874bb9aeebdc 100644 > --- a/fs/btrfs/extent_io.c > +++ b/fs/btrfs/extent_io.c > @@ -2348,6 +2348,18 @@ struct bio *btrfs_create_repair_bio(struct inode *inode, struct bio *failed_bio, > return bio; > } > > +static unsigned btrfs_bio_pages_all(struct bio *bio) > +{ > + unsigned i; > + struct bio_vec *bv; > + > + WARN_ON_ONCE(bio_flagged(bio, BIO_CLONED)); > + > + bio_for_each_segment_all(bv, bio, i) > + ; > + return i; > +} > + > /* > * this is a generic handler for readpage errors (default > * readpage_io_failed_hook). if other copies exist, read those and write back > @@ -2368,7 +2380,7 @@ static int bio_readpage_error(struct bio *failed_bio, u64 phy_offset, > int read_mode = 0; > blk_status_t status; > int ret; > - unsigned failed_bio_pages = bio_pages_all(failed_bio); > + unsigned failed_bio_pages = btrfs_bio_pages_all(failed_bio); > > BUG_ON(bio_op(failed_bio) == REQ_OP_WRITE); > > -- > 2.9.5 >