]> git.ipfire.org Git - thirdparty/kernel/linux.git/commitdiff
btrfs: rename btrfs_ordered_extent::list to csum_list
authorQu Wenruo <wqu@suse.com>
Tue, 10 Feb 2026 03:24:29 +0000 (13:54 +1030)
committerDavid Sterba <dsterba@suse.com>
Tue, 7 Apr 2026 16:55:56 +0000 (18:55 +0200)
That list head records all pending checksums for that ordered
extent. And unlike other lists, we just use the name "list", which can
be very confusing for readers.

Rename it to "csum_list" which follows the remaining lists, showing the
purpose of the list.

And since we're here, remove a comment inside
btrfs_finish_ordered_zoned() where we have
"ASSERT(!list_empty(&ordered->csum_list))" to make sure the OE has
pending csums.

That comment is only here to make sure we do not call list_first_entry()
before checking BTRFS_ORDERED_PREALLOC.
But since we already have that bit checked and even have a dedicated
ASSERT(), there is no need for that comment anymore.

Reviewed-by: Filipe Manana <fdmanana@suse.com>
Signed-off-by: Qu Wenruo <wqu@suse.com>
Signed-off-by: David Sterba <dsterba@suse.com>
fs/btrfs/inode.c
fs/btrfs/ordered-data.c
fs/btrfs/ordered-data.h
fs/btrfs/tree-log.c
fs/btrfs/zoned.c

index a4ad37fd65fbecbe731cb5a66d2818bcaf8eb2d0..65c00e9cd7a4a07657514d7f40d28527560840ef 100644 (file)
@@ -3272,8 +3272,8 @@ int btrfs_finish_one_ordered(struct btrfs_ordered_extent *ordered_extent)
 
        if (test_bit(BTRFS_ORDERED_NOCOW, &ordered_extent->flags)) {
                /* Logic error */
-               ASSERT(list_empty(&ordered_extent->list));
-               if (unlikely(!list_empty(&ordered_extent->list))) {
+               ASSERT(list_empty(&ordered_extent->csum_list));
+               if (unlikely(!list_empty(&ordered_extent->csum_list))) {
                        ret = -EINVAL;
                        btrfs_abort_transaction(trans, ret);
                        goto out;
@@ -3322,7 +3322,7 @@ int btrfs_finish_one_ordered(struct btrfs_ordered_extent *ordered_extent)
                goto out;
        }
 
-       ret = add_pending_csums(trans, &ordered_extent->list);
+       ret = add_pending_csums(trans, &ordered_extent->csum_list);
        if (unlikely(ret)) {
                btrfs_abort_transaction(trans, ret);
                goto out;
index 5df02c707aee67286235897eb80bcae7eb131de4..a17f18673bed455419dc7f0a3ba281ce441cd877 100644 (file)
@@ -197,7 +197,7 @@ static struct btrfs_ordered_extent *alloc_ordered_extent(
        entry->flags = flags;
        refcount_set(&entry->refs, 1);
        init_waitqueue_head(&entry->wait);
-       INIT_LIST_HEAD(&entry->list);
+       INIT_LIST_HEAD(&entry->csum_list);
        INIT_LIST_HEAD(&entry->log_list);
        INIT_LIST_HEAD(&entry->root_extent_list);
        INIT_LIST_HEAD(&entry->work_list);
@@ -329,7 +329,7 @@ void btrfs_add_ordered_sum(struct btrfs_ordered_extent *entry,
        struct btrfs_inode *inode = entry->inode;
 
        spin_lock(&inode->ordered_tree_lock);
-       list_add_tail(&sum->list, &entry->list);
+       list_add_tail(&sum->list, &entry->csum_list);
        spin_unlock(&inode->ordered_tree_lock);
 }
 
@@ -628,7 +628,7 @@ void btrfs_put_ordered_extent(struct btrfs_ordered_extent *entry)
                ASSERT(list_empty(&entry->log_list));
                ASSERT(RB_EMPTY_NODE(&entry->rb_node));
                btrfs_add_delayed_iput(entry->inode);
-               list_for_each_entry_safe(sum, tmp, &entry->list, list)
+               list_for_each_entry_safe(sum, tmp, &entry->csum_list, list)
                        kvfree(sum);
                kmem_cache_free(btrfs_ordered_extent_cache, entry);
        }
@@ -1323,10 +1323,10 @@ struct btrfs_ordered_extent *btrfs_split_ordered_extent(
                }
        }
 
-       list_for_each_entry_safe(sum, tmpsum, &ordered->list, list) {
+       list_for_each_entry_safe(sum, tmpsum, &ordered->csum_list, list) {
                if (offset == len)
                        break;
-               list_move_tail(&sum->list, &new->list);
+               list_move_tail(&sum->list, &new->csum_list);
                offset += sum->len;
        }
 
index 1e6b0b182b2954e1e9e31fc4408e199dc8acbc14..e178d4a489af77bc352cbc68e7ce39dd9108fbef 100644 (file)
@@ -134,7 +134,7 @@ struct btrfs_ordered_extent {
        struct btrfs_inode *inode;
 
        /* list of checksums for insertion when the extent io is done */
-       struct list_head list;
+       struct list_head csum_list;
 
        /* used for fast fsyncs */
        struct list_head log_list;
index 304a4325e2e091fe7a7c33ee0509527af3fbbbd7..84ca9837fb662a670c0fa9f664ca8da3ccb979bb 100644 (file)
@@ -5088,7 +5088,7 @@ static int log_extent_csums(struct btrfs_trans_handle *trans,
                if (test_and_set_bit(BTRFS_ORDERED_LOGGED_CSUM, &ordered->flags))
                        continue;
 
-               list_for_each_entry(sums, &ordered->list, list) {
+               list_for_each_entry(sums, &ordered->csum_list, list) {
                        ret = log_csums(trans, inode, log_root, sums);
                        if (ret)
                                return ret;
index 3f3233c6221b7d55e9e62fd8733b2957f17643fd..11f4bdd617bb3b0dbf3ac52b5cd502178fac5e9d 100644 (file)
@@ -2123,9 +2123,8 @@ void btrfs_finish_ordered_zoned(struct btrfs_ordered_extent *ordered)
        if (test_bit(BTRFS_ORDERED_PREALLOC, &ordered->flags))
                return;
 
-       ASSERT(!list_empty(&ordered->list));
-       /* The ordered->list can be empty in the above pre-alloc case. */
-       sum = list_first_entry(&ordered->list, struct btrfs_ordered_sum, list);
+       ASSERT(!list_empty(&ordered->csum_list));
+       sum = list_first_entry(&ordered->csum_list, struct btrfs_ordered_sum, list);
        logical = sum->logical;
        len = sum->len;
 
@@ -2156,7 +2155,7 @@ out:
         */
        if ((inode->flags & BTRFS_INODE_NODATASUM) ||
            test_bit(BTRFS_FS_STATE_NO_DATA_CSUMS, &fs_info->fs_state)) {
-               while ((sum = list_first_entry_or_null(&ordered->list,
+               while ((sum = list_first_entry_or_null(&ordered->csum_list,
                                                       typeof(*sum), list))) {
                        list_del(&sum->list);
                        kfree(sum);