btrfs: add helper for device path or missing
PATCH 1/1 btrfs: add helper for device path or missing
This patch creates a helper function to get either the rcu device path or missing.
--- fs/btrfs/dev-replace.c | 22 +++++++++++----------- 1 file changed, 11 insertions(+), 11 deletions(-)
fs/btrfs/dev-replace.c +11 -11
@@ -304,6 +304,11 @@ void btrfs_after_dev_replace_commit(struct btrfs_fs_info *fs_info) dev_replace->cursor_left_last_write_of_item; } +static inline char *dev_missing_or_rcu_str (struct btrfs_device *device) +{ +return device->missing ?"<missing disk>" :rcu_str_deref (device->name); +} +int btrfs_dev_replace_start (struct btrfs_fs_info *fs_info,const char *tgtdev_name,u64 srcdevid,const char *srcdev_name,int read_src)
@@ -363,8 +368,7 @@ int btrfs_dev_replace_start(struct btrfs_fs_info *fs_info,btrfs_info_in_rcu (fs_info,"dev_replace from %s (devid %llu) to %s started" , - src_device->missing ?"<missing disk>" : -rcu_str_deref (src_device->name), +dev_missing_or_rcu_str (src_device), src_device->devid,rcu_str_deref (tgt_device->name));
@@ -538,8 +542,7 @@ static int btrfs_dev_replace_finishing(struct btrfs_fs_info *fs_info, }else {btrfs_err_in_rcu (fs_info,"btrfs_scrub_dev(%s, %llu, %s) failed %d" , - src_device->missing ?"<missing disk>" : -rcu_str_deref (src_device->name), +dev_missing_or_rcu_str (src_device), src_device->devid,rcu_str_deref (tgt_device->name), scrub_ret);btrfs_dev_replace_unlock (dev_replace,1 );
@@ -557,8 +560,7 @@ static int btrfs_dev_replace_finishing(struct btrfs_fs_info *fs_info,btrfs_info_in_rcu (fs_info,"dev_replace from %s (devid %llu) to %s finished" , - src_device->missing ?"<missing disk>" : -rcu_str_deref (src_device->name), +dev_missing_or_rcu_str (src_device), src_device->devid,rcu_str_deref (tgt_device->name)); tgt_device->is_tgtdev_for_dev_replace =0 ;
@@ -814,12 +816,10 @@ static int btrfs_dev_replace_kthread(void *data) progress =btrfs_dev_replace_progress (fs_info); progress =div_u64 (progress,10 );btrfs_info_in_rcu (fs_info, -"continuing dev_replace from %s (devid %llu) to %s @%u%%" , - dev_replace->srcdev->missing ?"<missing disk>" - :rcu_str_deref (dev_replace->srcdev->name), +"continuing dev_replace from %s (devid %llu) to target %s @%u%%" , +dev_missing_or_rcu_str (dev_replace->srcdev), dev_replace->srcdev->devid, - dev_replace->tgtdev ?rcu_str_deref (dev_replace->tgtdev->name) - :"<missing target disk>" , +dev_missing_or_rcu_str (dev_replace->tgtdev), (unsigned int )progress);btrfs_dev_replace_continue_on_mount (fs_info);
Signature · 1 line
2.15.0
Quoted 13 lines · Anand Jain
This patch creates a helper function to get either the rcu device path or missing.
Signed-off-by Anand Jain <[email protected]>--- fs/btrfs/dev-replace.c | 22 +++++++++++----------- 1 file changed, 11 insertions(+), 11 deletions(-)fs/btrfs/dev-replace.c +0
-0
fs/btrfs/dev-replace.c void btrfs_after_dev_replace_commit(struct btrfs_fs_info *fs_info) · line 310
Quoted 7 lines
fs/btrfs/dev-replace.c +4
-0@@ -304,6 +304,11 @@ void btrfs_after_dev_replace_commit(struct btrfs_fs_info *fs_info) dev_replace->cursor_left_last_write_of_item; } +static inline char *dev_missing_or_rcu_str (struct btrfs_device *device) +{ +return device->missing ?"<missing disk>" :rcu_str_deref (device->name); +}
I'd change it to dev_name, as long as it stays a local helper in dev-replace. I'm now merging the dev_state patches which depend on this patch so I'll rename it myself so you don't have to refresh and resend the patches.
Quoted 17 lines · David Sterba
Quoted 16 lines · Anand Jain
This patch creates a helper function to get either the rcu device path or missing.
Signed-off-by Anand Jain <[email protected]>--- fs/btrfs/dev-replace.c | 22 +++++++++++----------- 1 file changed, 11 insertions(+), 11 deletions(-)fs/btrfs/dev-replace.c +0
-0@@ -304,6 +304,11 @@ void btrfs_after_dev_replace_commit(struct btrfs_fs_info *fs_info) dev_replace->cursor_left_last_write_of_item; }
Quoted 9 lines
fs/btrfs/dev-replace.c void btrfs_after_dev_replace_commit(struct btrfs_fs_info *fs_info) · line 310
Quoted 4 lines
fs/btrfs/dev-replace.c +4
-0+static inline char *dev_missing_or_rcu_str (struct btrfs_device *device) +{ +return device->missing ?"<missing disk>" :rcu_str_deref (device->name); +}I'd change it to
dev_name, as long as it stays a local helper in dev-replace. I'm now merging thedev_statepatches which depend on this patch so I'll rename it myself so you don't have to refresh and resend the patches.
I am not good at naming, thanks for fixing David.
- Anand
Quoted 5 lines
--
To unsubscribe from this list: send the line "unsubscribe linux-btrfs" in the body of a message to [email protected]
More majordomo info at http://vger.kernel.org/majordomo-info.html