From: "H. Peter Anvin" <hpa@zytor.com>
To: Ferenc Wagner <wferi@niif.hu>
Cc: Alain Knaff <alain@knaff.lu>,
linux-kernel@vger.kernel.org,
Phillip Lougher <phillip@lougher.demon.co.uk>
Subject: Re: kernel decompressor interface
Date: Tue, 30 Mar 2010 10:45:55 -0700 [thread overview]
Message-ID: <4BB238D3.7050808@zytor.com> (raw)
In-Reply-To: <877hotu6x9.fsf@tac.ki.iif.hu>
On 03/30/2010 09:10 AM, 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.
>
> 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). 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)?
I think the event-based interfaces in zlib.h are pretty good, myself,
and since they are so widely deployed they are also widely mimiced,
which makes it a good interface to rely on. A simpler "one shot"
interface can then be implemented as a wrapper (since it just means:
create the context, point it at the two buffers, and then tell it to to
run to the end.)
LZO has some super-compact variants that don't support start and stop
operation, but even the "full featured" versions are small enough, that
I don't think it matters for something as large as the Linux kernel. It
mattered to me when I was dealing with self-decompressing objects on the
order of a few tens of kilobytes.
-hpa
next parent reply other threads:[~2010-03-30 17:49 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 [this message]
2010-03-31 0:25 ` kernel decompressor interface Phillip Lougher
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=4BB238D3.7050808@zytor.com \
--to=hpa@zytor.com \
--cc=alain@knaff.lu \
--cc=linux-kernel@vger.kernel.org \
--cc=phillip@lougher.demon.co.uk \
--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