Define/enum conversions
David Sterba
maintainercover Define/enum conversions
David Sterba (3):
btrfs: tree-log: convert defines to enums
btrsf: async-thread: convert defines to enums
btrfs: tree-log: use symbolic name for first replay stage
fs/btrfs/async-thread.c | 8 +++++--- fs/btrfs/tree-log.c | 22 +++++++++++++--------- 2 files changed, 18 insertions(+), 12 deletions(-)
Signature · 1 line
2.22.0
David Sterba
maintainerPATCH 1/3 btrfs: tree-log: convert defines to enums
Used only for in-memory state tracking.
--- fs/btrfs/tree-log.c | 20 ++++++++++++-------- 1 file changed, 12 insertions(+), 8 deletions(-)
fs/btrfs/tree-log.c +12 -8
@@ -24,10 +24,12 @@* LOG_INODE_EXISTS means to log just enough to recreate the inode * during log replay */ -#define LOG_INODE_ALL 0 -#define LOG_INODE_EXISTS 1 -#define LOG_OTHER_INODE 2 -#define LOG_OTHER_INODE_ALL 3 +enum { +LOG_INODE_ALL , +LOG_INODE_EXISTS , +LOG_OTHER_INODE , +LOG_OTHER_INODE_ALL , +};/* * directory trouble cases
@@ -81,10 +83,12 @@* The last stage is to deal with directories and links and extents * and all the other fun semantics */ -#define LOG_WALK_PIN_ONLY 0 -#define LOG_WALK_REPLAY_INODES 1 -#define LOG_WALK_REPLAY_DIR_INDEX 2 -#define LOG_WALK_REPLAY_ALL 3 +enum { +LOG_WALK_PIN_ONLY , +LOG_WALK_REPLAY_INODES , +LOG_WALK_REPLAY_DIR_INDEX , +LOG_WALK_REPLAY_ALL , +}; static int btrfs_log_inode(struct btrfs_trans_handle *trans, struct btrfs_root *root, struct btrfs_inode *inode,
Signature · 1 line
2.22.0
David Sterba
maintainerPATCH 2/3 btrsf: async-thread: convert defines to enums
In reply to David Sterba--- fs/btrfs/async-thread.c | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-)
fs/btrfs/async-thread.c +5 -3
@@ -12,9 +12,11 @@#include "async-thread.h" #include "ctree.h" -#define WORK_DONE_BIT 0 -#define WORK_ORDER_DONE_BIT 1 -#define WORK_HIGH_PRIO_BIT 2 +enum { +WORK_DONE_BIT , +WORK_ORDER_DONE_BIT , +WORK_HIGH_PRIO_BIT , +};#define NO_THRESHOLD (-1)#define DFT_THRESHOLD (32)
Signature · 1 line
2.22.0
David Sterba
maintainerPATCH 3/3 btrfs: tree-log: use symbolic name for first replay stage
In reply to David Sterba--- fs/btrfs/tree-log.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
fs/btrfs/tree-log.c +1 -1
@@ -6237,7 +6237,7 @@ int btrfs_recover_log_trees(struct btrfs_root *log_root_tree)struct btrfs_fs_info *fs_info = log_root_tree->fs_info;struct walk_control wc = { .process_func = process_one_buffer, - .stage =0 , + .stage =LOG_WALK_PIN_ONLY , }; path =btrfs_alloc_path ();
Signature · 1 line
2.22.0
Quoted 9 lines · David Sterba
David Sterba (3):
btrfs: tree-log: convert defines to enums
btrsf: async-thread: convert defines to enums
btrfs: tree-log: use symbolic name for first replay stagefs/btrfs/async-thread.c | 8 +++++--- fs/btrfs/tree-log.c | 22 +++++++++++++--------- 2 files changed, 18 insertions(+), 12 deletions(-)
Short and sweet, so :
Re: [PATCH 3/3] btrfs: tree-log: use symbolic name for first replay stage
In reply to David SterbaFor whole series.
One nit below.
Quoted 10 lines · David Sterba
Signed-off-by David Sterba <[email protected]>--- fs/btrfs/tree-log.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)fs/btrfs/tree-log.c +0
-0
fs/btrfs/tree-log.c int btrfs_recover_log_trees(struct btrfs_root *log_root_tree) · line 6240
Quoted 5 lines
fs/btrfs/tree-log.c +1
-1@@ -6237,7 +6237,7 @@ int btrfs_recover_log_trees(struct btrfs_root *log_root_tree)struct btrfs_fs_info *fs_info = log_root_tree->fs_info;struct walk_control wc = { .process_func = process_one_buffer, - .stage =0 , + .stage =LOG_WALK_PIN_ONLY ,
Why this isn't enum?
Quoted 4 lines
fs/btrfs/tree-log.c +0
-0}; path =btrfs_alloc_path ();
Re: [PATCH 3/3] btrfs: tree-log: use symbolic name for first replay stage
Quoted 13 lines · Anand Jain
For whole series.
Reviewed-by Anand Jain <[email protected]>One nit below.
Quoted 5 lines · David Sterba
Signed-off-by David Sterba <[email protected]>--- fs/btrfs/tree-log.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
Quoted 12 lines
fs/btrfs/tree-log.c int btrfs_recover_log_trees(struct btrfs_root *log_root_tree) · line 6240
Quoted 10 lines
fs/btrfs/tree-log.c +1
-1@@ -6237,7 +6237,7 @@ int btrfs_recover_log_trees(struct btrfs_root *log_root_tree)struct btrfs_fs_info *fs_info = log_root_tree->fs_info;struct walk_control wc = { .process_func = process_one_buffer, - .stage =0 , + .stage =LOG_WALK_PIN_ONLY ,Why this isn't enum?
It could be, though the values of stage are used as raw int comparing it to some value (eg. replay_one_buffer and LOG_WALK_REPLAY_ALL), so that's beyond the scope of the simple conversion.