]> git.hungrycats.org Git - linux/commitdiff
btrfs: rename btrfs_chunk_map::stripe_size
authorQu Wenruo <wqu@suse.com>
Fri, 16 Oct 2026 00:48:17 +0000 (11:18 +1030)
committerDavid Sterba <dsterba@suse.com>
Fri, 30 Oct 2026 20:36:16 +0000 (21:36 +0100)
The member btrfs_chunk_map::stripe_size sounds very similar to
btrfs_chunk::stripe_len, but they have very different meanings.

btrfs_chunk_map::stripe_size is in fact the device extent size for the
chunk. E.g. a 2GiB RAID0 chunk with 2 stripes,
btrfs_chunk_map::stripe_size will be 1GiB (2GiB / 2).

But btrfs_chunk::stripe_len is the stripe length that striping profiles
should follow, and the value is now fixed to 64KiB.
E.g. for a 2GiB RAID0 chunk with 2 stripes, every write will be split
into 64KiB stripes, and then distributed across the 2 devices.

To avoid confusion, rename btrfs_chunk_map::stripe_size to
dev_extent_size.

And since we're here, also rename the helper btrfs_calc_stripe_length()
to btrfs_calc_dev_extent_size().

Reviewed-by: Filipe Manana <fdmanana@suse.com>
Signed-off-by: Qu Wenruo <wqu@suse.com>
Signed-off-by: David Sterba <dsterba@suse.com>
fs/btrfs/block-group.c
fs/btrfs/scrub.c
fs/btrfs/tests/extent-map-tests.c
fs/btrfs/volumes.c
fs/btrfs/volumes.h

index 9a98e291769ca6a32d4e931abca89cdb4ed92b00..f2b55ffbdaef932b817c042c773ec5913636658d 100644 (file)
@@ -2296,7 +2296,7 @@ int btrfs_rmap_block(struct btrfs_fs_info *fs_info, u64 chunk_start,
        if (IS_ERR(map))
                return -EIO;
 
-       data_stripe_length = map->stripe_size;
+       data_stripe_length = map->dev_extent_size;
        io_stripe_size = BTRFS_STRIPE_LEN;
        chunk_start = map->start;
 
@@ -2890,7 +2890,7 @@ static int insert_dev_extents(struct btrfs_trans_handle *trans,
                dev_offset = map->stripes[i].physical;
 
                ret = insert_dev_extent(trans, device, chunk_offset, dev_offset,
-                                       map->stripe_size);
+                                       map->dev_extent_size);
                if (ret)
                        break;
        }
index ba2e27cc53519c1aa7be5ef3fddf43fa3e043fe2..7c2cb75b685ca766c0dd3dcb8b4424bc9c4dcf78 100644 (file)
@@ -2410,7 +2410,7 @@ static noinline_for_stack int scrub_stripe(struct scrub_ctx *sctx,
        int ret;
        int ret2;
        u64 physical = map->stripes[stripe_index].physical;
-       const u64 dev_stripe_len = btrfs_calc_stripe_length(map);
+       const u64 dev_stripe_len = btrfs_calc_dev_extent_size(map);
        const u64 physical_end = physical + dev_stripe_len;
        u64 logical;
        u64 logic_end;
index 811f36d411018fb244419f1c63d5037e27958831..80f39c87268b63cf0af1d8b4acc70da9134dcc4e 100644 (file)
@@ -1029,7 +1029,7 @@ static int test_rmap_block(struct btrfs_fs_info *fs_info,
        /* Start at 4GiB logical address */
        map->start = SZ_4G;
        map->chunk_len = test->data_stripe_size * test->num_data_stripes;
-       map->stripe_size = test->data_stripe_size;
+       map->dev_extent_size = test->data_stripe_size;
        map->num_stripes = test->num_stripes;
        map->type = test->raid_type;
 
index f1305f68b1f8ab248090fe26fe8f82d3bf59e914..2db449f7c495f399000f14c975b50cccec9c080d 100644 (file)
@@ -6090,7 +6090,7 @@ static void chunk_map_device_set_bits(struct btrfs_chunk_map *map, unsigned int
                struct btrfs_device *device = stripe->dev;
 
                btrfs_set_extent_bit(&device->alloc_state, stripe->physical,
-                                    stripe->physical + map->stripe_size - 1,
+                                    stripe->physical + map->dev_extent_size - 1,
                                     bits | EXTENT_NOWAIT, NULL);
        }
 }
@@ -6102,7 +6102,7 @@ void btrfs_chunk_map_device_clear_bits(struct btrfs_chunk_map *map, unsigned int
                struct btrfs_device *device = stripe->dev;
 
                btrfs_clear_extent_bit(&device->alloc_state, stripe->physical,
-                                      stripe->physical + map->stripe_size - 1,
+                                      stripe->physical + map->dev_extent_size - 1,
                                       bits | EXTENT_NOWAIT, NULL);
        }
 }
