Skip to content

Commit 853b572

Browse files
committed
btrfs: change return type of btrfs_alloc_dummy_sum() to int
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>
1 parent d2080c7 commit 853b572

File tree

3 files changed

+5
-4
lines changed

3 files changed

+5
-4
lines changed

fs/btrfs/bio.c

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -755,7 +755,8 @@ static bool btrfs_submit_chunk(struct btrfs_bio *bbio, int mirror_num)
755755
} else if (use_append ||
756756
(btrfs_is_zoned(fs_info) && inode &&
757757
inode->flags & BTRFS_INODE_NODATASUM)) {
758-
status = btrfs_alloc_dummy_sum(bbio);
758+
ret = btrfs_alloc_dummy_sum(bbio);
759+
status = errno_to_blk_status(ret);
759760
if (status)
760761
goto fail;
761762
}

fs/btrfs/file-item.c

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -794,11 +794,11 @@ int btrfs_csum_one_bio(struct btrfs_bio *bbio)
794794
* record the updated logical address on Zone Append completion.
795795
* Allocate just the structure with an empty sums array here for that case.
796796
*/
797-
blk_status_t btrfs_alloc_dummy_sum(struct btrfs_bio *bbio)
797+
int btrfs_alloc_dummy_sum(struct btrfs_bio *bbio)
798798
{
799799
bbio->sums = kmalloc(sizeof(*bbio->sums), GFP_NOFS);
800800
if (!bbio->sums)
801-
return BLK_STS_RESOURCE;
801+
return -ENOMEM;
802802
bbio->sums->len = bbio->bio.bi_iter.bi_size;
803803
bbio->sums->logical = bbio->bio.bi_iter.bi_sector << SECTOR_SHIFT;
804804
btrfs_add_ordered_sum(bbio->ordered, bbio->sums);

fs/btrfs/file-item.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -65,7 +65,7 @@ int btrfs_csum_file_blocks(struct btrfs_trans_handle *trans,
6565
struct btrfs_root *root,
6666
struct btrfs_ordered_sum *sums);
6767
int btrfs_csum_one_bio(struct btrfs_bio *bbio);
68-
blk_status_t btrfs_alloc_dummy_sum(struct btrfs_bio *bbio);
68+
int btrfs_alloc_dummy_sum(struct btrfs_bio *bbio);
6969
int btrfs_lookup_csums_range(struct btrfs_root *root, u64 start, u64 end,
7070
struct list_head *list, int search_commit,
7171
bool nowait);

0 commit comments

Comments
 (0)