diff options
| author | Qu Wenruo <wqu@suse.com> | 2026-02-10 06:24:30 +0300 |
|---|---|---|
| committer | David Sterba <dsterba@suse.com> | 2026-04-07 19:55:56 +0300 |
| commit | 00c865b60b0650723e1f103dc58ca3f01e7bd662 (patch) | |
| tree | 82c735b2b5098372e0ee425f3552c3e2fe048065 | |
| parent | 09664971b33718680c20f94aaf5d18fc8d7b0a3c (diff) | |
| download | linux-00c865b60b0650723e1f103dc58ca3f01e7bd662.tar.xz | |
btrfs: make add_pending_csums() to take an ordered extent as parameter
The structure btrfs_ordered_extent has a lot of list heads for different
purposes, passing a random list_head pointer is never a good idea as if
the wrong list is passed in, the type casting along with the fs will be
screwed up.
Instead pass the btrfs_ordered_extent pointer, and grab the csum_list
inside add_pending_csums() to make it a little safer.
Since we're here, also update the comments to follow the current style.
Reviewed-by: Filipe Manana <fdmanana@suse.com>
Signed-off-by: Qu Wenruo <wqu@suse.com>
Signed-off-by: David Sterba <dsterba@suse.com>
| -rw-r--r-- | fs/btrfs/inode.c | 12 |
1 files changed, 7 insertions, 5 deletions
diff --git a/fs/btrfs/inode.c b/fs/btrfs/inode.c index 65c00e9cd7a4..1f38dcc635e3 100644 --- a/fs/btrfs/inode.c +++ b/fs/btrfs/inode.c @@ -2746,17 +2746,19 @@ void btrfs_clear_delalloc_extent(struct btrfs_inode *inode, } /* - * given a list of ordered sums record them in the inode. This happens - * at IO completion time based on sums calculated at bio submission time. + * Given an ordered extent and insert all its checksums into the csum tree. + * + * This happens at IO completion time based on sums calculated at bio + * submission time. */ static int add_pending_csums(struct btrfs_trans_handle *trans, - struct list_head *list) + struct btrfs_ordered_extent *oe) { struct btrfs_ordered_sum *sum; struct btrfs_root *csum_root = NULL; int ret; - list_for_each_entry(sum, list, list) { + list_for_each_entry(sum, &oe->csum_list, list) { if (!csum_root) { csum_root = btrfs_csum_root(trans->fs_info, sum->logical); @@ -3322,7 +3324,7 @@ int btrfs_finish_one_ordered(struct btrfs_ordered_extent *ordered_extent) goto out; } - ret = add_pending_csums(trans, &ordered_extent->csum_list); + ret = add_pending_csums(trans, ordered_extent); if (unlikely(ret)) { btrfs_abort_transaction(trans, ret); goto out; |
