]> git.ipfire.org Git - thirdparty/kernel/linux.git/commitdiff
btrfs: use READA_FORWARD_ALWAYS for device extent verification
authorjinbaohong <jinbaohong@synology.com>
Wed, 14 Jan 2026 01:18:15 +0000 (01:18 +0000)
committerDavid Sterba <dsterba@suse.com>
Tue, 3 Feb 2026 06:51:43 +0000 (07:51 +0100)
btrfs_verify_dev_extents() iterates through the entire device tree
during mount to verify dev extents against chunks. Since this function
scans the whole tree, READA_FORWARD_ALWAYS is more appropriate than
READA_FORWARD.

While the device tree is typically small (a few hundred KB even for
multi-TB filesystems), using the correct readahead mode for full-tree
iteration is more consistent with the intended usage.

Signed-off-by: robbieko <robbieko@synology.com>
Signed-off-by: jinbaohong <jinbaohong@synology.com>
Reviewed-by: David Sterba <dsterba@suse.com>
Signed-off-by: David Sterba <dsterba@suse.com>
fs/btrfs/volumes.c

index 844657f23e7d8666487da73edf65b9843b5bc91f..c4be17fcb87a404a8de6c6357f2eb3402e51278c 100644 (file)
@@ -8026,7 +8026,7 @@ int btrfs_verify_dev_extents(struct btrfs_fs_info *fs_info)
        if (!path)
                return -ENOMEM;
 
-       path->reada = READA_FORWARD;
+       path->reada = READA_FORWARD_ALWAYS;
        ret = btrfs_search_slot(NULL, root, &key, path, 0, 0);
        if (ret < 0)
                return ret;