linux-btrfs.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] Btrfs: fix decompressing of snappy-compressed inline extents
@ 2012-01-17  9:07 Li Zefan
  0 siblings, 0 replies; only message in thread
From: Li Zefan @ 2012-01-17  9:07 UTC (permalink / raw)
  To: Chris Mason; +Cc: Andi Kleen, linux-btrfs@vger.kernel.org

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 <lizf@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

^ permalink raw reply related	[flat|nested] only message in thread

only message in thread, other threads:[~2012-01-17  9:07 UTC | newest]

Thread overview: (only message) (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2012-01-17  9:07 [PATCH] Btrfs: fix decompressing of snappy-compressed inline extents Li Zefan

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).