On Thu, Jul 27, 2017 at 03:52:56PM +0800, Anand Jain wrote:
> > --- a/fs/btrfs/zlib.c
> > +++ b/fs/btrfs/zlib.c
> > @@ -37,6 +37,7 @@ struct workspace {
> > z_stream strm;
> > char *buf;
> > struct list_head list;
> > + int level;
> > };
>
> No need to set it for the workspace. We could just redefine the
> function prototype for btrfs_compress_op->compress_pages()
> and pass as an argument.
I think this comes from the early version of the patch where the way the
tpe and level were mangled in a bit different way, so it was up to the
compression algo to set it and decipher back without the changes to any
of the interfaces.
> > +static void zlib_set_level(struct list_head *ws, unsigned int type)
> > +{
> > + struct workspace *workspace = list_entry(ws, struct workspace, list);
> > + unsigned level = (type & 0xF0) >> 4;
> > +
> > + workspace->level = level > 0 ? level : 3;
> > +}
> > +
> > const struct btrfs_compress_op btrfs_zlib_compress = {
> > .alloc_workspace = zlib_alloc_workspace,
> > .free_workspace = zlib_free_workspace,
> > .compress_pages = zlib_compress_pages,
> > .decompress_bio = zlib_decompress_bio,
> > .decompress = zlib_decompress,
> > + .set_level = zlib_set_level,
> > };
> >
>
>
> How about the compress-force to accept the compression levels ?
> or I wonder if your are planning to deprecate it in the long run.
Although not mentioned, compress-force also accepts the level. I'll add
it to the changelog in the next version.
--
To unsubscribe from this list: send the line "unsubscribe linux-btrfs" in
the body of a message to [email protected]
More majordomo info at http://vger.kernel.org/majordomo-info.html