Re: [PATCH 01/11] btrfs: add macros for compression type and level

David Sterba
2019-01-31T16:00:49Z

On Mon, Jan 28, 2019 at 04:24:27PM -0500, Dennis Zhou wrote:
> It is very easy to miss places that rely on a certain bitshifting for
> decyphering the type_level overloading. Make macros handle this instead.

This encoding was a simple way to introduce the combined type and level
for zlib and it could certainly be improved. Either we'll use helpers
like you suggest or add a new structure that contains type and level as
members. That way we'd see where the level still matters and where the
just the type is ok.

I haven't checked how much intrusive this would be, so that's for later
consideration. Some indirection can be removed for the .set_level
callbacks as it does not necessarily need to be a function so I'm
expecting that the code around that would be touched anyway.