diff mbox series

[02/10] btrfs: refactor btrfs_end_io_wq

Message ID 20230314165910.373347-3-hch@lst.de (mailing list archive)
State New, archived
Headers show
Series [01/10] btrfs: use a plain workqueue for ordered_extent processing | expand

Commit Message

Christoph Hellwig March 14, 2023, 4:59 p.m. UTC
Pass a btrfs_bio instead of a fs_info and bio.

Signed-off-by: Christoph Hellwig <hch@lst.de>
---
 fs/btrfs/bio.c | 12 ++++++------
 1 file changed, 6 insertions(+), 6 deletions(-)

Comments

Johannes Thumshirn March 16, 2023, 5:12 p.m. UTC | #1
Looks good,
Reviewed-by: Johannes Thumshirn <johannes.thumshirn@wdc.com>
Qu Wenruo March 20, 2023, 11:09 a.m. UTC | #2
On 2023/3/15 00:59, Christoph Hellwig wrote:
> Pass a btrfs_bio instead of a fs_info and bio.
> 
> Signed-off-by: Christoph Hellwig <hch@lst.de>

Reviewed-by: Qu Wenruo <wqu@suse.com>

Thanks,
Qu
> ---
>   fs/btrfs/bio.c | 12 ++++++------
>   1 file changed, 6 insertions(+), 6 deletions(-)
> 
> diff --git a/fs/btrfs/bio.c b/fs/btrfs/bio.c
> index cf09c6271edbee..85539964864a34 100644
> --- a/fs/btrfs/bio.c
> +++ b/fs/btrfs/bio.c
> @@ -296,10 +296,11 @@ static void btrfs_log_dev_io_error(struct bio *bio, struct btrfs_device *dev)
>   		btrfs_dev_stat_inc_and_print(dev, BTRFS_DEV_STAT_FLUSH_ERRS);
>   }
>   
> -static struct workqueue_struct *btrfs_end_io_wq(struct btrfs_fs_info *fs_info,
> -						struct bio *bio)
> +static struct workqueue_struct *btrfs_end_io_wq(struct btrfs_bio *bbio)
>   {
> -	if (bio->bi_opf & REQ_META)
> +	struct btrfs_fs_info *fs_info = bbio->inode->root->fs_info;
> +
> +	if (bbio->bio.bi_opf & REQ_META)
>   		return fs_info->endio_meta_workers;
>   	return fs_info->endio_workers;
>   }
> @@ -319,16 +320,15 @@ static void btrfs_simple_end_io(struct bio *bio)
>   {
>   	struct btrfs_bio *bbio = btrfs_bio(bio);
>   	struct btrfs_device *dev = bio->bi_private;
> -	struct btrfs_fs_info *fs_info = bbio->inode->root->fs_info;
>   
> -	btrfs_bio_counter_dec(fs_info);
> +	btrfs_bio_counter_dec(bbio->inode->root->fs_info);
>   
>   	if (bio->bi_status)
>   		btrfs_log_dev_io_error(bio, dev);
>   
>   	if (bio_op(bio) == REQ_OP_READ) {
>   		INIT_WORK(&bbio->end_io_work, btrfs_end_bio_work);
> -		queue_work(btrfs_end_io_wq(fs_info, bio), &bbio->end_io_work);
> +		queue_work(btrfs_end_io_wq(bbio), &bbio->end_io_work);
>   	} else {
>   		if (bio_op(bio) == REQ_OP_ZONE_APPEND)
>   			btrfs_record_physical_zoned(bbio);
diff mbox series

Patch

diff --git a/fs/btrfs/bio.c b/fs/btrfs/bio.c
index cf09c6271edbee..85539964864a34 100644
--- a/fs/btrfs/bio.c
+++ b/fs/btrfs/bio.c
@@ -296,10 +296,11 @@  static void btrfs_log_dev_io_error(struct bio *bio, struct btrfs_device *dev)
 		btrfs_dev_stat_inc_and_print(dev, BTRFS_DEV_STAT_FLUSH_ERRS);
 }
 
-static struct workqueue_struct *btrfs_end_io_wq(struct btrfs_fs_info *fs_info,
-						struct bio *bio)
+static struct workqueue_struct *btrfs_end_io_wq(struct btrfs_bio *bbio)
 {
-	if (bio->bi_opf & REQ_META)
+	struct btrfs_fs_info *fs_info = bbio->inode->root->fs_info;
+
+	if (bbio->bio.bi_opf & REQ_META)
 		return fs_info->endio_meta_workers;
 	return fs_info->endio_workers;
 }
@@ -319,16 +320,15 @@  static void btrfs_simple_end_io(struct bio *bio)
 {
 	struct btrfs_bio *bbio = btrfs_bio(bio);
 	struct btrfs_device *dev = bio->bi_private;
-	struct btrfs_fs_info *fs_info = bbio->inode->root->fs_info;
 
-	btrfs_bio_counter_dec(fs_info);
+	btrfs_bio_counter_dec(bbio->inode->root->fs_info);
 
 	if (bio->bi_status)
 		btrfs_log_dev_io_error(bio, dev);
 
 	if (bio_op(bio) == REQ_OP_READ) {
 		INIT_WORK(&bbio->end_io_work, btrfs_end_bio_work);
-		queue_work(btrfs_end_io_wq(fs_info, bio), &bbio->end_io_work);
+		queue_work(btrfs_end_io_wq(bbio), &bbio->end_io_work);
 	} else {
 		if (bio_op(bio) == REQ_OP_ZONE_APPEND)
 			btrfs_record_physical_zoned(bbio);