diff mbox series

[14/21] btrfs: use bbio->ordered for zone append completions

Message ID 20230508160843.133013-15-hch@lst.de (mailing list archive)
State New, archived
Headers show
Series [01/21] btrfs: don't BUG_ON on allocation failure in btrfs_csum_one_bio | expand

Commit Message

Christoph Hellwig May 8, 2023, 4:08 p.m. UTC
Use the ordered_extent pointer in the btrfs_bio instead of looking it
up manually.

Signed-off-by: Christoph Hellwig <hch@lst.de>
---
 fs/btrfs/bio.c   |  3 ++-
 fs/btrfs/zoned.c | 13 -------------
 fs/btrfs/zoned.h |  5 -----
 3 files changed, 2 insertions(+), 19 deletions(-)

Comments

Johannes Thumshirn May 9, 2023, 12:16 a.m. UTC | #1
Looks good,
Reviewed-by: Johannes Thumshirn <johannes.thumshirn@wdc.com>
diff mbox series

Patch

diff --git a/fs/btrfs/bio.c b/fs/btrfs/bio.c
index a1ad9aba2f7fc2..d697c4c9ef3c73 100644
--- a/fs/btrfs/bio.c
+++ b/fs/btrfs/bio.c
@@ -376,7 +376,8 @@  static void btrfs_simple_end_io(struct bio *bio)
 		queue_work(btrfs_end_io_wq(fs_info, bio), &bbio->end_io_work);
 	} else {
 		if (bio_op(bio) == REQ_OP_ZONE_APPEND)
-			btrfs_record_physical_zoned(bbio);
+			bbio->ordered->physical =
+				bbio->bio.bi_iter.bi_sector << SECTOR_SHIFT;
 		btrfs_orig_bbio_end_io(bbio);
 	}
 }
diff --git a/fs/btrfs/zoned.c b/fs/btrfs/zoned.c
index e3fe02aae641f3..5882eca045a9d4 100644
--- a/fs/btrfs/zoned.c
+++ b/fs/btrfs/zoned.c
@@ -1675,19 +1675,6 @@  bool btrfs_use_zone_append(struct btrfs_bio *bbio)
 	return ret;
 }
 
-void btrfs_record_physical_zoned(struct btrfs_bio *bbio)
-{
-	const u64 physical = bbio->bio.bi_iter.bi_sector << SECTOR_SHIFT;
-	struct btrfs_ordered_extent *ordered;
-
-	ordered = btrfs_lookup_ordered_extent(bbio->inode, bbio->file_offset);
-	if (WARN_ON(!ordered))
-		return;
-
-	ordered->physical = physical;
-	btrfs_put_ordered_extent(ordered);
-}
-
 void btrfs_rewrite_logical_zoned(struct btrfs_ordered_extent *ordered)
 {
 	struct btrfs_inode *inode = BTRFS_I(ordered->inode);
diff --git a/fs/btrfs/zoned.h b/fs/btrfs/zoned.h
index c0570d35fea291..f01d096f87d59b 100644
--- a/fs/btrfs/zoned.h
+++ b/fs/btrfs/zoned.h
@@ -56,7 +56,6 @@  void btrfs_redirty_list_add(struct btrfs_transaction *trans,
 			    struct extent_buffer *eb);
 void btrfs_free_redirty_list(struct btrfs_transaction *trans);
 bool btrfs_use_zone_append(struct btrfs_bio *bbio);
-void btrfs_record_physical_zoned(struct btrfs_bio *bbio);
 void btrfs_rewrite_logical_zoned(struct btrfs_ordered_extent *ordered);
 bool btrfs_check_meta_write_pointer(struct btrfs_fs_info *fs_info,
 				    struct extent_buffer *eb,
@@ -186,10 +185,6 @@  static inline bool btrfs_use_zone_append(struct btrfs_bio *bbio)
 	return false;
 }
 
-static inline void btrfs_record_physical_zoned(struct btrfs_bio *bbio)
-{
-}
-
 static inline void btrfs_rewrite_logical_zoned(
 				struct btrfs_ordered_extent *ordered) { }