Received: by 2002:ad5:474a:0:0:0:0:0 with SMTP id i10csp529664imu; Mon, 26 Nov 2018 14:29:50 -0800 (PST) X-Google-Smtp-Source: AJdET5dmsLKk0KofObiEv1DiHCWTJBK+NP0k8USLht9zpe12m9wwj/3Vj7LxlM5P3ED1GeHw/aFb X-Received: by 2002:a62:b15:: with SMTP id t21mr31138731pfi.136.1543271389981; Mon, 26 Nov 2018 14:29:49 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1543271389; cv=none; d=google.com; s=arc-20160816; b=ojrdgGLzhImicnmQMwP1OAUBf1t5wessmYSbN93GmHHfa1I/oKcfDIdP7wwCEzAQa2 ZwXgolUezozz0jUcrCWx6fc4BUzHMdjMCR5HfEb7bmxD3XAed9vKfDLzPxoOH1e/yil3 QVsEECTEjf55ES7iwlEdXUnPoRmjlCO0jly4WgxdYUo10g5Ma236m8qhwdIbI1dnP/lB NM1EknlRPCiaBCHjadZ8S/O9+YB1msavFNKSNizNP7xLWsuvJnzV+tEL/7mqmpq/pQtA m3zxaFw88DjD6XUgNd2yz4TjAOc2g9MjjAZELI99svfuKDKSPZBKsy8+hru1y3oYQMos /E2g== 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=jUSs4ckCjR9nbJ3Ppxh214PQhf/aIJ1YkwiBrz9ToYk=; b=lOsKqVSXtjobdzIeo9p6W2ItBE5Vg9f/fb1BfX6KDQOKYY0z8FPYYf0PLMa3fRzGPP NtbyaAFdJM2Lvq8M5fuucR7w0TJ5VD+OWjdQWs83yhKGtn63NI3Hm4upcxLYLY+V+G43 qvCEwo/AZgoTAUUTMkUzhizLSy7JbZIeyhyp3CAq7nXZ+Xs3CRxEnLLVLr17sz3kpkxW SAqmiEZZv/JmMW+0Ouo/945QptAfSP6zWRkSMkZZt9Ci0oz+UCPoHOo5FCJWi0M9EbNt Np+QBJ57iXGsoUAS7W5xrtCBikKIUihJoun6vAzcZveeQwJ2kKnd4xO7ILugm4eYILfw cm5A== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@osandov-com.20150623.gappssmtp.com header.s=20150623 header.b=G5nYVwhT; 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 r12si1543916pgk.520.2018.11.26.14.29.34; Mon, 26 Nov 2018 14:29:49 -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=G5nYVwhT; 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 S1727365AbeK0JYb (ORCPT + 99 others); Tue, 27 Nov 2018 04:24:31 -0500 Received: from mail-pl1-f195.google.com ([209.85.214.195]:42275 "EHLO mail-pl1-f195.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726513AbeK0JYb (ORCPT ); Tue, 27 Nov 2018 04:24:31 -0500 Received: by mail-pl1-f195.google.com with SMTP id x21-v6so14548533pln.9 for ; Mon, 26 Nov 2018 14:28:54 -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=jUSs4ckCjR9nbJ3Ppxh214PQhf/aIJ1YkwiBrz9ToYk=; b=G5nYVwhTZmU8k9iaYdyr3FJk9b25IGGnt7vBKR7NpcxrnwXUZeVvBmkzIRcirVTiUD LtdCdH6wZVQuvlI8rW0vtEFCJndMVlz+wNscLWSq2ThuEIxqqVh6zC97TRK+mmSN5HvS qvdzb1yWV2UXCgNzCNGI9Md9SFAcXFxR+dLg168ZipwnS4ln31yCLmI5dV64z944ZYOH AtLKWVCGFtEUl6den9ggO8hSMpacZkcawMz0lM5DORzpnOxUBf3hMUrOIUhjkIHb9e5Y GS4S7wQ0qo/9Kfdx/SjSKFslDNEuQTi1XncuR1Cgk2mZW12136jn5lmS/lNg836FZysg YbXA== 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=jUSs4ckCjR9nbJ3Ppxh214PQhf/aIJ1YkwiBrz9ToYk=; b=BC4E3AkCxNQkJ/UriTgC/np5s7swAnUI1vobf2EreQavthxP4997SM8sumW1INhnEA R21k9fOmH0TP9j8CMK1lo/6Y93iaiou1hO1vKOtL5Bke6m+E6u8h8QMI75Y1a4ZmnMRI ccnEjIP6bZY4gmeS9I2r3GhvMducvH5XW0u5RQwhiP95m+7cULRk/X96oddOUL1k0A2l E/XFCdeDTsMk7h3txULYG5beHCwAGzHps/+noSsPqQCDEaZyHytFAtXG7+abUR8j8Run FNjMVod/rUXor/6bvOGdKU+oSalpwEqo5wOgzXLX4rB7osQ3LkKsqfhb8GfBZYGLjX2E NAAA== X-Gm-Message-State: AA+aEWabnneVdUEu7gutoylmuRXNOdKRHbZwAmitfZY5y88mYL1uCOWy w66YXJxWSpwsFFFEwN0DKTCzIA== X-Received: by 2002:a17:902:4d46:: with SMTP id o6mr28515395plh.302.1543271333739; Mon, 26 Nov 2018 14:28:53 -0800 (PST) Received: from vader ([2601:602:8b00:55d3:e6a7:a0ff:fe0b:c9a8]) by smtp.gmail.com with ESMTPSA id p67sm1986816pfg.44.2018.11.26.14.28.52 (version=TLS1_2 cipher=ECDHE-RSA-CHACHA20-POLY1305 bits=256/256); Mon, 26 Nov 2018 14:28:52 -0800 (PST) Date: Mon, 26 Nov 2018 14:28:51 -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 01/20] btrfs: remove various bio_offset arguments Message-ID: <20181126222851.GH30411@vader> References: <20181126021720.19471-1-ming.lei@redhat.com> <20181126021720.19471-2-ming.lei@redhat.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20181126021720.19471-2-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:01AM +0800, Ming Lei wrote: > From: Christoph Hellwig > > The btrfs write path passes a bio_offset argument through some deep > callchains including async offloading. In the end this is easily > calculatable using page_offset plus the bvec offset for the first > page in the bio, and only actually used by by a single function. > Just move the calculation of the offset there. > > Reviewed-by: David Sterba > Signed-off-by: Christoph Hellwig > --- > fs/btrfs/disk-io.c | 21 +++++---------------- > fs/btrfs/disk-io.h | 2 +- > fs/btrfs/extent_io.c | 9 ++------- > fs/btrfs/extent_io.h | 5 ++--- > fs/btrfs/inode.c | 17 ++++++++--------- > 5 files changed, 18 insertions(+), 36 deletions(-) [snip] > diff --git a/fs/btrfs/inode.c b/fs/btrfs/inode.c > index 9ea4c6f0352f..c576b3fcaea7 100644 > --- a/fs/btrfs/inode.c > +++ b/fs/btrfs/inode.c > @@ -1920,8 +1920,7 @@ int btrfs_merge_bio_hook(struct page *page, unsigned long offset, > * At IO completion time the cums attached on the ordered extent record > * are inserted into the btree > */ > -static blk_status_t btrfs_submit_bio_start(void *private_data, struct bio *bio, > - u64 bio_offset) > +static blk_status_t btrfs_submit_bio_start(void *private_data, struct bio *bio) > { > struct inode *inode = private_data; > blk_status_t ret = 0; > @@ -1973,8 +1972,7 @@ blk_status_t btrfs_submit_bio_done(void *private_data, struct bio *bio, > * c-3) otherwise: async submit > */ > static blk_status_t btrfs_submit_bio_hook(void *private_data, struct bio *bio, > - int mirror_num, unsigned long bio_flags, > - u64 bio_offset) > + int mirror_num, unsigned long bio_flags) > { > struct inode *inode = private_data; > struct btrfs_fs_info *fs_info = btrfs_sb(inode->i_sb); > @@ -2011,8 +2009,7 @@ static blk_status_t btrfs_submit_bio_hook(void *private_data, struct bio *bio, > goto mapit; > /* we're doing a write, do the async checksumming */ > ret = btrfs_wq_submit_bio(fs_info, bio, mirror_num, bio_flags, > - bio_offset, inode, > - btrfs_submit_bio_start); > + inode, btrfs_submit_bio_start); > goto out; > } else if (!skip_sum) { > ret = btrfs_csum_one_bio(inode, bio, 0, 0); > @@ -8123,10 +8120,13 @@ static void btrfs_endio_direct_write(struct bio *bio) > } > > static blk_status_t btrfs_submit_bio_start_direct_io(void *private_data, > - struct bio *bio, u64 offset) > + struct bio *bio) > { > struct inode *inode = private_data; > + struct bio_vec *bvec = bio_first_bvec_all(bio); > + u64 offset = page_offset(bvec->bv_page) + bvec->bv_offset; Hm, but for direct I/O, these will be user pages (or the zero page), so page_offset() won't be valid? > blk_status_t ret; > + > ret = btrfs_csum_one_bio(inode, bio, offset, 1); > BUG_ON(ret); /* -ENOMEM */ > return 0;