diff mbox

[11/12] btrfs: introduce helper functions to perform hot replace

Message ID 1459261349-32206-12-git-send-email-anand.jain@oracle.com (mailing list archive)
State New, archived
Headers show

Commit Message

Anand Jain March 29, 2016, 2:22 p.m. UTC
Hot replace / auto replace is important volume manager feature
and is critical to the data center operations, so that the degraded
volume can be brought back to a healthy state at the earliest and
without manual intervention.

This modifies the existing replace code to suite the need of auto
replace, in the long run I hope both the codes to be merged.

Signed-off-by: Anand Jain <anand.jain@oracle.com>
---
 fs/btrfs/dev-replace.c | 24 ++++++++++++++++++++++++
 fs/btrfs/dev-replace.h |  1 +
 2 files changed, 25 insertions(+)

Comments

kernel test robot March 29, 2016, 2:45 p.m. UTC | #1
Hi Anand,

[auto build test ERROR on btrfs/next]
[also build test ERROR on v4.6-rc1 next-20160329]
[if your patch is applied to the wrong git tree, please drop us a note to help improving the system]

url:    https://github.com/0day-ci/linux/commits/Anand-Jain/btrfs-Introduce-a-new-function-to-check-if-all-chunks-a-OK-for-degraded-mount/20160329-222724
base:   https://git.kernel.org/pub/scm/linux/kernel/git/mason/linux-btrfs.git next
config: sparc64-allmodconfig (attached as .config)
reproduce:
        wget https://git.kernel.org/cgit/linux/kernel/git/wfg/lkp-tests.git/plain/sbin/make.cross -O ~/bin/make.cross
        chmod +x ~/bin/make.cross
        # save the attached .config to linux build tree
        make.cross ARCH=sparc64 

All error/warnings (new ones prefixed by >>):

   fs/btrfs/dev-replace.c: In function 'btrfs_auto_replace_start':
