Fix missing squashfs_finish_page's

This commit is contained in:
Sean Purcell 2017-04-27 17:19:20 -07:00
parent eeeb201e70
commit c7e107197a
2 changed files with 13 additions and 9 deletions

View File

@ -104,6 +104,7 @@ static int zstd_uncompress(struct squashfs_sb_info *msblk, void *strm,
if (out_buf.dst == NULL) { if (out_buf.dst == NULL) {
/* shouldn't run out of pages before stream is /* shouldn't run out of pages before stream is
* done */ * done */
squashfs_finish_page(output);
goto out; goto out;
} }
out_buf.pos = 0; out_buf.pos = 0;
@ -118,13 +119,14 @@ static int zstd_uncompress(struct squashfs_sb_info *msblk, void *strm,
put_bh(bh[k++]); put_bh(bh[k++]);
} while (zstd_err != 0 && !ZSTD_isError(zstd_err)); } while (zstd_err != 0 && !ZSTD_isError(zstd_err));
squashfs_finish_page(output);
if (ZSTD_isError(zstd_err)) { if (ZSTD_isError(zstd_err)) {
ERROR("zstd decompression error: %d\n", ERROR("zstd decompression error: %d\n",
(int)ZSTD_getErrorCode(zstd_err)); (int)ZSTD_getErrorCode(zstd_err));
goto out;
} }
squashfs_finish_page(output);
if (k < b) if (k < b)
goto out; goto out;

View File

@ -1,8 +1,8 @@
commit 47ba72b36506f91c3774c0bb1fa3c7a5dcfe3ea1 commit 16bb6b9fd684eadba41a36223d67805d7ea741e7
Author: Sean Purcell <me@seanp.xyz> Author: Sean Purcell <me@seanp.xyz>
Date: Thu Apr 27 16:50:53 2017 -0700 Date: Thu Apr 27 17:17:58 2017 -0700
Add zstd support to kernel squashfs Add zstd support to squashfs
diff --git a/fs/squashfs/Kconfig b/fs/squashfs/Kconfig diff --git a/fs/squashfs/Kconfig b/fs/squashfs/Kconfig
index ffb093e..1adb334 100644 index ffb093e..1adb334 100644
@ -90,10 +90,10 @@ index 506f4ba..24d12fd 100644
__le32 s_magic; __le32 s_magic;
diff --git a/fs/squashfs/zstd_wrapper.c b/fs/squashfs/zstd_wrapper.c diff --git a/fs/squashfs/zstd_wrapper.c b/fs/squashfs/zstd_wrapper.c
new file mode 100644 new file mode 100644
index 0000000..af72c7b index 0000000..7cc9303
--- /dev/null --- /dev/null
+++ b/fs/squashfs/zstd_wrapper.c +++ b/fs/squashfs/zstd_wrapper.c
@@ -0,0 +1,147 @@ @@ -0,0 +1,149 @@
+/* +/*
+ * Squashfs - a compressed read only filesystem for Linux + * Squashfs - a compressed read only filesystem for Linux
+ * + *
@ -200,6 +200,7 @@ index 0000000..af72c7b
+ if (out_buf.dst == NULL) { + if (out_buf.dst == NULL) {
+ /* shouldn't run out of pages before stream is + /* shouldn't run out of pages before stream is
+ * done */ + * done */
+ squashfs_finish_page(output);
+ goto out; + goto out;
+ } + }
+ out_buf.pos = 0; + out_buf.pos = 0;
@ -214,13 +215,14 @@ index 0000000..af72c7b
+ put_bh(bh[k++]); + put_bh(bh[k++]);
+ } while (zstd_err != 0 && !ZSTD_isError(zstd_err)); + } while (zstd_err != 0 && !ZSTD_isError(zstd_err));
+ +
+ squashfs_finish_page(output);
+
+ if (ZSTD_isError(zstd_err)) { + if (ZSTD_isError(zstd_err)) {
+ ERROR("zstd decompression error: %d\n", + ERROR("zstd decompression error: %d\n",
+ (int)ZSTD_getErrorCode(zstd_err)); + (int)ZSTD_getErrorCode(zstd_err));
+ goto out;
+ } + }
+ +
+ squashfs_finish_page(output);
+
+ if (k < b) + if (k < b)
+ goto out; + goto out;
+ +