Received: by 2002:ad5:474a:0:0:0:0:0 with SMTP id i10csp547172imu; Mon, 26 Nov 2018 14:48:14 -0800 (PST) X-Google-Smtp-Source: AFSGD/XWbf2A6pA5dlsm78TubDs+vhatA49JUtsNl4dOZJ4pKTYhjav2qz7hom1qHRAZrl3rMI5o X-Received: by 2002:a17:902:7848:: with SMTP id e8mr30505356pln.100.1543272494234; Mon, 26 Nov 2018 14:48:14 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1543272494; cv=none; d=google.com; s=arc-20160816; b=jMSGwo0rn6Iab+XRV3TD3w2rzd24NrmgnLThvawqT0DYq21AU+JDIrVWQnR5BOtv4r VbGCuihBRFse/h1XZTEBXBMozAsOpz5YEKkngpQC8YanJFTAFw6BBagXT0lyO2IpsfvL qqJP3hzg41+rze809V0ie57yU86nqrcWlezg5gZbbHr7goFDLKyAYo+1WnguJov3jigp zfhpKP2igk7Sx93GaZgXpT39oQnPVvffTHrYGlNAORpiTPIetJaAbnl3XXZjWeBdZfCp rYwj4QoW6n8W4O3XbVcQOBDJb2LoxGpEOJO16Wp2uYYL5p4jgX6IptIX6puKRq2AKMKQ ABmg== 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=Ywd5ugQ7Rz1RkaT/YTlEuW45bSGgrrZi2Jz7k8219mE=; b=1KZUv1DTT4XYjiy0x6LecUEuT7zs0ymwG0vt974+x2vy00c7HBhLiiAZE1Uegs6rkR 9ol3oQ2UeWA05kDo73cPAG3sHs2mIJfz/sVnnaeu6b8Y5gLX/qxn3MnJeHI0tW7xEijc MmNmX+Nqk1XVucWQK1BfBbSfImn9IRaBnxfiHholcKZCFad9FpneXf6Gvx/vPyY6oYNx /yY60pMjJJRWgzJRyisqPo4etRUz1xUDrqFW8D/gQf9ZNHjPxPpCLjuh8/su0GUljJzF Rawe9yIYHqKZHocRhTQgD7lSrt25yBIL1y5EGd4Tubog8BsVSP/22DglVvTgI3+qUkWb 1/5w== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@osandov-com.20150623.gappssmtp.com header.s=20150623 header.b=Kpi1e8f6; 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 g59si1716361plb.302.2018.11.26.14.47.59; Mon, 26 Nov 2018 14:48: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=Kpi1e8f6; 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 S1727609AbeK0Jlv (ORCPT + 99 others); Tue, 27 Nov 2018 04:41:51 -0500 Received: from mail-pl1-f194.google.com ([209.85.214.194]:44001 "EHLO mail-pl1-f194.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726914AbeK0Jlv (ORCPT ); Tue, 27 Nov 2018 04:41:51 -0500 Received: by mail-pl1-f194.google.com with SMTP id gn14so14576990plb.10 for ; Mon, 26 Nov 2018 14:46:11 -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=Ywd5ugQ7Rz1RkaT/YTlEuW45bSGgrrZi2Jz7k8219mE=; b=Kpi1e8f6GJRJ50Hn5h0sre6zNOKaYDt3fxj+x4x8cevO2ccWoRZdNHAZCVzBUC0duR OY877RYF1bg2ljubA75pLiQxyURBIk7QX+iBpEfTzk5bwLKeXVOEDDLkZsI4sqyJb7KU uJMGbZXMNH+stq7oP6Qe83wSjgnHOO9JULwlnamt6j9i3EbB6LHL/egqXTeNYZih/G0u imwSfHqMXsaOUGnEhojqnHVq6D3X89BuTQETDAW040NuS6FsyFpOCnbREM/md+YzDCpg jnVKbt1TyUJ6MJt8wskPNvgMfFeqq84sztCREvP57IozbS1JJdZ4hphMztQXyB5GUhbu itQQ== 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=Ywd5ugQ7Rz1RkaT/YTlEuW45bSGgrrZi2Jz7k8219mE=; b=ZDi6u6kmlUt6fjp9JI/i3OrFYrTkiySMcLJUwVtwjf8XxGMPpP6gJaq4+5+Onh5HXC EE+EG5N3twDw4zWQzkdb6BfFAtRARJ8afwaxqjXhSD7rqK8fSCNtcL5d4Yj4IxeQfOWh yboJzp6KuweHLIHn/vivZWI4xI0kWhuakFW6JGwCP8NewDvecBr1JWS2kwF09MDtndKR mFaq7V0Nby5BpbZb+xt9lY1b+iiCVLMkJjG/FodgUaI+xfGRVu7kasD6MHnXi4GrrpC0 8mzKD+fTOG3IaqXX1idoaoZnZ8V+QOdJ9F9EyhjUpkwMrD7hcbJKgSvVuIoa9ksbBggF Xejg== X-Gm-Message-State: AA+aEWZE55JfuGiPxUhWe+qMJsdwmkDy8TXbdU847hb1NjgxU1qAK3br +JT84iPCFyls7QN3VotvnYrUiA== X-Received: by 2002:a17:902:a50a:: with SMTP id s10mr28485938plq.278.1543272370482; Mon, 26 Nov 2018 14:46:10 -0800 (PST) Received: from vader ([2601:602:8b00:55d3:e6a7:a0ff:fe0b:c9a8]) by smtp.gmail.com with ESMTPSA id b9sm1764128pfi.118.2018.11.26.14.46.09 (version=TLS1_2 cipher=ECDHE-RSA-CHACHA20-POLY1305 bits=256/256); Mon, 26 Nov 2018 14:46:09 -0800 (PST) Date: Mon, 26 Nov 2018 14:46:08 -0800 From: Omar Sandoval To: Ming Lei Cc: Jens Axboe , linux-block@vger.kernel.org, linux-kernel@vger.kernel.org, linux-mm@kvack.org, Theodore Ts'o , Omar Sandoval , Sagi Grimberg , Dave Chinner , Kent Overstreet , Mike Snitzer , dm-devel@redhat.com, Alexander Viro , linux-fsdevel@vger.kernel.org, Shaohua Li , linux-raid@vger.kernel.org, David Sterba , linux-btrfs@vger.kernel.org, "Darrick J . Wong" , linux-xfs@vger.kernel.org, Gao Xiang , Christoph Hellwig , linux-ext4@vger.kernel.org, Coly Li , linux-bcache@vger.kernel.org, Boaz Harrosh , Bob Peterson , cluster-devel@redhat.com Subject: Re: [PATCH V12 02/20] btrfs: look at bi_size for repair decisions Message-ID: <20181126224608.GO30411@vader> References: <20181126021720.19471-1-ming.lei@redhat.com> <20181126021720.19471-3-ming.lei@redhat.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20181126021720.19471-3-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 Mon, Nov 26, 2018 at 10:17:02AM +0800, Ming Lei wrote: > From: Christoph Hellwig > > bio_readpage_error currently uses bi_vcnt to decide if it is worth > retrying an I/O. But the vector count is mostly an implementation > artifact - it really should figure out if there is more than a > single sector worth retrying. Use bi_size for that and shift by > PAGE_SHIFT. This really should be blocks/sectors, but given that > btrfs doesn't support a sector size different from the PAGE_SIZE > using the page size keeps the changes to a minimum. > > Reviewed-by: David Sterba Reviewed-by: Omar Sandoval > Signed-off-by: Christoph Hellwig > --- > fs/btrfs/extent_io.c | 2 +- > include/linux/bio.h | 6 ------ > 2 files changed, 1 insertion(+), 7 deletions(-) > > diff --git a/fs/btrfs/extent_io.c b/fs/btrfs/extent_io.c > index 15fd46582bb2..40751e86a2a9 100644 > --- a/fs/btrfs/extent_io.c > +++ b/fs/btrfs/extent_io.c > @@ -2368,7 +2368,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 = failed_bio->bi_iter.bi_size >> PAGE_SHIFT; > > BUG_ON(bio_op(failed_bio) == REQ_OP_WRITE); > > diff --git a/include/linux/bio.h b/include/linux/bio.h > index 056fb627edb3..6f6bc331a5d1 100644 > --- a/include/linux/bio.h > +++ b/include/linux/bio.h > @@ -263,12 +263,6 @@ static inline void bio_get_last_bvec(struct bio *bio, struct bio_vec *bv) > bv->bv_len = iter.bi_bvec_done; > } > > -static inline unsigned bio_pages_all(struct bio *bio) > -{ > - WARN_ON_ONCE(bio_flagged(bio, BIO_CLONED)); > - return bio->bi_vcnt; > -} > - > static inline struct bio_vec *bio_first_bvec_all(struct bio *bio) > { > WARN_ON_ONCE(bio_flagged(bio, BIO_CLONED)); > -- > 2.9.5 >