]> git.ipfire.org Git - thirdparty/kernel/linux.git/commitdiff
btrfs: use the helper extent_buffer_uptodate() everywhere
authorFilipe Manana <fdmanana@suse.com>
Mon, 9 Feb 2026 10:44:16 +0000 (10:44 +0000)
committerDavid Sterba <dsterba@suse.com>
Tue, 7 Apr 2026 16:55:55 +0000 (18:55 +0200)
Instead of open coding testing the uptodate bit on the extent buffer's
flags, use the existing helper extent_buffer_uptodate() (which is even
shorter to type). Also change the helper's return value from int to bool,
since we always use it in a boolean context.

Reviewed-by: Boris Burkov <boris@bur.io>
Signed-off-by: Filipe Manana <fdmanana@suse.com>
Signed-off-by: David Sterba <dsterba@suse.com>
fs/btrfs/extent_io.c
fs/btrfs/extent_io.h

index 5f97a3d2a8d7246b257259a419edeb7559dc2971..942cc95a0375c75f411d954db48bbe42723249d3 100644 (file)
@@ -3871,7 +3871,7 @@ int read_extent_buffer_pages_nowait(struct extent_buffer *eb, int mirror_num,
        struct btrfs_fs_info *fs_info = eb->fs_info;
        struct btrfs_bio *bbio;
 
-       if (test_bit(EXTENT_BUFFER_UPTODATE, &eb->bflags))
+       if (extent_buffer_uptodate(eb))
                return 0;
 
        /*
@@ -3892,7 +3892,7 @@ int read_extent_buffer_pages_nowait(struct extent_buffer *eb, int mirror_num,
         * started and finished reading the same eb.  In this case, UPTODATE
         * will now be set, and we shouldn't read it in again.
         */
-       if (unlikely(test_bit(EXTENT_BUFFER_UPTODATE, &eb->bflags))) {
+       if (unlikely(extent_buffer_uptodate(eb))) {
                clear_extent_buffer_reading(eb);
                return 0;
        }
@@ -3929,7 +3929,7 @@ int read_extent_buffer_pages(struct extent_buffer *eb, int mirror_num,
                return ret;
 
        wait_on_bit_io(&eb->bflags, EXTENT_BUFFER_READING, TASK_UNINTERRUPTIBLE);
-       if (unlikely(!test_bit(EXTENT_BUFFER_UPTODATE, &eb->bflags)))
+       if (unlikely(!extent_buffer_uptodate(eb)))
                return -EIO;
        return 0;
 }
index 8d05f1a58b7c30ea2b94df58fbd78bb07448e310..d5851cc06f322596f43718e1acab346d59d69aac 100644 (file)
@@ -298,7 +298,7 @@ static inline int __pure num_extent_folios(const struct extent_buffer *eb)
        return num_extent_pages(eb);
 }
 
-static inline int extent_buffer_uptodate(const struct extent_buffer *eb)
+static inline bool extent_buffer_uptodate(const struct extent_buffer *eb)
 {
        return test_bit(EXTENT_BUFFER_UPTODATE, &eb->bflags);
 }