linux-btrfs.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH 0/3] Define/enum conversions
@ 2019-08-01 12:50 David Sterba
  2019-08-01 12:50 ` [PATCH 1/3] btrfs: tree-log: convert defines to enums David Sterba
                   ` (3 more replies)
  0 siblings, 4 replies; 7+ messages in thread
From: David Sterba @ 2019-08-01 12:50 UTC (permalink / raw)
  To: linux-btrfs; +Cc: 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 stage

 fs/btrfs/async-thread.c |  8 +++++---
 fs/btrfs/tree-log.c     | 22 +++++++++++++---------
 2 files changed, 18 insertions(+), 12 deletions(-)

-- 
2.22.0


^ permalink raw reply	[flat|nested] 7+ messages in thread

* [PATCH 1/3] btrfs: tree-log: convert defines to enums
  2019-08-01 12:50 [PATCH 0/3] Define/enum conversions David Sterba
@ 2019-08-01 12:50 ` David Sterba
  2019-08-01 12:50 ` [PATCH 2/3] btrsf: async-thread: " David Sterba
                   ` (2 subsequent siblings)
  3 siblings, 0 replies; 7+ messages in thread
From: David Sterba @ 2019-08-01 12:50 UTC (permalink / raw)
  To: linux-btrfs; +Cc: David Sterba

Used only for in-memory state tracking.

Signed-off-by: David Sterba <dsterba@suse.com>
---
 fs/btrfs/tree-log.c | 20 ++++++++++++--------
 1 file changed, 12 insertions(+), 8 deletions(-)

diff --git a/fs/btrfs/tree-log.c b/fs/btrfs/tree-log.c
index 6c8297bcfeb7..5513e76cc336 100644
--- a/fs/btrfs/tree-log.c
+++ b/fs/btrfs/tree-log.c
@@ -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,
-- 
2.22.0


^ permalink raw reply related	[flat|nested] 7+ messages in thread

* [PATCH 2/3] btrsf: async-thread: convert defines to enums
  2019-08-01 12:50 [PATCH 0/3] Define/enum conversions David Sterba
  2019-08-01 12:50 ` [PATCH 1/3] btrfs: tree-log: convert defines to enums David Sterba
@ 2019-08-01 12:50 ` David Sterba
  2019-08-01 12:50 ` [PATCH 3/3] btrfs: tree-log: use symbolic name for first replay stage David Sterba
  2019-08-01 13:33 ` [PATCH 0/3] Define/enum conversions Nikolay Borisov
  3 siblings, 0 replies; 7+ messages in thread
From: David Sterba @ 2019-08-01 12:50 UTC (permalink / raw)
  To: linux-btrfs; +Cc: David Sterba

Signed-off-by: David Sterba <dsterba@suse.com>
---
 fs/btrfs/async-thread.c | 8 +++++---
 1 file changed, 5 insertions(+), 3 deletions(-)

diff --git a/fs/btrfs/async-thread.c b/fs/btrfs/async-thread.c
index 122cb97c7909..2e9e13ffbd08 100644
--- a/fs/btrfs/async-thread.c
+++ b/fs/btrfs/async-thread.c
@@ -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)
-- 
2.22.0


^ permalink raw reply related	[flat|nested] 7+ messages in thread

* [PATCH 3/3] btrfs: tree-log: use symbolic name for first replay stage
  2019-08-01 12:50 [PATCH 0/3] Define/enum conversions David Sterba
  2019-08-01 12:50 ` [PATCH 1/3] btrfs: tree-log: convert defines to enums David Sterba
  2019-08-01 12:50 ` [PATCH 2/3] btrsf: async-thread: " David Sterba
@ 2019-08-01 12:50 ` David Sterba
  2019-08-02  3:50   ` Anand Jain
  2019-08-01 13:33 ` [PATCH 0/3] Define/enum conversions Nikolay Borisov
  3 siblings, 1 reply; 7+ messages in thread
From: David Sterba @ 2019-08-01 12:50 UTC (permalink / raw)
  To: linux-btrfs; +Cc: David Sterba

Signed-off-by: David Sterba <dsterba@suse.com>
---
 fs/btrfs/tree-log.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/fs/btrfs/tree-log.c b/fs/btrfs/tree-log.c
index 5513e76cc336..f48c8b9b513b 100644
--- a/fs/btrfs/tree-log.c
+++ b/fs/btrfs/tree-log.c
@@ -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();
-- 
2.22.0


