Message ID | 20210201212820.64381-3-kreijack@libero.it (mailing list archive) |
---|---|
State | New, archived |
Headers | show |
Series | [1/5] btrfs: add ioctl BTRFS_IOC_DEV_PROPERTIES. | expand |
On 2/1/21 4:28 PM, Goffredo Baroncelli wrote: > From: Goffredo Baroncelli <kreijack@inwind.it> > > Add the following flags to give an hint about which chunk should be > allocated in which a disk. > The following flags are created: > > - BTRFS_DEV_ALLOCATION_PREFERRED_DATA > preferred data chunk, but metadata chunk allowed > - BTRFS_DEV_ALLOCATION_PREFERRED_METADATA > preferred metadata chunk, but data chunk allowed > - BTRFS_DEV_ALLOCATION_METADATA_ONLY > only metadata chunk allowed > - BTRFS_DEV_ALLOCATION_DATA_ONLY > only data chunk allowed > > Signed-off-by: Goffredo Baroncelli <kreijack@inwid.it> > --- > include/uapi/linux/btrfs_tree.h | 18 ++++++++++++++++++ > 1 file changed, 18 insertions(+) > > diff --git a/include/uapi/linux/btrfs_tree.h b/include/uapi/linux/btrfs_tree.h > index 58d7cff9afb1..bd3af853df0c 100644 > --- a/include/uapi/linux/btrfs_tree.h > +++ b/include/uapi/linux/btrfs_tree.h > @@ -361,6 +361,24 @@ struct btrfs_key { > __u64 offset; > } __attribute__ ((__packed__)); > > +/* dev_item.type */ > + > +/* btrfs chunk allocation hints */ > +#define BTRFS_DEV_ALLOCATION_MASK_BIT_COUNT 3 > +#define BTRFS_DEV_ALLOCATION_MASK ((1ULL << \ > + BTRFS_DEV_ALLOCATION_MASK_BIT_COUNT) -1) > +#define BTRFS_DEV_ALLOCATION_MASK_COUNT (1ULL << \ > + BTRFS_DEV_ALLOCATION_MASK_BIT_COUNT) We just want to define the actual values that are going to disk, helpers can be defined elsewhere. Thanks, Josef
On 2/10/21 5:09 PM, Josef Bacik wrote: > On 2/1/21 4:28 PM, Goffredo Baroncelli wrote: >> From: Goffredo Baroncelli <kreijack@inwind.it> [...] >> + >> +/* btrfs chunk allocation hints */ >> +#define BTRFS_DEV_ALLOCATION_MASK_BIT_COUNT 3 >> +#define BTRFS_DEV_ALLOCATION_MASK ((1ULL << \ >> + BTRFS_DEV_ALLOCATION_MASK_BIT_COUNT) -1) >> +#define BTRFS_DEV_ALLOCATION_MASK_COUNT (1ULL << \ >> + BTRFS_DEV_ALLOCATION_MASK_BIT_COUNT) > > We just want to define the actual values that are going to disk, helpers can be defined elsewhere. Thanks, I will move BTRFS_DEV_ALLOCATION_MASK, BTRFS_DEV_ALLOCATION_MASK_COUNT. Instead I like to left BTRFS_DEV_ALLOCATION_MASK_BIT_COUNT here, in order to show how many bits are available. > > Josef Ciao Goffredo
diff --git a/include/uapi/linux/btrfs_tree.h b/include/uapi/linux/btrfs_tree.h index 58d7cff9afb1..bd3af853df0c 100644 --- a/include/uapi/linux/btrfs_tree.h +++ b/include/uapi/linux/btrfs_tree.h @@ -361,6 +361,24 @@ struct btrfs_key { __u64 offset; } __attribute__ ((__packed__)); +/* dev_item.type */ + +/* btrfs chunk allocation hints */ +#define BTRFS_DEV_ALLOCATION_MASK_BIT_COUNT 3 +#define BTRFS_DEV_ALLOCATION_MASK ((1ULL << \ + BTRFS_DEV_ALLOCATION_MASK_BIT_COUNT) -1) +#define BTRFS_DEV_ALLOCATION_MASK_COUNT (1ULL << \ + BTRFS_DEV_ALLOCATION_MASK_BIT_COUNT) +/* preferred data chunk, but metadata chunk allowed */ +#define BTRFS_DEV_ALLOCATION_PREFERRED_DATA (0ULL) +/* preferred metadata chunk, but data chunk allowed */ +#define BTRFS_DEV_ALLOCATION_PREFERRED_METADATA (1ULL) +/* only metadata chunk are allowed */ +#define BTRFS_DEV_ALLOCATION_METADATA_ONLY (2ULL) +/* only data chunk allowed */ +#define BTRFS_DEV_ALLOCATION_DATA_ONLY (3ULL) +/* 5..7 are unused values */ + struct btrfs_dev_item { /* the internal btrfs device id */ __le64 devid;