@@ -6199,7 +6199,7 @@ static struct btrfs_block_group *create_chunk(struct btrfs_trans_handle *trans,
 
        map->start = start;
        map->chunk_len = ctl->chunk_size;
-       map->stripe_size = ctl->stripe_size;
+       map->dev_extent_size = ctl->stripe_size;
        map->on_disk_type = type;
        map->sub_stripes = ctl->sub_stripes;
        map->num_stripes = ctl->num_stripes;
@@ -7650,7 +7650,7 @@ static void btrfs_report_missing_device(struct btrfs_fs_info *fs_info,
                              devid, uuid);
 }
 
-u64 btrfs_calc_stripe_length(const struct btrfs_chunk_map *map)
+u64 btrfs_calc_dev_extent_size(const struct btrfs_chunk_map *map)
 {
        const int data_stripes = calc_data_stripes(map->type, map->num_stripes);
 
@@ -7778,9 +7778,9 @@ static int read_one_chunk(struct btrfs_key *key, struct extent_buffer *leaf,
        set_real_chunk_type(map);
 
        if (num_stripes > 0)
-               map->stripe_size = btrfs_calc_stripe_length(map);
+               map->dev_extent_size = btrfs_calc_dev_extent_size(map);
        else
-               map->stripe_size = 0;
+               map->dev_extent_size = 0;
 
        for (i = 0; i < num_stripes; i++) {
                map->stripes[i].physical =
@@ -8673,7 +8673,7 @@ static int verify_one_dev_extent(struct btrfs_fs_info *fs_info,
        struct btrfs_dev_lookup_args args = { .devid = devid };
        struct btrfs_chunk_map *map;
        struct btrfs_device *dev;
-       u64 stripe_len;
+       u64 dev_extent_size;
        bool found = false;
        int ret = 0;
        int i;
@@ -8687,12 +8687,12 @@ static int verify_one_dev_extent(struct btrfs_fs_info *fs_info,
                goto out;
        }
 
-       stripe_len = btrfs_calc_stripe_length(map);
-       if (unlikely(physical_len != stripe_len)) {
+       dev_extent_size = btrfs_calc_dev_extent_size(map);
+       if (unlikely(physical_len != dev_extent_size)) {
                btrfs_err(fs_info,
 "dev extent physical offset %llu on devid %llu length doesn't match chunk %llu, have %llu expect %llu",
                          physical_offset, devid, map->start, physical_len,
-                         stripe_len);
+                         dev_extent_size);
                ret = -EUCLEAN;
                goto out;
        }
index 6eddda2392215204de8a6da8ce30fc3c79bce549..67464025e449b2f3b4fa19b7b9fb67f73141593a 100644 (file)
@@ -628,7 +628,7 @@ struct btrfs_chunk_map {
        refcount_t refs;
        u64 start;
        u64 chunk_len;
-       u64 stripe_size;
+       u64 dev_extent_size;
        /*
         * The real type that is utilized during logical address mapping.
         *
@@ -799,7 +799,7 @@ void btrfs_destroy_dev_replace_tgtdev(struct btrfs_device *tgtdev,
 void btrfs_free_device(struct btrfs_device *device);
 unsigned long btrfs_full_stripe_len(struct btrfs_fs_info *fs_info,
                                    u64 logical);
-u64 btrfs_calc_stripe_length(const struct btrfs_chunk_map *map);
+u64 btrfs_calc_dev_extent_size(const struct btrfs_chunk_map *map);
 int btrfs_nr_parity_stripes(u64 type);
 int btrfs_chunk_alloc_add_chunk_item(struct btrfs_trans_handle *trans,
                                     struct btrfs_block_group *bg);