Re: [PATCH v6 04/15] btrfs: rework lzo_decompress_bio() to make it subpage compatible
From: David Sterba <hidden>
Date: 2021-07-09 20:40:07
On Mon, Jul 05, 2021 at 10:00:59AM +0800, Qu Wenruo wrote:
int lzo_decompress_bio(struct list_head *ws, struct compressed_bio *cb)
{
struct workspace *workspace = list_entry(ws, struct workspace, list);
- int ret = 0, ret2;
- char *data_in;
- unsigned long page_in_index = 0;
- size_t srclen = cb->compressed_len;
- unsigned long total_pages_in = DIV_ROUND_UP(srclen, PAGE_SIZE);
- unsigned long buf_start;
- unsigned long buf_offset = 0;
- unsigned long bytes;
- unsigned long working_bytes;
- size_t in_len;
- size_t out_len;
- const size_t max_segment_len = lzo1x_worst_compress(PAGE_SIZE);
- unsigned long in_offset;
- unsigned long in_page_bytes_left;
- unsigned long tot_in;
- unsigned long tot_out;
- unsigned long tot_len;
- char *buf;
- bool may_late_unmap, need_unmap;
- struct page **pages_in = cb->compressed_pages;
+ const struct btrfs_fs_info *fs_info = btrfs_sb(cb->inode->i_sb);
+ const u32 sectorsize = fs_info->sectorsize;
+ int ret;
+ u32 len_in; /* Compressed data length, can be unaligned */
+ u32 cur_in = 0; /* Offset inside the compressed data */
+ u64 cur_out = 0; /* Bytes decompressed so far */This can be u32 as well