^ permalink raw reply related	[flat|nested] 7+ messages in thread

* Re: [PATCH 0/3] Define/enum conversions
  2019-08-01 12:50 [PATCH 0/3] Define/enum conversions David Sterba
                   ` (2 preceding siblings ...)
  2019-08-01 12:50 ` [PATCH 3/3] btrfs: tree-log: use symbolic name for first replay stage David Sterba
@ 2019-08-01 13:33 ` Nikolay Borisov
  3 siblings, 0 replies; 7+ messages in thread
From: Nikolay Borisov @ 2019-08-01 13:33 UTC (permalink / raw)
  To: David Sterba, linux-btrfs



On 1.08.19 г. 15:50 ч., David Sterba wrote:
> 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(-)
> 

Short and sweet, so :

Reviewed-by: Nikolay Borisov <nborisov@suse.com>

^ permalink raw reply	[flat|nested] 7+ messages in thread

* Re: [PATCH 3/3] btrfs: tree-log: use symbolic name for first replay stage
  2019-08-01 12:50 ` [PATCH 3/3] btrfs: tree-log: use symbolic name for first replay stage David Sterba
@ 2019-08-02  3:50   ` Anand Jain
  2019-08-02 13:59     ` David Sterba
  0 siblings, 1 reply; 7+ messages in thread
From: Anand Jain @ 2019-08-02  3:50 UTC (permalink / raw)
  To: David Sterba; +Cc: linux-btrfs


For whole series.

Reviewed-by: Anand Jain <anand.jain@oracle.com>

One nit below.

On 8/1/19 8:50 PM, David Sterba wrote:
> Signed-off-by: David Sterba <dsterba@suse.com>
> ---
>   fs/btrfs/tree-log.c | 2 +-
>   1 file changed, 1 insertion(+), 1 deletion(-)
> 
> diff --git a/fs/btrfs/tree-log.c b/fs/btrfs/tree-log.c
> index 5513e76cc336..f48c8b9b513b 100644
> --- a/fs/btrfs/tree-log.c
> +++ b/fs/btrfs/tree-log.c
> @@ -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?


>   	};
>   
>   	path = btrfs_alloc_path();
> 


^ permalink raw reply	[flat|nested] 7+ messages in thread

* Re: [PATCH 3/3] btrfs: tree-log: use symbolic name for first replay stage
  2019-08-02  3:50   ` Anand Jain
@ 2019-08-02 13:59     ` David Sterba
  0 siblings, 0 replies; 7+ messages in thread
From: David Sterba @ 2019-08-02 13:59 UTC (permalink / raw)
  To: Anand Jain; +Cc: David Sterba, linux-btrfs

On Fri, Aug 02, 2019 at 11:50:26AM +0800, Anand Jain wrote:
> 
> For whole series.
> 
> Reviewed-by: Anand Jain <anand.jain@oracle.com>
> 
> One nit below.
> 
> On 8/1/19 8:50 PM, David Sterba wrote:
> > Signed-off-by: David Sterba <dsterba@suse.com>
> > ---
> >   fs/btrfs/tree-log.c | 2 +-
> >   1 file changed, 1 insertion(+), 1 deletion(-)
> > 
> > diff --git a/fs/btrfs/tree-log.c b/fs/btrfs/tree-log.c
> > index 5513e76cc336..f48c8b9b513b 100644
> > --- a/fs/btrfs/tree-log.c
> > +++ b/fs/btrfs/tree-log.c
> > @@ -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.

^ permalink raw reply	[flat|nested] 7+ messages in thread

end of thread, other threads:[~2019-08-02 13:59 UTC | newest]

Thread overview: 7+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2019-08-01 12:50 [PATCH 0/3] Define/enum conversions David Sterba
2019-08-01 12:50 ` [PATCH 1/3] btrfs: tree-log: convert defines to enums David Sterba
2019-08-01 12:50 ` [PATCH 2/3] btrsf: async-thread: " David Sterba
2019-08-01 12:50 ` [PATCH 3/3] btrfs: tree-log: use symbolic name for first replay stage David Sterba
2019-08-02  3:50   ` Anand Jain
2019-08-02 13:59     ` David Sterba
2019-08-01 13:33 ` [PATCH 0/3] Define/enum conversions Nikolay Borisov

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).