Print this page
%B

@@ -22,10 +22,11 @@
  * Use is subject to license terms.
  */
 
 /*
  * Copyright (c) 2012 by Delphix. All rights reserved.
+ * Copyright (c) 2013 by Saso Kiselkov. All rights reserved.
  */
 
 /*
  * The zfs plug-in routines for GRUB are:
  *

@@ -72,11 +73,22 @@
 {
         {"inherit", 0},                 /* ZIO_COMPRESS_INHERIT */
         {"on", lzjb_decompress},        /* ZIO_COMPRESS_ON */
         {"off", 0},                     /* ZIO_COMPRESS_OFF */
         {"lzjb", lzjb_decompress},      /* ZIO_COMPRESS_LZJB */
-        {"empty", 0}                    /* ZIO_COMPRESS_EMPTY */
+        {"empty", 0},                   /* ZIO_COMPRESS_EMPTY */
+        {"gzip-1", 0},                  /* ZIO_COMPRESS_GZIP_1 */
+        {"gzip-2", 0},                  /* ZIO_COMPRESS_GZIP_2 */
+        {"gzip-3", 0},                  /* ZIO_COMPRESS_GZIP_3 */
+        {"gzip-4", 0},                  /* ZIO_COMPRESS_GZIP_4 */
+        {"gzip-5", 0},                  /* ZIO_COMPRESS_GZIP_5 */
+        {"gzip-6", 0},                  /* ZIO_COMPRESS_GZIP_6 */
+        {"gzip-7", 0},                  /* ZIO_COMPRESS_GZIP_7 */
+        {"gzip-8", 0},                  /* ZIO_COMPRESS_GZIP_8 */
+        {"gzip-9", 0},                  /* ZIO_COMPRESS_GZIP_9 */
+        {"zle", 0},                     /* ZIO_COMPRESS_ZLE */
+        {"lz4", lz4_decompress}         /* ZIO_COMPRESS_LZ4 */
 };
 
 static int zio_read_data(blkptr_t *bp, void *buf, char *stack);
 
 /*

@@ -410,12 +422,17 @@
         if (zio_checksum_verify(bp, buf, psize) != 0) {
                 grub_printf("checksum verification failed\n");
                 return (ERR_FSYS_CORRUPT);
         }
 
-        if (comp != ZIO_COMPRESS_OFF)
-                decomp_table[comp].decomp_func(buf, retbuf, psize, lsize);
+        if (comp != ZIO_COMPRESS_OFF) {
+                if (decomp_table[comp].decomp_func(buf, retbuf, psize,
+                    lsize) != 0) {
+                        grub_printf("zio_read decompression failed\n");
+                        return (ERR_FSYS_CORRUPT);
+                }
+        }
 
         return (0);
 }
 
 /*

@@ -943,10 +960,11 @@
  * List of pool features that the grub implementation of ZFS supports for
  * read. Note that features that are only required for write do not need
  * to be listed here since grub opens pools in read-only mode.
  */
 static const char *spa_feature_names[] = {
+        "org.illumos:lz4_compress",
         NULL
 };
 
 /*
  * Checks whether the MOS features that are active are supported by this