btrfs: reada, cleanup remove unneeded variable in __readahead_hook
authorDavid Sterba <dsterba@suse.com>
Tue, 8 Nov 2016 12:32:43 +0000 (13:32 +0100)
committerDavid Sterba <dsterba@suse.com>
Wed, 30 Nov 2016 12:45:15 +0000 (13:45 +0100)
We can't touch the eb directly in case the function is called with a
non-zero error, so we can read the eb level when needed.

Signed-off-by: David Sterba <dsterba@suse.com>
fs/btrfs/reada.c

index f7dd892669a594fe677cdc9b183c68d2dbc69526..84a5beb48d46b0edd78f297ed6622fbc69948706 100644 (file)
@@ -109,16 +109,12 @@ static void __readahead_hook(struct btrfs_fs_info *fs_info,
                             struct reada_extent *re, struct extent_buffer *eb,
                             u64 start, int err)
 {
-       int level = 0;
        int nritems;
        int i;
        u64 bytenr;
        u64 generation;
        struct list_head list;
 
-       if (eb)
-               level = btrfs_header_level(eb);
-
        spin_lock(&re->lock);
        /*
         * just take the full list from the extent. afterwards we
@@ -143,7 +139,7 @@ static void __readahead_hook(struct btrfs_fs_info *fs_info,
         * trigger more readahead depending from the content, e.g.
         * fetch the checksums for the extents in the leaf.
         */
-       if (!level)
+       if (!btrfs_header_level(eb))
                goto cleanup;
 
        nritems = btrfs_header_nritems(eb);