btrfs: change return type of btrfs_csum_one_bio() to int
authorDavid Sterba <dsterba@suse.com>
Wed, 23 Apr 2025 15:57:15 +0000 (17:57 +0200)
committerDavid Sterba <dsterba@suse.com>
Thu, 15 May 2025 12:30:48 +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_bio_csum().

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 5c40035e493d924cd02cbac401105ef5d37588a4..4f622bf130c2aa2689b7803109462e35307d22b3 100644 (file)
@@ -516,7 +516,7 @@ static blk_status_t btrfs_bio_csum(struct btrfs_bio *bbio)
 {
        if (bbio->bio.bi_opf & REQ_META)
                return btree_csum_one_bio(bbio);
-       return btrfs_csum_one_bio(bbio);
+       return errno_to_blk_status(btrfs_csum_one_bio(bbio));
 }
 
 /*
index 895c435314f5806af629d4b15f93c453821848df..293dd3298b98bb64a7738d5adb71f6471c40c04b 100644 (file)
@@ -735,7 +735,7 @@ fail:
 /*
  * Calculate checksums of the data contained inside a bio.
  */
-blk_status_t btrfs_csum_one_bio(struct btrfs_bio *bbio)
+int btrfs_csum_one_bio(struct btrfs_bio *bbio)
 {
        struct btrfs_ordered_extent *ordered = bbio->ordered;
        struct btrfs_inode *inode = bbio->inode;
@@ -757,7 +757,7 @@ blk_status_t btrfs_csum_one_bio(struct btrfs_bio *bbio)
        memalloc_nofs_restore(nofs_flag);
 
        if (!sums)
-               return BLK_STS_RESOURCE;
+               return -ENOMEM;
 
        sums->len = bio->bi_iter.bi_size;
        INIT_LIST_HEAD(&sums->list);
index 995539a68df8be40b9966d5078702c77b6895bd2..323dfb84f16c1d4a4174e3d75eb7ab742e635220 100644 (file)
@@ -64,7 +64,7 @@ int btrfs_lookup_file_extent(struct btrfs_trans_handle *trans,
 int btrfs_csum_file_blocks(struct btrfs_trans_handle *trans,
                           struct btrfs_root *root,
                           struct btrfs_ordered_sum *sums);
-blk_status_t btrfs_csum_one_bio(struct btrfs_bio *bbio);
+int btrfs_csum_one_bio(struct btrfs_bio *bbio);
 blk_status_t 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,