All of lore.kernel.org
 help / color / mirror / Atom feed
From: Johannes Thumshirn <Johannes.Thumshirn@wdc.com>
To: Qu Wenruo <wqu@suse.com>,
	"linux-btrfs@vger.kernel.org" <linux-btrfs@vger.kernel.org>
Subject: Re: [PATCH 7/9] btrfs: make btrfs_submit_compressed_read() to determine stripe boundary at bio allocation time
Date: Fri, 11 Jun 2021 07:42:50 +0000	[thread overview]
Message-ID: <PH0PR04MB7416B38BCA52ADBB748E31109B349@PH0PR04MB7416.namprd04.prod.outlook.com> (raw)
In-Reply-To: 20210611013114.57264-8-wqu@suse.com

On 11/06/2021 03:32, Qu Wenruo wrote:
> @@ -443,7 +449,6 @@ static struct bio *alloc_compressed_bio(struct compressed_bio *cb, u64 disk_byte
>  	bio->bi_end_io = endio_func;
>  
>  	if (bio_op(bio) == REQ_OP_ZONE_APPEND) {
> -		struct btrfs_fs_info *fs_info = btrfs_sb(cb->inode->i_sb);
>  		struct btrfs_device *device;
>  
>  		device = btrfs_zoned_get_device(fs_info, disk_bytenr,
> @@ -454,6 +459,15 @@ static struct bio *alloc_compressed_bio(struct compressed_bio *cb, u64 disk_byte
>  		}
>  		bio_set_dev(bio, device->bdev);
>  	}
> +	em = btrfs_get_chunk_map(fs_info, disk_bytenr, fs_info->sectorsize);
> +	if (IS_ERR(em))
> +		return ERR_CAST(em);
> +	ret = btrfs_get_io_geometry(fs_info, em, btrfs_op(bio), disk_bytenr,
> +				    &geom);
> +	free_extent_map(em);
> +	if (ret < 0)
> +		return ERR_PTR(ret);
> +	*next_stripe_start = disk_bytenr + geom.len;
>  	return bio;
>  }
>  


If you're doing a chunk map lookup on allocation you can kill above btrfs_zoned_get_device()
call and grab the block device for bio_set_dev() directly from the 1st stripe. Otherwise we're
doing two chunk map lookups for zoned btrfs after another, which is inefficient.


  reply	other threads:[~2021-06-11  7:42 UTC|newest]

Thread overview: 23+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-06-11  1:31 [PATCH 0/9] btrfs: compression: refactor and enhancement preparing for subpage compression support Qu Wenruo
2021-06-11  1:31 ` [PATCH 1/9] btrfs: remove a dead comment for btrfs_decompress_bio() Qu Wenruo
2021-06-11  3:26   ` Anand Jain
2021-06-11  1:31 ` [PATCH 2/9] btrfs: add compressed_bio::io_sectors to trace compressed bio more elegantly Qu Wenruo
2021-06-11  4:18   ` Anand Jain
2021-06-11  6:02     ` Qu Wenruo
2021-06-11  7:28   ` Johannes Thumshirn
2021-06-11  1:31 ` [PATCH 3/9] btrfs: hunt down the BUG_ON()s inside btrfs_submit_compressed_read() Qu Wenruo
2021-06-11  1:31 ` [PATCH 4/9] btrfs: hunt down the BUG_ON()s inside btrfs_submit_compressed_write() Qu Wenruo
2021-06-11  7:36   ` Johannes Thumshirn
2021-06-11  7:46     ` Qu Wenruo
2021-06-11  1:31 ` [PATCH 5/9] btrfs: introduce submit_compressed_bio() for compression Qu Wenruo
2021-06-11  1:31 ` [PATCH 6/9] btrfs: introduce alloc_submit_compressed_bio() " Qu Wenruo
2021-06-11  1:31 ` [PATCH 7/9] btrfs: make btrfs_submit_compressed_read() to determine stripe boundary at bio allocation time Qu Wenruo
2021-06-11  7:42   ` Johannes Thumshirn [this message]
2021-06-11  1:31 ` [PATCH 8/9] " Qu Wenruo
2021-06-11  7:49   ` Johannes Thumshirn
2021-06-11  8:16     ` Qu Wenruo
2021-06-11  8:19       ` Johannes Thumshirn
2021-06-11  8:26         ` Qu Wenruo
2021-06-11 12:40         ` Qu Wenruo
2021-06-11 12:43           ` Johannes Thumshirn
2021-06-11  1:31 ` [PATCH 9/9] btrfs: remove unused function btrfs_bio_fits_in_stripe() Qu Wenruo

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=PH0PR04MB7416B38BCA52ADBB748E31109B349@PH0PR04MB7416.namprd04.prod.outlook.com \
    --to=johannes.thumshirn@wdc.com \
    --cc=linux-btrfs@vger.kernel.org \
    --cc=wqu@suse.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.