btrfs: change return type of btrfs_alloc_dummy_sum() to int
authorDavid Sterba <dsterba@suse.com>
Wed, 23 Apr 2025 15:57:23 +0000 (17:57 +0200)
committerDavid Sterba <dsterba@suse.com>
Thu, 15 May 2025 12:30:49 +0000 (14:30 +0200)
The type blk_status_t is from block layer and not related to checksums
in our context. Use int internally and do the conversions to blk_status_t
as needed in btrfs_submit_chunk().

Reviewed-by: Qu Wenruo <wqu@suse.com>
Signed-off-by: David Sterba <dsterba@suse.com>
fs/btrfs/bio.c
fs/btrfs/file-item.c
fs/btrfs/file-item.h

index 05a1bc450c1ccf9a032774ae672cf2e5178bd365..f7d8958b7327921806e7e4ea5815a62ab1f829a3 100644 (file)
@@ -755,7 +755,8 @@ static bool btrfs_submit_chunk(struct btrfs_bio *bbio, int mirror_num)
                } else if (use_append ||
                           (btrfs_is_zoned(fs_info) && inode &&
                            inode->flags & BTRFS_INODE_NODATASUM)) {
-                       status = btrfs_alloc_dummy_sum(bbio);
+                       ret = btrfs_alloc_dummy_sum(bbio);
+                       status = errno_to_blk_status(ret);
                        if (status)
                                goto fail;
                }
index 293dd3298b98bb64a7738d5adb71f6471c40c04b..54d523d4f4212634b76e6f11fea79a4a3daad08b 100644 (file)
@@ -794,11 +794,11 @@ int btrfs_csum_one_bio(struct btrfs_bio *bbio)
  * record the updated logical address on Zone Append completion.
  * Allocate just the structure with an empty sums array here for that case.
  */
-blk_status_t btrfs_alloc_dummy_sum(struct btrfs_bio *bbio)
+int btrfs_alloc_dummy_sum(struct btrfs_bio *bbio)
 {
        bbio->sums = kmalloc(sizeof(*bbio->sums), GFP_NOFS);
        if (!bbio->sums)
-               return BLK_STS_RESOURCE;
+               return -ENOMEM;
        bbio->sums->len = bbio->bio.bi_iter.bi_size;
        bbio->sums->logical = bbio->bio.bi_iter.bi_sector << SECTOR_SHIFT;
        btrfs_add_ordered_sum(bbio->ordered, bbio->sums);
index 323dfb84f16c1d4a4174e3d75eb7ab742e635220..63216c43676defd6a1d7d246d0039086b99c22d8 100644 (file)
@@ -65,7 +65,7 @@ int btrfs_csum_file_blocks(struct btrfs_trans_handle *trans,
                           struct btrfs_root *root,
                           struct btrfs_ordered_sum *sums);
 int btrfs_csum_one_bio(struct btrfs_bio *bbio);
-blk_status_t btrfs_alloc_dummy_sum(struct btrfs_bio *bbio);
+int btrfs_alloc_dummy_sum(struct btrfs_bio *bbio);
 int btrfs_lookup_csums_range(struct btrfs_root *root, u64 start, u64 end,
                             struct list_head *list, int search_commit,
                             bool nowait);