The first four bytes is the length of all data chunks, and the first
four bytes of each chunk is the length of compressed chunk data,
even when there's only one chunk, which is the case for inline
extents.

Signed-off-by: Li Zefan <l...@cn.fujitsu.com>
---
 fs/btrfs/snappy.c |    4 ++++
 1 files changed, 4 insertions(+), 0 deletions(-)

diff --git a/fs/btrfs/snappy.c b/fs/btrfs/snappy.c
index d6bd607..35b877e 100644
--- a/fs/btrfs/snappy.c
+++ b/fs/btrfs/snappy.c
@@ -392,12 +392,16 @@ static int btrfs_snappy_decompress(struct list_head *ws, 
unsigned char *data_in,
        struct workspace *workspace = list_entry(ws, struct workspace, list);
        size_t in_len;
        size_t out_len;
+       size_t tot_len;
        int ret = 0;
        char *kaddr;
        unsigned long bytes;
 
        BUG_ON(srclen < SNAPPY_LEN);
 
+       tot_len = read_compress_length(data_in);
+       data_in += SNAPPY_LEN;
+
        in_len = read_compress_length(data_in);
        data_in += SNAPPY_LEN;
 
-- 
1.7.3.1
--
To unsubscribe from this list: send the line "unsubscribe linux-btrfs" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html

Reply via email to