[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <20181126222851.GH30411@vader>
Date: Mon, 26 Nov 2018 14:28:51 -0800
From: Omar Sandoval <osandov@...ndov.com>
To: Ming Lei <ming.lei@...hat.com>
Cc: Jens Axboe <axboe@...nel.dk>, linux-block@...r.kernel.org,
linux-kernel@...r.kernel.org, linux-mm@...ck.org,
Theodore Ts'o <tytso@....edu>, Omar Sandoval <osandov@...com>,
Sagi Grimberg <sagi@...mberg.me>,
Dave Chinner <dchinner@...hat.com>,
Kent Overstreet <kent.overstreet@...il.com>,
Mike Snitzer <snitzer@...hat.com>, dm-devel@...hat.com,
Alexander Viro <viro@...iv.linux.org.uk>,
linux-fsdevel@...r.kernel.org, Shaohua Li <shli@...nel.org>,
linux-raid@...r.kernel.org, David Sterba <dsterba@...e.com>,
linux-btrfs@...r.kernel.org,
"Darrick J . Wong" <darrick.wong@...cle.com>,
linux-xfs@...r.kernel.org, Gao Xiang <gaoxiang25@...wei.com>,
Christoph Hellwig <hch@....de>, linux-ext4@...r.kernel.org,
Coly Li <colyli@...e.de>, linux-bcache@...r.kernel.org,
Boaz Harrosh <ooo@...ctrozaur.com>,
Bob Peterson <rpeterso@...hat.com>, cluster-devel@...hat.com
Subject: Re: [PATCH V12 01/20] btrfs: remove various bio_offset arguments
On Mon, Nov 26, 2018 at 10:17:01AM +0800, Ming Lei wrote:
> From: Christoph Hellwig <hch@....de>
>
> 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 <dsterba@...e.com>
> Signed-off-by: Christoph Hellwig <hch@....de>
> ---
> 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;
Powered by blists - more mailing lists