Re: [PATCH V12 01/20] btrfs: remove various bio_offset arguments

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On Mon, Nov 26, 2018 at 10:17:01AM +0800, Ming Lei wrote:
> From: Christoph Hellwig <hch@xxxxxx>
> 
> 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@xxxxxxxx>
> Signed-off-by: Christoph Hellwig <hch@xxxxxx>
> ---
>  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;



[Index of Archives]     [Linux Ext4 Filesystem]     [Union Filesystem]     [Filesystem Testing]     [Ceph Users]     [Ecryptfs]     [AutoFS]     [Kernel Newbies]     [Share Photos]     [Security]     [Netfilter]     [Bugtraq]     [Yosemite News]     [MIPS Linux]     [ARM Linux]     [Linux Security]     [Linux Cachefs]     [Reiser Filesystem]     [Linux RAID]     [Samba]     [Device Mapper]     [CEPH Development]

  Powered by Linux