diff mbox

btrfs: return btrfs error code for dev excl ops err

Message ID 1376979054-2883-2-git-send-email-anand.jain@oracle.com (mailing list archive)
State Superseded, archived
Headers show

Commit Message

Anand Jain Aug. 20, 2013, 6:10 a.m. UTC
now threads can return BTRFS_ERROR_DEV_EXCL_RUN_IN_PROGRESS
as defined in btrfs.h for the dev excl operation error in
the FS, which means with this kernel would stop logging
(almost an user error) into the /var/log/messages

Signed-off-by: Anand Jain <anand.jain@oracle.com>
---
 fs/btrfs/ioctl.c           |   12 ++++--------
 include/uapi/linux/btrfs.h |    3 +--
 2 files changed, 5 insertions(+), 10 deletions(-)

Comments

Josef Bacik Aug. 20, 2013, 6:34 p.m. UTC | #1
On Tue, Aug 20, 2013 at 02:10:54PM +0800, Anand Jain wrote:
> now threads can return BTRFS_ERROR_DEV_EXCL_RUN_IN_PROGRESS
> as defined in btrfs.h for the dev excl operation error in
> the FS, which means with this kernel would stop logging
> (almost an user error) into the /var/log/messages
> 
> Signed-off-by: Anand Jain <anand.jain@oracle.com>
> ---
>  fs/btrfs/ioctl.c           |   12 ++++--------
>  include/uapi/linux/btrfs.h |    3 +--
>  2 files changed, 5 insertions(+), 10 deletions(-)
> 
> diff --git a/fs/btrfs/ioctl.c b/fs/btrfs/ioctl.c
> index 107c5f4..89f346c 100644
> --- a/fs/btrfs/ioctl.c
> +++ b/fs/btrfs/ioctl.c
> @@ -1382,9 +1382,8 @@ static noinline int btrfs_ioctl_resize(struct file *file,
>  
>  	if (atomic_xchg(&root->fs_info->mutually_exclusive_operation_running,
>  			1)) {
> -		pr_info("btrfs: dev add/delete/balance/replace/resize operation in progress\n");
>  		mnt_drop_write_file(file);
> -		return -EINVAL;
> +		return BTRFS_ERROR_DEV_EXCL_RUN_IN_PROGRESS;
>  	}
>  
>  	mutex_lock(&root->fs_info->volume_mutex);
> @@ -2346,8 +2345,7 @@ static long btrfs_ioctl_add_dev(struct btrfs_root *root, void __user *arg)
>  
>  	if (atomic_xchg(&root->fs_info->mutually_exclusive_operation_running,
>  			1)) {
> -		pr_info("btrfs: dev add/delete/balance/replace/resize operation in progress\n");
> -		return -EINVAL;
> +		return BTRFS_ERROR_DEV_EXCL_RUN_IN_PROGRESS;
>  	}
>  
>  	mutex_lock(&root->fs_info->volume_mutex);
> @@ -3638,8 +3636,7 @@ static long btrfs_ioctl_dev_replace(struct btrfs_root *root, void __user *arg)
>  		if (atomic_xchg(
>  			&root->fs_info->mutually_exclusive_operation_running,
>  			1)) {
> -			pr_info("btrfs: dev add/delete/balance/replace/resize operation in progress\n");
> -			ret = -EINPROGRESS;
> +			ret = BTRFS_ERROR_DEV_EXCL_RUN_IN_PROGRESS;
>  		} else {
>  			ret = btrfs_dev_replace_start(root, p);
>  			atomic_set(
> @@ -3883,8 +3880,7 @@ again:
>  	} else {
>  		/* this is (1) */
>  		mutex_unlock(&fs_info->balance_mutex);
> -		pr_info("btrfs: dev add/delete/balance/replace/resize operation in progress\n");
> -		ret = -EINVAL;
> +		ret = BTRFS_ERROR_DEV_EXCL_RUN_IN_PROGRESS;
>  		goto out;
>  	}
>  
> diff --git a/include/uapi/linux/btrfs.h b/include/uapi/linux/btrfs.h
> index 90d7bd9..182305f 100644
> --- a/include/uapi/linux/btrfs.h
> +++ b/include/uapi/linux/btrfs.h
> @@ -505,8 +505,7 @@ static inline char *btrfs_err_str(enum btrfs_err_code err_code)
>  		case BTRFS_ERROR_DEV_ONLY_WRITABLE:
>  			return "unable to remove the only writeable device";
>  		case BTRFS_ERROR_DEV_EXCL_RUN_IN_PROGRESS:
> -			return "add/delete/balance/replace/resize operation "\
> -				"in progress";
> +			return "add/delete/balance/replace/resize operation in progress";
>  		default:
>  			return NULL;

This is an unnecessary change.  Thanks,

Josef
--
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
Anand Jain Aug. 21, 2013, 3:47 a.m. UTC | #2
>> -			return "add/delete/balance/replace/resize operation "\
>> -				"in progress";
>> +			return "add/delete/balance/replace/resize operation in progress";
>>   		default:
>>   			return NULL;
>
> This is an unnecessary change.  Thanks,

  Hmm. ok. v2 sent out.


--
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
David Sterba Sept. 2, 2013, 4:59 p.m. UTC | #3
On Tue, Aug 20, 2013 at 02:34:05PM -0400, Josef Bacik wrote:
> > --- a/include/uapi/linux/btrfs.h
> > +++ b/include/uapi/linux/btrfs.h
> > @@ -505,8 +505,7 @@ static inline char *btrfs_err_str(enum btrfs_err_code err_code)
> >  		case BTRFS_ERROR_DEV_ONLY_WRITABLE:
> >  			return "unable to remove the only writeable device";
> >  		case BTRFS_ERROR_DEV_EXCL_RUN_IN_PROGRESS:
> > -			return "add/delete/balance/replace/resize operation "\
> > -				"in progress";
> > +			return "add/delete/balance/replace/resize operation in progress";
> >  		default:
> >  			return NULL;
> 
> This is an unnecessary change.  Thanks,

Though having the whole message on one line makes errors greppable.

david
--
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/ioctl.c b/fs/btrfs/ioctl.c
index 107c5f4..89f346c 100644
--- a/fs/btrfs/ioctl.c
+++ b/fs/btrfs/ioctl.c
@@ -1382,9 +1382,8 @@  static noinline int btrfs_ioctl_resize(struct file *file,
 
 	if (atomic_xchg(&root->fs_info->mutually_exclusive_operation_running,
 			1)) {
-		pr_info("btrfs: dev add/delete/balance/replace/resize operation in progress\n");
 		mnt_drop_write_file(file);
-		return -EINVAL;
+		return BTRFS_ERROR_DEV_EXCL_RUN_IN_PROGRESS;
 	}
 
 	mutex_lock(&root->fs_info->volume_mutex);
@@ -2346,8 +2345,7 @@  static long btrfs_ioctl_add_dev(struct btrfs_root *root, void __user *arg)
 
 	if (atomic_xchg(&root->fs_info->mutually_exclusive_operation_running,
 			1)) {
-		pr_info("btrfs: dev add/delete/balance/replace/resize operation in progress\n");
-		return -EINVAL;
+		return BTRFS_ERROR_DEV_EXCL_RUN_IN_PROGRESS;
 	}
 
 	mutex_lock(&root->fs_info->volume_mutex);
@@ -3638,8 +3636,7 @@  static long btrfs_ioctl_dev_replace(struct btrfs_root *root, void __user *arg)
 		if (atomic_xchg(
 			&root->fs_info->mutually_exclusive_operation_running,
 			1)) {
-			pr_info("btrfs: dev add/delete/balance/replace/resize operation in progress\n");
-			ret = -EINPROGRESS;
+			ret = BTRFS_ERROR_DEV_EXCL_RUN_IN_PROGRESS;
 		} else {
 			ret = btrfs_dev_replace_start(root, p);
 			atomic_set(
@@ -3883,8 +3880,7 @@  again:
 	} else {
 		/* this is (1) */
 		mutex_unlock(&fs_info->balance_mutex);
-		pr_info("btrfs: dev add/delete/balance/replace/resize operation in progress\n");
-		ret = -EINVAL;
+		ret = BTRFS_ERROR_DEV_EXCL_RUN_IN_PROGRESS;
 		goto out;
 	}
 
diff --git a/include/uapi/linux/btrfs.h b/include/uapi/linux/btrfs.h
index 90d7bd9..182305f 100644
--- a/include/uapi/linux/btrfs.h
+++ b/include/uapi/linux/btrfs.h
@@ -505,8 +505,7 @@  static inline char *btrfs_err_str(enum btrfs_err_code err_code)
 		case BTRFS_ERROR_DEV_ONLY_WRITABLE:
 			return "unable to remove the only writeable device";
 		case BTRFS_ERROR_DEV_EXCL_RUN_IN_PROGRESS:
-			return "add/delete/balance/replace/resize operation "\
-				"in progress";
+			return "add/delete/balance/replace/resize operation in progress";
 		default:
 			return NULL;
 	}