btrfs: cache RAID stripe tree decision in btrfs_io_context
authorJohannes Thumshirn <johannes.thumshirn@wdc.com>
Mon, 16 Dec 2024 08:10:40 +0000 (09:10 +0100)
committerDavid Sterba <dsterba@suse.com>
Mon, 13 Jan 2025 13:53:16 +0000 (14:53 +0100)
Cache the decision if a particular I/O needs to update RAID stripe tree
entries in struct btrfs_io_context.

Signed-off-by: Johannes Thumshirn <johannes.thumshirn@wdc.com>
Reviewed-by: Filipe Manana <fdmanana@suse.com>
Signed-off-by: David Sterba <dsterba@suse.com>
fs/btrfs/bio.c
fs/btrfs/volumes.c
fs/btrfs/volumes.h

index 7ea6f0b43b95072b380172dc16e3c0de208a952b..bc80ee4f95a5a8de05f2664f68ac4fcb62864d7b 100644 (file)
@@ -725,8 +725,7 @@ static bool btrfs_submit_chunk(struct btrfs_bio *bbio, int mirror_num)
                        bio->bi_opf |= REQ_OP_ZONE_APPEND;
                }
 
-               if (is_data_bbio(bbio) && bioc &&
-                   btrfs_need_stripe_tree_update(bioc->fs_info, bioc->map_type)) {
+               if (is_data_bbio(bbio) && bioc && bioc->use_rst) {
                        /*
                         * No locking for the list update, as we only add to
                         * the list in the I/O submission path, and list
index fa190f7108545eacf82ef2b5f1f3838d56ca683e..088ba0499e184c93a402a3f92167cccfa33eec58 100644 (file)
@@ -6663,6 +6663,7 @@ int btrfs_map_block(struct btrfs_fs_info *fs_info, enum btrfs_map_op op,
                goto out;
        }
        bioc->map_type = map->type;
+       bioc->use_rst = io_geom.use_rst;
 
        /*
         * For RAID56 full map, we need to make sure the stripes[] follows the
index 3a416b1bc24cb0735c783de90fb7490d795d7d96..10bdd731e3fcc889237b4e1b05cc9389bc937659 100644 (file)
@@ -485,6 +485,7 @@ struct btrfs_io_context {
        struct bio *orig_bio;
        atomic_t error;
        u16 max_errors;
+       bool use_rst;
 
        u64 logical;
        u64 size;