mirror of
https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
synced 2026-05-10 18:40:25 -04:00
btrfs: change return type of btree_csum_one_bio() 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_bio_csum(). Reviewed-by: Qu Wenruo <wqu@suse.com> Signed-off-by: David Sterba <dsterba@suse.com>
This commit is contained in:
@@ -515,7 +515,7 @@ static void btrfs_submit_bio(struct bio *bio, struct btrfs_io_context *bioc,
|
||||
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 errno_to_blk_status(btree_csum_one_bio(bbio));
|
||||
return errno_to_blk_status(btrfs_csum_one_bio(bbio));
|
||||
}
|
||||
|
||||
|
||||
@@ -256,7 +256,7 @@ int btrfs_read_extent_buffer(struct extent_buffer *eb,
|
||||
/*
|
||||
* Checksum a dirty tree block before IO.
|
||||
*/
|
||||
blk_status_t btree_csum_one_bio(struct btrfs_bio *bbio)
|
||||
int btree_csum_one_bio(struct btrfs_bio *bbio)
|
||||
{
|
||||
struct extent_buffer *eb = bbio->private;
|
||||
struct btrfs_fs_info *fs_info = eb->fs_info;
|
||||
@@ -267,9 +267,9 @@ blk_status_t btree_csum_one_bio(struct btrfs_bio *bbio)
|
||||
|
||||
/* Btree blocks are always contiguous on disk. */
|
||||
if (WARN_ON_ONCE(bbio->file_offset != eb->start))
|
||||
return BLK_STS_IOERR;
|
||||
return -EIO;
|
||||
if (WARN_ON_ONCE(bbio->bio.bi_iter.bi_size != eb->len))
|
||||
return BLK_STS_IOERR;
|
||||
return -EIO;
|
||||
|
||||
/*
|
||||
* If an extent_buffer is marked as EXTENT_BUFFER_ZONED_ZEROOUT, don't
|
||||
@@ -278,13 +278,13 @@ blk_status_t btree_csum_one_bio(struct btrfs_bio *bbio)
|
||||
*/
|
||||
if (test_bit(EXTENT_BUFFER_ZONED_ZEROOUT, &eb->bflags)) {
|
||||
memzero_extent_buffer(eb, 0, eb->len);
|
||||
return BLK_STS_OK;
|
||||
return 0;
|
||||
}
|
||||
|
||||
if (WARN_ON_ONCE(found_start != eb->start))
|
||||
return BLK_STS_IOERR;
|
||||
return -EIO;
|
||||
if (WARN_ON(!btrfs_meta_folio_test_uptodate(eb->folios[0], eb)))
|
||||
return BLK_STS_IOERR;
|
||||
return -EIO;
|
||||
|
||||
ASSERT(memcmp_extent_buffer(eb, fs_info->fs_devices->metadata_uuid,
|
||||
offsetof(struct btrfs_header, fsid),
|
||||
@@ -312,7 +312,7 @@ blk_status_t btree_csum_one_bio(struct btrfs_bio *bbio)
|
||||
goto error;
|
||||
}
|
||||
write_extent_buffer(eb, result, 0, fs_info->csum_size);
|
||||
return BLK_STS_OK;
|
||||
return 0;
|
||||
|
||||
error:
|
||||
btrfs_print_tree(eb, 0);
|
||||
@@ -326,7 +326,7 @@ blk_status_t btree_csum_one_bio(struct btrfs_bio *bbio)
|
||||
*/
|
||||
WARN_ON(IS_ENABLED(CONFIG_BTRFS_DEBUG) ||
|
||||
btrfs_header_owner(eb) == BTRFS_TREE_LOG_OBJECTID);
|
||||
return errno_to_blk_status(ret);
|
||||
return ret;
|
||||
}
|
||||
|
||||
static bool check_tree_block_fsid(struct extent_buffer *eb)
|
||||
|
||||
@@ -114,7 +114,7 @@ int btrfs_buffer_uptodate(struct extent_buffer *buf, u64 parent_transid,
|
||||
int btrfs_read_extent_buffer(struct extent_buffer *buf,
|
||||
const struct btrfs_tree_parent_check *check);
|
||||
|
||||
blk_status_t btree_csum_one_bio(struct btrfs_bio *bbio);
|
||||
int btree_csum_one_bio(struct btrfs_bio *bbio);
|
||||
int btrfs_alloc_log_tree_node(struct btrfs_trans_handle *trans,
|
||||
struct btrfs_root *root);
|
||||
int btrfs_init_log_root_tree(struct btrfs_trans_handle *trans,
|
||||
|
||||
Reference in New Issue
Block a user