diff mbox series

[v2,06/12] btrfs: Introduce new bits for device allocation tree

Message ID 20190211083510.27591-7-nborisov@suse.com (mailing list archive)
State New, archived
Headers show
Series FITRIM improvements | expand

Commit Message

Nikolay Borisov Feb. 11, 2019, 8:35 a.m. UTC
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 <nborisov@suse.com>
---
 fs/btrfs/extent_io.h | 4 ++++
 1 file changed, 4 insertions(+)

Comments

David Sterba Feb. 28, 2019, 4:57 p.m. UTC | #1
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 <nborisov@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.
diff mbox series

Patch

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
+
 /*
  * flags for bio submission. The high bits indicate the compression
  * type for this bio