On Mon, Feb 11, 2019 at 10:35:04AM +0200, Nikolay Borisov wrote:
> Rather than hijacking the existing defines let's just define new bits,
> with more descriptive names. Instead of using yet more (currently at 18)
> bits for the new flags, use the fact those flags will be specific to
> the device allocation tree so define them using existing EXTENT_* flags.
> 
> Signed-off-by: Nikolay Borisov <nbori...@suse.com>
> ---
>  fs/btrfs/extent_io.h | 4 ++++
>  1 file changed, 4 insertions(+)
> 
> diff --git a/fs/btrfs/extent_io.h b/fs/btrfs/extent_io.h
> index d7beb2b3bc7d..af7e00a3678c 100644
> --- a/fs/btrfs/extent_io.h
> +++ b/fs/btrfs/extent_io.h
> @@ -29,6 +29,10 @@
>                                EXTENT_CLEAR_DATA_RESV)
>  #define EXTENT_CTLBITS               (EXTENT_DO_ACCOUNTING)
>  
> +
> +/* Redefined bits above which are used only in the device allocation tree */
> +#define CHUNK_ALLOCATED EXTENT_DIRTY

I see that 18 and more flags can be a lot, though for clarity could we
use unique values? The bitmask is u32 or unsigned, so still some left to
use. And I ve seen only 2 new more so it's not like you need 10, there
it would make more sense to reuse.

As the extent_io tree is used in different contexts, we can add some
sanity checks based on the disjoint sets of flags, but that's just an
idea and I don't have concrete examples.

Reply via email to