On Mon, Aug 12, 2019 at 11:30:42AM +0300, Nikolay Borisov wrote:
>
>
> On 9.08.19 г. 17:55 ч., David Sterba wrote:
> > The maximum and default levels do not change and can be defined
> > directly. The set_level callback was a temporary solution and will be
> > removed.
> >
> > Signed-off-by: David Sterba <dsterba@xxxxxxxx>
> > ---
> > fs/btrfs/compression.h | 4 ++++
> > fs/btrfs/lzo.c | 2 ++
> > fs/btrfs/zlib.c | 2 ++
> > fs/btrfs/zstd.c | 2 ++
> > 4 files changed, 10 insertions(+)
> >
> > diff --git a/fs/btrfs/compression.h b/fs/btrfs/compression.h
> > index 2035b8eb1290..07b2009dc63f 100644
> > --- a/fs/btrfs/compression.h
> > +++ b/fs/btrfs/compression.h
> > @@ -162,6 +162,10 @@ struct btrfs_compress_op {
> > * if the level is out of bounds or the default if 0 is passed in.
> > */
> > unsigned int (*set_level)(unsigned int level);
> > +
> > + /* Maximum level supported by the compression algorithm */
> > + int max_level;
> > + int default_level;
>
> can levels be negative? If not just define those as unsigned ints and in
> the next patch it won't be necessary to use min_t but plain min.
No, levels should be >= 0.