>> fs/btrfs/dev-replace.c:962:8: warning: passing argument 2 of 'btrfs_dev_replace_start' from incompatible pointer type
     ret = btrfs_dev_replace_start(root, tgt_path,
           ^
   fs/btrfs/dev-replace.c:308:5: note: expected 'struct btrfs_ioctl_dev_replace_args *' but argument is of type 'char *'
    int btrfs_dev_replace_start(struct btrfs_root *root,
        ^
>> fs/btrfs/dev-replace.c:962:8: error: too many arguments to function 'btrfs_dev_replace_start'
     ret = btrfs_dev_replace_start(root, tgt_path,
           ^
   fs/btrfs/dev-replace.c:308:5: note: declared here
    int btrfs_dev_replace_start(struct btrfs_root *root,
        ^

vim +/btrfs_dev_replace_start +962 fs/btrfs/dev-replace.c

   956		if (btrfs_get_spare_device(&tgt_path)) {
   957			btrfs_err(root->fs_info,
   958				"No spare device found/configured in the kernel");
   959			return -EINVAL;
   960		}
   961	
 > 962		ret = btrfs_dev_replace_start(root, tgt_path,
   963						src_device->devid,
   964						rcu_str_deref(src_device->name),
   965			BTRFS_IOCTL_DEV_REPLACE_CONT_READING_FROM_SRCDEV_MODE_AVOID);

---
0-DAY kernel test infrastructure                Open Source Technology Center
https://lists.01.org/pipermail/kbuild-all                   Intel Corporation
Anand Jain March 30, 2016, 10:13 a.m. UTC | #2
Hi,

  You are missing the patch set which includes
    https://patchwork.kernel.org/patch/8659651/

  btrfs: refactor btrfs_dev_replace_start for reuse


Thanks, Anand


On 03/29/2016 10:45 PM, kbuild test robot wrote:
> Hi Anand,
>
> [auto build test ERROR on btrfs/next]
> [also build test ERROR on v4.6-rc1 next-20160329]
> [if your patch is applied to the wrong git tree, please drop us a note to help improving the system]
>
> url:    https://github.com/0day-ci/linux/commits/Anand-Jain/btrfs-Introduce-a-new-function-to-check-if-all-chunks-a-OK-for-degraded-mount/20160329-222724
> base:   https://git.kernel.org/pub/scm/linux/kernel/git/mason/linux-btrfs.git next
> config: sparc64-allmodconfig (attached as .config)
> reproduce:
>          wget https://git.kernel.org/cgit/linux/kernel/git/wfg/lkp-tests.git/plain/sbin/make.cross -O ~/bin/make.cross
>          chmod +x ~/bin/make.cross
>          # save the attached .config to linux build tree
>          make.cross ARCH=sparc64
>
> All error/warnings (new ones prefixed by >>):
>
>     fs/btrfs/dev-replace.c: In function 'btrfs_auto_replace_start':
>>> fs/btrfs/dev-replace.c:962:8: warning: passing argument 2 of 'btrfs_dev_replace_start' from incompatible pointer type
>       ret = btrfs_dev_replace_start(root, tgt_path,
>             ^
>     fs/btrfs/dev-replace.c:308:5: note: expected 'struct btrfs_ioctl_dev_replace_args *' but argument is of type 'char *'
>      int btrfs_dev_replace_start(struct btrfs_root *root,
>          ^
>>> fs/btrfs/dev-replace.c:962:8: error: too many arguments to function 'btrfs_dev_replace_start'
>       ret = btrfs_dev_replace_start(root, tgt_path,
>             ^
>     fs/btrfs/dev-replace.c:308:5: note: declared here
>      int btrfs_dev_replace_start(struct btrfs_root *root,
>          ^
>
> vim +/btrfs_dev_replace_start +962 fs/btrfs/dev-replace.c
>
>     956		if (btrfs_get_spare_device(&tgt_path)) {
>     957			btrfs_err(root->fs_info,
>     958				"No spare device found/configured in the kernel");
>     959			return -EINVAL;
>     960		}
>     961	
>   > 962		ret = btrfs_dev_replace_start(root, tgt_path,
>     963						src_device->devid,
>     964						rcu_str_deref(src_device->name),
>     965			BTRFS_IOCTL_DEV_REPLACE_CONT_READING_FROM_SRCDEV_MODE_AVOID);
>
> ---
> 0-DAY kernel test infrastructure                Open Source Technology Center
> https://lists.01.org/pipermail/kbuild-all                   Intel Corporation
>
--
To unsubscribe from this list: send the line "unsubscribe linux-btrfs" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
kernel test robot March 31, 2016, 2:14 a.m. UTC | #3
On Wed, Mar 30, 2016 at 06:13:43PM +0800, Anand Jain wrote:
> 
> 
> Hi,
> 
>  You are missing the patch set which includes
>    https://patchwork.kernel.org/patch/8659651/
> 
>  btrfs: refactor btrfs_dev_replace_start for reuse

Sorry that comes in another patchset and the robot currently is not
smart enough to understand the relationship between 2 patchsets.

Thanks,
Fengguang

> On 03/29/2016 10:45 PM, kbuild test robot wrote:
> >Hi Anand,
> >
> >[auto build test ERROR on btrfs/next]
> >[also build test ERROR on v4.6-rc1 next-20160329]
> >[if your patch is applied to the wrong git tree, please drop us a note to help improving the system]
> >
> >url:    https://github.com/0day-ci/linux/commits/Anand-Jain/btrfs-Introduce-a-new-function-to-check-if-all-chunks-a-OK-for-degraded-mount/20160329-222724
> >base:   https://git.kernel.org/pub/scm/linux/kernel/git/mason/linux-btrfs.git next
> >config: sparc64-allmodconfig (attached as .config)
> >reproduce:
> >         wget https://git.kernel.org/cgit/linux/kernel/git/wfg/lkp-tests.git/plain/sbin/make.cross -O ~/bin/make.cross
> >         chmod +x ~/bin/make.cross
> >         # save the attached .config to linux build tree
> >         make.cross ARCH=sparc64
> >
> >All error/warnings (new ones prefixed by >>):
> >
> >    fs/btrfs/dev-replace.c: In function 'btrfs_auto_replace_start':
> >>>fs/btrfs/dev-replace.c:962:8: warning: passing argument 2 of 'btrfs_dev_replace_start' from incompatible pointer type
> >      ret = btrfs_dev_replace_start(root, tgt_path,
> >            ^
> >    fs/btrfs/dev-replace.c:308:5: note: expected 'struct btrfs_ioctl_dev_replace_args *' but argument is of type 'char *'
> >     int btrfs_dev_replace_start(struct btrfs_root *root,
> >         ^
> >>>fs/btrfs/dev-replace.c:962:8: error: too many arguments to function 'btrfs_dev_replace_start'
> >      ret = btrfs_dev_replace_start(root, tgt_path,
> >            ^
> >    fs/btrfs/dev-replace.c:308:5: note: declared here
> >     int btrfs_dev_replace_start(struct btrfs_root *root,
> >         ^
> >
> >vim +/btrfs_dev_replace_start +962 fs/btrfs/dev-replace.c
> >
> >    956		if (btrfs_get_spare_device(&tgt_path)) {
> >    957			btrfs_err(root->fs_info,
> >    958				"No spare device found/configured in the kernel");
> >    959			return -EINVAL;
> >    960		}
> >    961	
> >  > 962		ret = btrfs_dev_replace_start(root, tgt_path,
> >    963						src_device->devid,
> >    964						rcu_str_deref(src_device->name),
> >    965			BTRFS_IOCTL_DEV_REPLACE_CONT_READING_FROM_SRCDEV_MODE_AVOID);
> >
> >---
> >0-DAY kernel test infrastructure                Open Source Technology Center
> >https://lists.01.org/pipermail/kbuild-all                   Intel Corporation
> >
> _______________________________________________
> kbuild-all mailing list
> kbuild-all@lists.01.org
> https://lists.01.org/mailman/listinfo/kbuild-all
--
To unsubscribe from this list: send the line "unsubscribe linux-btrfs" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
diff mbox

Patch

diff --git a/fs/btrfs/dev-replace.c b/fs/btrfs/dev-replace.c
index 2b926867d136..d6b768cf121f 100644
--- a/fs/btrfs/dev-replace.c
+++ b/fs/btrfs/dev-replace.c
@@ -957,3 +957,27 @@  void btrfs_bio_counter_inc_blocked(struct btrfs_fs_info *fs_info)
 				     &fs_info->fs_state));
 	}
 }
+
+int btrfs_auto_replace_start(struct btrfs_root *root,
+				struct btrfs_device *src_device)
+{
+	int ret;
+	char *tgt_path;
+
+	if (btrfs_get_spare_device(&tgt_path)) {
+		btrfs_err(root->fs_info,
+			"No spare device found/configured in the kernel");
+		return -EINVAL;
+	}
+
+	ret = btrfs_dev_replace_start(root, tgt_path,
+					src_device->devid,
+					rcu_str_deref(src_device->name),
+		BTRFS_IOCTL_DEV_REPLACE_CONT_READING_FROM_SRCDEV_MODE_AVOID);
+	if (ret)
+		btrfs_put_spare_device(tgt_path);
+
+	kfree(tgt_path);
+
+	return 0;
+}
diff --git a/fs/btrfs/dev-replace.h b/fs/btrfs/dev-replace.h
index e922b42d91df..b918b9d6e5df 100644
--- a/fs/btrfs/dev-replace.h
+++ b/fs/btrfs/dev-replace.h
@@ -46,4 +46,5 @@  static inline void btrfs_dev_replace_stats_inc(atomic64_t *stat_value)
 {
 	atomic64_inc(stat_value);
 }
+int btrfs_auto_replace_start(struct btrfs_root *root, struct btrfs_device *src_device);
 #endif