btrfs: fix buffer index in wait_eb_writebacks()
authorNaohiro Aota <naohiro.aota@wdc.com>
Mon, 11 Aug 2025 16:32:58 +0000 (01:32 +0900)
committerDavid Sterba <dsterba@suse.com>
Wed, 13 Aug 2025 12:08:45 +0000 (14:08 +0200)
The commit f2cb97ee964a ("btrfs: index buffer_tree using node size")
changed the index of buffer_tree from "start >> sectorsize_bits" to "start
>> nodesize_bits". However, the change is not applied for
wait_eb_writebacks() and caused IO failures by writing in a full zone. Use
the index properly.

Fixes: f2cb97ee964a ("btrfs: index buffer_tree using node size")
Reviewed-by: Qu Wenruo <wqu@suse.com>
Reviewed-by: Boris Burkov <boris@bur.io>
Signed-off-by: Naohiro Aota <naohiro.aota@wdc.com>
Signed-off-by: David Sterba <dsterba@suse.com>
fs/btrfs/zoned.c

index e0ee3aeabd2c89dbfb25e663d70f80cfb3ae318c..ea662036f4413f57f40d0510e6cf6eaac17e8fe3 100644 (file)
@@ -2242,7 +2242,7 @@ static void wait_eb_writebacks(struct btrfs_block_group *block_group)
        struct btrfs_fs_info *fs_info = block_group->fs_info;
        const u64 end = block_group->start + block_group->length;
        struct extent_buffer *eb;
-       unsigned long index, start = (block_group->start >> fs_info->sectorsize_bits);
+       unsigned long index, start = (block_group->start >> fs_info->nodesize_bits);
 
        rcu_read_lock();
        xa_for_each_start(&fs_info->buffer_tree, index, eb, start) {