diff --git a/fs/btrfs/compression.c b/fs/btrfs/compression.c index 3a5701f68172..e897342bece1 100644 --- a/fs/btrfs/compression.c +++ b/fs/btrfs/compression.c @@ -330,7 +330,6 @@ void btrfs_submit_compressed_write(struct btrfs_ordered_extent *ordered, cb->start = ordered->file_offset; cb->len = ordered->num_bytes; ASSERT(cb->bbio.bio.bi_iter.bi_size == ordered->disk_num_bytes); - cb->compressed_len = ordered->disk_num_bytes; cb->bbio.bio.bi_iter.bi_sector = ordered->disk_bytenr >> SECTOR_SHIFT; cb->bbio.ordered = ordered; @@ -560,7 +559,6 @@ void btrfs_submit_compressed_read(struct btrfs_bio *bbio) em_start = em->start; cb->len = bbio->bio.bi_iter.bi_size; - cb->compressed_len = compressed_len; cb->compress_type = btrfs_extent_map_compression(em); cb->orig_bbio = bbio; cb->bbio.csum_search_commit_root = bbio->csum_search_commit_root; diff --git a/fs/btrfs/compression.h b/fs/btrfs/compression.h index 65b8bc4bbe0b..84600b284e1e 100644 --- a/fs/btrfs/compression.h +++ b/fs/btrfs/compression.h @@ -48,9 +48,6 @@ struct compressed_bio { /* Number of bytes in the inode we're working on */ unsigned int len; - /* Number of bytes on disk */ - unsigned int compressed_len; - /* The compression algorithm for this bio */ u8 compress_type; diff --git a/fs/btrfs/lzo.c b/fs/btrfs/lzo.c index 79642e02181b..0c9093770739 100644 --- a/fs/btrfs/lzo.c +++ b/fs/btrfs/lzo.c @@ -431,6 +431,7 @@ int lzo_decompress_bio(struct list_head *ws, struct compressed_bio *cb) struct workspace *workspace = list_entry(ws, struct workspace, list); struct btrfs_fs_info *fs_info = cb->bbio.inode->root->fs_info; const u32 sectorsize = fs_info->sectorsize; + const u32 compressed_len = bio_get_size(&cb->bbio.bio); struct folio_iter fi; char *kaddr; int ret; @@ -460,14 +461,14 @@ int lzo_decompress_bio(struct list_head *ws, struct compressed_bio *cb) * and all sectors should be used. * If this happens, it means the compressed extent is corrupted. */ - if (unlikely(len_in > min_t(size_t, BTRFS_MAX_COMPRESSED, cb->compressed_len) || - round_up(len_in, sectorsize) < cb->compressed_len)) { + if (unlikely(len_in > min_t(size_t, BTRFS_MAX_COMPRESSED, compressed_len) || + round_up(len_in, sectorsize) < compressed_len)) { struct btrfs_inode *inode = cb->bbio.inode; btrfs_err(fs_info, "lzo header invalid, root %llu inode %llu offset %llu lzo len %u compressed len %u", btrfs_root_id(inode->root), btrfs_ino(inode), - cb->start, len_in, cb->compressed_len); + cb->start, len_in, compressed_len); return -EUCLEAN; } diff --git a/fs/btrfs/zlib.c b/fs/btrfs/zlib.c index c676e715b4f8..147c92a4dd04 100644 --- a/fs/btrfs/zlib.c +++ b/fs/btrfs/zlib.c @@ -351,7 +351,7 @@ int zlib_decompress_bio(struct list_head *ws, struct compressed_bio *cb) int wbits = MAX_WBITS; char *data_in; size_t total_out = 0; - size_t srclen = cb->compressed_len; + const size_t srclen = bio_get_size(&cb->bbio.bio); unsigned long buf_start; bio_first_folio(&fi, &cb->bbio.bio, 0); diff --git a/fs/btrfs/zstd.c b/fs/btrfs/zstd.c index 3e847b91dae3..41547ff187f6 100644 --- a/fs/btrfs/zstd.c +++ b/fs/btrfs/zstd.c @@ -587,7 +587,7 @@ int zstd_decompress_bio(struct list_head *ws, struct compressed_bio *cb) struct btrfs_fs_info *fs_info = cb_to_fs_info(cb); struct workspace *workspace = list_entry(ws, struct workspace, list); struct folio_iter fi; - size_t srclen = cb->compressed_len; + size_t srclen = bio_get_size(&cb->bbio.bio); zstd_dstream *stream; int ret = 0; const u32 blocksize = fs_info->sectorsize;