Re: [PATCH 1/4] zstd: pass pointer rathen than structure to functions
From: Andrew Morton
Date: Wed Jun 05 2019 - 17:36:26 EST
On Wed, 5 Jun 2019 14:32:53 +0200 David Sterba <dsterba@xxxxxxx> wrote:
> > >
> > > -static ZSTD_parameters zstd_get_btrfs_parameters(unsigned int level,
> > > +static ZSTD_parameters *zstd_get_btrfs_parameters(unsigned int level,
> > > size_t src_len)
> > > {
> > > - ZSTD_parameters params = ZSTD_getParams(level, src_len, 0);
> > > + static ZSTD_parameters params;
> >
> > > +
> > > + params = ZSTD_getParams(level, src_len, 0);
> >
> > No thats' broken, the params can't be static as it depends on level and
> > src_len. What happens if there are several requests in parallel with
> > eg. different levels?
I wondered. I'll drop the patch series as some more serious thinking
is needed.
> > Would be really great if the mailinglist is CCed when the code is
> > changed in a non-trivial way.
Well we didn't actually change btrfs until I discovered that Maninder
had missed it.
> So this does not compile fs/btrfs/zstd.o which Andrew probably found
> too, otherwise btrfs is the only in-tree user of the function outside of
> lib/ and crypto/.
Worked for me - I might have sent the wrong version.
> I think that Nick Terrell should have been CCed too, as he ported zstd
> to linux.