]> git-server-git.apps.pok.os.sepia.ceph.com Git - ceph-client.git/commitdiff
btrfs: remove atomic parameter from btrfs_buffer_uptodate()
authorQu Wenruo <wqu@suse.com>
Sun, 15 Mar 2026 21:38:24 +0000 (08:08 +1030)
committerDavid Sterba <dsterba@suse.com>
Tue, 7 Apr 2026 16:56:02 +0000 (18:56 +0200)
That parameter was introduced by commit b9fab919b748 ("Btrfs: avoid
sleeping in verify_parent_transid while atomic").
At that time we needed to lock the extent buffer range inside the io tree
to avoid content changes, thus it could sleep.

But that behavior is no longer there, as later commit 9e2aff90fc2a
("btrfs: stop using lock_extent in btrfs_buffer_uptodate") dropped the
io tree lock.

We can remove the @atomic parameter safely now.

Reviewed-by: Filipe Manana <fdmanana@suse.com>
Signed-off-by: Qu Wenruo <wqu@suse.com>
Reviewed-by: David Sterba <dsterba@suse.com>
Signed-off-by: David Sterba <dsterba@suse.com>
fs/btrfs/ctree.c
fs/btrfs/disk-io.c
fs/btrfs/disk-io.h
fs/btrfs/extent-tree.c
fs/btrfs/extent_io.c
fs/btrfs/tree-log.c

index cdd6c1422b53aa79eed109c16d249d059555b1fc..5c68c541de516f4edb81fe729801c781824d9b0c 100644 (file)
@@ -1499,7 +1499,7 @@ read_block_for_search(struct btrfs_root *root, struct btrfs_path *p,
                        reada_for_search(fs_info, p, parent_level, slot, key->objectid);
 
                /* first we do an atomic uptodate check */
-               if (btrfs_buffer_uptodate(tmp, check.transid, true, NULL) > 0) {
+               if (btrfs_buffer_uptodate(tmp, check.transid, NULL) > 0) {
                        /*
                         * Do extra check for first_key, eb can be stale due to
                         * being cached, read from scrub, or have multiple
index 45e6dde6027445f8ceb75fa8d589bd7d2302282e..c835141ee384fdfdc719f93264a94f8644962975 100644 (file)
@@ -109,7 +109,7 @@ static void csum_tree_block(struct extent_buffer *buf, u8 *result)
  * detect blocks that either didn't get written at all or got written
  * in the wrong place.
  */
-int btrfs_buffer_uptodate(struct extent_buffer *eb, u64 parent_transid, bool atomic,
+int btrfs_buffer_uptodate(struct extent_buffer *eb, u64 parent_transid,
                          const struct btrfs_tree_parent_check *check)
 {
        if (!extent_buffer_uptodate(eb))
@@ -125,9 +125,6 @@ int btrfs_buffer_uptodate(struct extent_buffer *eb, u64 parent_transid, bool ato
                return 1;
        }
 
-       if (atomic)
-               return -EAGAIN;
-
        if (btrfs_header_generation(eb) != parent_transid) {
                btrfs_err_rl(eb->fs_info,
 "parent transid verify failed on logical %llu mirror %u wanted %llu found %llu",
@@ -1001,7 +998,7 @@ static struct btrfs_root *read_tree_root_path(struct btrfs_root *tree_root,
                goto fail;
        }
 
-       ret = btrfs_buffer_uptodate(root->node, generation, false, &check);
+       ret = btrfs_buffer_uptodate(root->node, generation, &check);
        if (unlikely(ret <= 0)) {
                if (ret == 0)
                        ret = -EIO;
index 343e332b17c0b6ae41e268a5b1d550d230823f16..9185f8f02eebac058d2dda8b344785019f63d88f 100644 (file)
@@ -107,7 +107,7 @@ static inline struct btrfs_root *btrfs_grab_root(struct btrfs_root *root)
 void btrfs_put_root(struct btrfs_root *root);
 void btrfs_mark_buffer_dirty(struct btrfs_trans_handle *trans,
                             struct extent_buffer *buf);
-int btrfs_buffer_uptodate(struct extent_buffer *buf, u64 parent_transid, bool atomic,
+int btrfs_buffer_uptodate(struct extent_buffer *buf, u64 parent_transid,
                          const struct btrfs_tree_parent_check *check);
 int btrfs_read_extent_buffer(struct extent_buffer *buf,
                             const struct btrfs_tree_parent_check *check);
index 5818ce1ae89d90630340ca0051ef75bd64ed9fcc..92ba7867e74be33cd0367fc3b3fd966e4a1100f3 100644 (file)
@@ -5780,7 +5780,7 @@ static int check_next_block_uptodate(struct btrfs_trans_handle *trans,
 
        generation = btrfs_node_ptr_generation(path->nodes[level], path->slots[level]);
 
-       if (btrfs_buffer_uptodate(next, generation, false, NULL))
+       if (btrfs_buffer_uptodate(next, generation, NULL))
                return 0;
 
        check.level = level - 1;
index f59d1f6aeaa2a5b1a90ff7fce69e19b815e09098..a0d61a6820ce73305cbb67749516e6b692409468 100644 (file)
@@ -3904,7 +3904,7 @@ int read_extent_buffer_pages_nowait(struct extent_buffer *eb, int mirror_num,
        if (extent_buffer_uptodate(eb)) {
                int ret;
 
-               ret = btrfs_buffer_uptodate(eb, 0, true, check);
+               ret = btrfs_buffer_uptodate(eb, 0, check);
                if (unlikely(ret <= 0)) {
                        if (ret == 0)
                                ret = -EIO;
@@ -3935,7 +3935,7 @@ int read_extent_buffer_pages_nowait(struct extent_buffer *eb, int mirror_num,
                int ret;
 
                clear_extent_buffer_reading(eb);
-               ret = btrfs_buffer_uptodate(eb, 0, true, check);
+               ret = btrfs_buffer_uptodate(eb, 0, check);
                if (unlikely(ret <= 0)) {
                        if (ret == 0)
                                ret = -EIO;
@@ -4653,7 +4653,7 @@ void btrfs_readahead_tree_block(struct btrfs_fs_info *fs_info,
        if (IS_ERR(eb))
                return;
 
-       if (btrfs_buffer_uptodate(eb, gen, true, NULL)) {
+       if (btrfs_buffer_uptodate(eb, gen, NULL)) {
                free_extent_buffer(eb);
                return;
        }
index 6cf2828ba5001f89065d6ff8712fc714fb5800a2..de4707b1227efd81e1014e0dc416ad1b081abf7e 100644 (file)
@@ -457,7 +457,7 @@ static int process_one_buffer(struct extent_buffer *eb,
                        return ret;
                }
 
-               if (btrfs_buffer_uptodate(eb, gen, false, NULL) && level == 0) {
+               if (btrfs_buffer_uptodate(eb, gen, NULL) && level == 0) {
                        ret = btrfs_exclude_logged_extents(eb);
                        if (ret)
                                btrfs_abort_transaction(trans, ret);