1. 09 Sep, 2017 1 commit
    • Sean Purcell's avatar
      squashfs: Add zstd support · 87bf54bb
      Sean Purcell authored
      Add zstd compression and decompression support to SquashFS. zstd is a
      great fit for SquashFS because it can compress at ratios approaching xz,
      while decompressing twice as fast as zlib. For SquashFS in particular,
      it can decompress as fast as lzo and lz4. It also has the flexibility
      to turn down the compression ratio for faster compression times.
      The compression benchmark is run on the file tree from the SquashFS archive
      found in ubuntu-16.10-desktop-amd64.iso [1]. It uses `mksquashfs` with the
      default block size (128 KB) and and various compression algorithms/levels.
      xz and zstd are also benchmarked with 256 KB blocks. The decompression
      benchmark times how long it takes to `tar` the file tree into `/dev/null`.
      See the benchmark file in the upstream zstd source repository located under
      `contrib/linux-kernel/squashfs-benchmark.sh` [2] for details.
      I ran the benchmarks on a Ubuntu 14.04 VM with 2 cores and 4 GiB of RAM.
      The VM is running on a MacBook Pro with a 3.1 GHz Intel Core i7 processor,
      16 GB of RAM, and a SSD.
      | Method         | Ratio | Compression MB/s | Decompression MB/s |
      | gzip           |  2.92 |               15 |                128 |
      | lzo            |  2.64 |              9.5 |                217 |
      | lz4            |  2.12 |               94 |                218 |
      | xz             |  3.43 |              5.5 |                 35 |
      | xz 256 KB      |  3.53 |              5.4 |                 40 |
      | zstd 1         |  2.71 |               96 |                210 |
      | zstd 5         |  2.93 |               69 |                198 |
      | zstd 10        |  3.01 |               41 |                225 |
      | zstd 15        |  3.13 |             11.4 |                224 |
      | zstd 16 256 KB |  3.24 |              8.1 |                210 |
      This patch was written by Sean Purcell <me@seanp.xyz>, but I will be
      taking over the submission process.
      [1] http://releases.ubuntu.com/16.10/
      [2] https://github.com/facebook/zstd/blob/dev/contrib/linux-kernel/squashfs-benchmark.sh
      zstd source repository: https://github.com/facebook/zstdSigned-off-by: 's avatarSean Purcell <me@seanp.xyz>
      Signed-off-by: 's avatarNick Terrell <terrelln@fb.com>
      Signed-off-by: 's avatarChris Mason <clm@fb.com>
      Acked-by: 's avatarPhillip Lougher <phillip@squashfs.org.uk>
  2. 04 Apr, 2016 1 commit
    • Kirill A. Shutemov's avatar
      mm, fs: get rid of PAGE_CACHE_* and page_cache_{get,release} macros · 09cbfeaf
      Kirill A. Shutemov authored
      PAGE_CACHE_{SIZE,SHIFT,MASK,ALIGN} macros were introduced *long* time
      ago with promise that one day it will be possible to implement page
      cache with bigger chunks than PAGE_SIZE.
      This promise never materialized.  And unlikely will.
      We have many places where PAGE_CACHE_SIZE assumed to be equal to
      PAGE_SIZE.  And it's constant source of confusion on whether
      PAGE_CACHE_* or PAGE_* constant should be used in a particular case,
      especially on the border between fs and mm.
      Global switching to PAGE_CACHE_SIZE != PAGE_SIZE would cause to much
      breakage to be doable.
      Let's stop pretending that pages in page cache are special.  They are
      The changes are pretty straight-forward:
       - <foo> << (PAGE_CACHE_SHIFT - PAGE_SHIFT) -> <foo>;
       - <foo> >> (PAGE_CACHE_SHIFT - PAGE_SHIFT) -> <foo>;
       - page_cache_get() -> get_page();
       - page_cache_release() -> put_page();
      This patch contains automated changes generated with coccinelle using
      script below.  For some reason, coccinelle doesn't patch header files.
      I've called spatch for them manually.
      The only adjustment after coccinelle is revert of changes to
      PAGE_CAHCE_ALIGN definition: we are going to drop it later.
      There are few places in the code where coccinelle didn't reach.  I'll
      fix them manually in a separate patch.  Comments and documentation also
      will be addressed with the separate patch.
      virtual patch
      expression E;
      + E
      expression E;
      + E
      + PAGE_SHIFT
      + PAGE_SIZE
      + PAGE_MASK
      expression E;
      + PAGE_ALIGN(E)
      expression E;
      - page_cache_get(E)
      + get_page(E)
      expression E;
      - page_cache_release(E)
      + put_page(E)
      Signed-off-by: 's avatarKirill A. Shutemov <kirill.shutemov@linux.intel.com>
      Acked-by: 's avatarMichal Hocko <mhocko@suse.com>
      Signed-off-by: 's avatarLinus Torvalds <torvalds@linux-foundation.org>
  3. 27 Nov, 2014 1 commit
  4. 20 Nov, 2013 2 commits
    • Phillip Lougher's avatar
      Squashfs: Generalise paging handling in the decompressors · 846b730e
      Phillip Lougher authored
      Further generalise the decompressors by adding a page handler
      abstraction.  This adds helpers to allow the decompressors
      to access and process the output buffers in an implementation
      independant manner.
      This allows different types of output buffer to be passed
      to the decompressors, with the implementation specific
      aspects handled at decompression time, but without the
      knowledge being held in the decompressor wrapper code.
      This will allow the decompressors to handle Squashfs
      cache buffers, and page cache pages.
      This patch adds the abstraction and an implementation for
      the caches.
      Signed-off-by: 's avatarPhillip Lougher <phillip@squashfs.org.uk>
      Reviewed-by: 's avatarMinchan Kim <minchan@kernel.org>
    • Phillip Lougher's avatar
      Squashfs: Refactor decompressor interface and code · 9508c6b9
      Phillip Lougher authored
      The decompressor interface and code was written from
      the point of view of single-threaded operation.  In doing
      so it mixed a lot of single-threaded implementation specific
      aspects into the decompressor code and elsewhere which makes it
      difficult to seamlessly support multiple different decompressor
      This patch does the following:
      1.  It removes compressor_options parsing from the decompressor
          init() function.  This allows the decompressor init() function
          to be dynamically called to instantiate multiple decompressors,
          without the compressor options needing to be read and parsed each
      2.  It moves threading and all sleeping operations out of the
          decompressors.  In doing so, it makes the decompressors
          non-blocking wrappers which only deal with interfacing with
          the decompressor implementation.
      3. It splits decompressor.[ch] into decompressor generic functions
         in decompressor.[ch], and moves the single threaded
         decompressor implementation into decompressor_single.c.
      The result of this patch is Squashfs should now be able to
      support multiple decompressors by adding new decompressor_xxx.c
      files with specialised implementations of the functions in
      Signed-off-by: 's avatarPhillip Lougher <phillip@squashfs.org.uk>
      Reviewed-by: 's avatarMinchan Kim <minchan@kernel.org>
  5. 22 Jul, 2011 1 commit
  6. 26 May, 2011 1 commit
  7. 28 Feb, 2011 1 commit
    • Phillip Lougher's avatar
      Squashfs: extend decompressor framework to handle compression options · b7fc0ff0
      Phillip Lougher authored
      Extend decompressor framework to handle compression options stored in
      the filesystem.  These options can be used by the relevant decompressor
      at initialisation time to over-ride defaults.
      The presence of compression options in the filesystem is indicated by
      the COMP_OPT filesystem flag.  If present the data is read from the
      filesystem and passed to the decompressor init function.  The decompressor
      init function signature has been extended to take this data.
      Also update the init function signature in the glib, lzo and xz
      decompressor wrappers.
      Signed-off-by: 's avatarPhillip Lougher <phillip@lougher.demon.co.uk>
  8. 13 Jan, 2011 3 commits
  9. 05 Aug, 2010 1 commit
  10. 20 Jan, 2010 2 commits