Message ID | f78a535281ed0bd208db0c2f70aa0e43f18cb40c.1543348078.git.dsterba@suse.com (mailing list archive) |
---|---|
State | New, archived |
Headers | show |
Series | Switch defines to enums | expand |
On Tue, Nov 27, 2018 at 08:53:48PM +0100, David Sterba wrote: > We can use simple enum for values that are not part of on-disk format: > root tree flags. Reviewed-by: Omar Sandoval <osandov@fb.com> > Signed-off-by: David Sterba <dsterba@suse.com> > --- > fs/btrfs/ctree.h | 33 +++++++++++++++++---------------- > 1 file changed, 17 insertions(+), 16 deletions(-) > > diff --git a/fs/btrfs/ctree.h b/fs/btrfs/ctree.h > index 7176b95b40e7..4bb0ac3050ff 100644 > --- a/fs/btrfs/ctree.h > +++ b/fs/btrfs/ctree.h > @@ -1180,22 +1180,23 @@ struct btrfs_subvolume_writers { > /* > * The state of btrfs root > */ > -/* > - * btrfs_record_root_in_trans is a multi-step process, > - * and it can race with the balancing code. But the > - * race is very small, and only the first time the root > - * is added to each transaction. So IN_TRANS_SETUP > - * is used to tell us when more checks are required > - */ > -#define BTRFS_ROOT_IN_TRANS_SETUP 0 > -#define BTRFS_ROOT_REF_COWS 1 > -#define BTRFS_ROOT_TRACK_DIRTY 2 > -#define BTRFS_ROOT_IN_RADIX 3 > -#define BTRFS_ROOT_ORPHAN_ITEM_INSERTED 4 > -#define BTRFS_ROOT_DEFRAG_RUNNING 5 > -#define BTRFS_ROOT_FORCE_COW 6 > -#define BTRFS_ROOT_MULTI_LOG_TASKS 7 > -#define BTRFS_ROOT_DIRTY 8 > +enum { > + /* > + * btrfs_record_root_in_trans is a multi-step process, and it can race > + * with the balancing code. But the race is very small, and only the > + * first time the root is added to each transaction. So IN_TRANS_SETUP > + * is used to tell us when more checks are required > + */ > + BTRFS_ROOT_IN_TRANS_SETUP, > + BTRFS_ROOT_REF_COWS, > + BTRFS_ROOT_TRACK_DIRTY, > + BTRFS_ROOT_IN_RADIX, > + BTRFS_ROOT_ORPHAN_ITEM_INSERTED, > + BTRFS_ROOT_DEFRAG_RUNNING, > + BTRFS_ROOT_FORCE_COW, > + BTRFS_ROOT_MULTI_LOG_TASKS, > + BTRFS_ROOT_DIRTY, > +}; > > /* > * in ram representation of the tree. extent_root is used for all allocations > -- > 2.19.1 >
On 2018/11/28 上午3:53, David Sterba wrote: > We can use simple enum for values that are not part of on-disk format: > root tree flags. > > Signed-off-by: David Sterba <dsterba@suse.com> Reviewed-by: Qu Wenruo <wqu@suse.com> Thanks, Qu > --- > fs/btrfs/ctree.h | 33 +++++++++++++++++---------------- > 1 file changed, 17 insertions(+), 16 deletions(-) > > diff --git a/fs/btrfs/ctree.h b/fs/btrfs/ctree.h > index 7176b95b40e7..4bb0ac3050ff 100644 > --- a/fs/btrfs/ctree.h > +++ b/fs/btrfs/ctree.h > @@ -1180,22 +1180,23 @@ struct btrfs_subvolume_writers { > /* > * The state of btrfs root > */ > -/* > - * btrfs_record_root_in_trans is a multi-step process, > - * and it can race with the balancing code. But the > - * race is very small, and only the first time the root > - * is added to each transaction. So IN_TRANS_SETUP > - * is used to tell us when more checks are required > - */ > -#define BTRFS_ROOT_IN_TRANS_SETUP 0 > -#define BTRFS_ROOT_REF_COWS 1 > -#define BTRFS_ROOT_TRACK_DIRTY 2 > -#define BTRFS_ROOT_IN_RADIX 3 > -#define BTRFS_ROOT_ORPHAN_ITEM_INSERTED 4 > -#define BTRFS_ROOT_DEFRAG_RUNNING 5 > -#define BTRFS_ROOT_FORCE_COW 6 > -#define BTRFS_ROOT_MULTI_LOG_TASKS 7 > -#define BTRFS_ROOT_DIRTY 8 > +enum { > + /* > + * btrfs_record_root_in_trans is a multi-step process, and it can race > + * with the balancing code. But the race is very small, and only the > + * first time the root is added to each transaction. So IN_TRANS_SETUP > + * is used to tell us when more checks are required > + */ > + BTRFS_ROOT_IN_TRANS_SETUP, > + BTRFS_ROOT_REF_COWS, > + BTRFS_ROOT_TRACK_DIRTY, > + BTRFS_ROOT_IN_RADIX, > + BTRFS_ROOT_ORPHAN_ITEM_INSERTED, > + BTRFS_ROOT_DEFRAG_RUNNING, > + BTRFS_ROOT_FORCE_COW, > + BTRFS_ROOT_MULTI_LOG_TASKS, > + BTRFS_ROOT_DIRTY, > +}; > > /* > * in ram representation of the tree. extent_root is used for all allocations >
Looks good,
Reviewed-by: Johannes Thumshirn <jthumshirn@suse.de>
diff --git a/fs/btrfs/ctree.h b/fs/btrfs/ctree.h index 7176b95b40e7..4bb0ac3050ff 100644 --- a/fs/btrfs/ctree.h +++ b/fs/btrfs/ctree.h @@ -1180,22 +1180,23 @@ struct btrfs_subvolume_writers { /* * The state of btrfs root */ -/* - * btrfs_record_root_in_trans is a multi-step process, - * and it can race with the balancing code. But the - * race is very small, and only the first time the root - * is added to each transaction. So IN_TRANS_SETUP - * is used to tell us when more checks are required - */ -#define BTRFS_ROOT_IN_TRANS_SETUP 0 -#define BTRFS_ROOT_REF_COWS 1 -#define BTRFS_ROOT_TRACK_DIRTY 2 -#define BTRFS_ROOT_IN_RADIX 3 -#define BTRFS_ROOT_ORPHAN_ITEM_INSERTED 4 -#define BTRFS_ROOT_DEFRAG_RUNNING 5 -#define BTRFS_ROOT_FORCE_COW 6 -#define BTRFS_ROOT_MULTI_LOG_TASKS 7 -#define BTRFS_ROOT_DIRTY 8 +enum { + /* + * btrfs_record_root_in_trans is a multi-step process, and it can race + * with the balancing code. But the race is very small, and only the + * first time the root is added to each transaction. So IN_TRANS_SETUP + * is used to tell us when more checks are required + */ + BTRFS_ROOT_IN_TRANS_SETUP, + BTRFS_ROOT_REF_COWS, + BTRFS_ROOT_TRACK_DIRTY, + BTRFS_ROOT_IN_RADIX, + BTRFS_ROOT_ORPHAN_ITEM_INSERTED, + BTRFS_ROOT_DEFRAG_RUNNING, + BTRFS_ROOT_FORCE_COW, + BTRFS_ROOT_MULTI_LOG_TASKS, + BTRFS_ROOT_DIRTY, +}; /* * in ram representation of the tree. extent_root is used for all allocations
We can use simple enum for values that are not part of on-disk format: root tree flags. Signed-off-by: David Sterba <dsterba@suse.com> --- fs/btrfs/ctree.h | 33 +++++++++++++++++---------------- 1 file changed, 17 insertions(+), 16 deletions(-)