From: Phillip Lougher <phillip@lougher.demon.co.uk>
To: Ferenc Wagner <wferi@niif.hu>
Cc: Alain Knaff <alain@knaff.lu>,
linux-kernel@vger.kernel.org, "H. Peter Anvin" <hpa@zytor.com>
Subject: Re: kernel decompressor interface
Date: Wed, 31 Mar 2010 01:25:25 +0100 [thread overview]
Message-ID: <4BB29675.9050507@lougher.demon.co.uk> (raw)
In-Reply-To: <877hotu6x9.fsf@tac.ki.iif.hu>
Ferenc Wagner wrote:
> Hi,
>
> While working with SquashFS code recently, I got the impression that the
> current decompress_fn interface isn't best suited for general use: it
> rules out real scatter/gather operation, which -- one hopes -- is a
> general feature of stream decompressors. For example, if one has to
> decompress data from a series of buffer_heads into a bunch of (cache)
> pages (typical operation in compressed file systems), the inflate
> interface in zlib.h provides the possibility of changing input and
> output buffer addresses, but decompress_fn does not, necessitating extra
> memory copying. On the other hand, the latter is admittedly simpler.
>
The decompress_fn interface is rather limited, however, it must
be borne in mind that it was adequate for the original intended
users (initramfs/initrd decompression). Squashfs (and other filesystems) on
the other hand can certainly make use of a much better multi-call interface.
My strategy in adding LZMA support to Squashfs has been to get an implementation
using the current interface mainlined, and one this has been done to look at
improving the decompress_fn interface.
> However, I feel like their advantages could be combined by making the
> fill() and flush() callbacks able to change the buffer addresses, like
> int fill(void **, unsigned int) for example. Even better, some context
> could also be passed around, so that they can easily carry private state.
>
> A cursory look at the LZMA decompressor implementation suggests that
> this would be straightforward change (although I haven't done it).
LZMA decompressors have a quirk in that they use the output buffer
as the history buffer (e.g. look for peek_old_byte() in decompress_unlzma.c).
This means any multi-call interface such as zlib which modifies the output
buffer pointer dynamically (without allowing the decompressor to look back at
previously passed in buffers) won't work. A multi-call interface that
passes the output buffers in an iovec style array should work though
(incidentally this is why Squashfs passes the output buffers as an array
to the decompressor wrapper even though LZMA cannot as yet make use of it)
The following original thread about inclusion of LZMA into the kernel
has some relevant information.
http://www.mail-archive.com/linux-embedded@vger.kernel.org/msg01371.html
Phillip
> Do
> you think that
> 1. it could be done for other decompressors (lzo, bunzip) as well, and
> 2. it should be done in any form (interface replacement or extension)?
next prev parent reply other threads:[~2010-03-31 0:25 UTC|newest]
Thread overview: 4+ messages / expand[flat|nested] mbox.gz Atom feed top
[not found] <877hotu6x9.fsf@tac.ki.iif.hu>
2010-03-30 17:45 ` H. Peter Anvin
2010-03-31 0:25 ` Phillip Lougher [this message]
2010-03-31 17:45 ` H. Peter Anvin
2010-04-01 12:11 ` Ferenc Wagner
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=4BB29675.9050507@lougher.demon.co.uk \
--to=phillip@lougher.demon.co.uk \
--cc=alain@knaff.lu \
--cc=hpa@zytor.com \
--cc=linux-kernel@vger.kernel.org \
--cc=wferi@niif.hu \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox
all inboxes | Powered by JetHome®