All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH 1/3] Btrfs: add default support for subvol getflags
@ 2012-06-29  9:59 Liu Bo
  2012-06-29  9:59 ` [PATCH 2/3] Btrfs: update subvol_getflags/setflags to know new args from user Liu Bo
  2012-06-29  9:59 ` [PATCH 3/3] Btrfs: use helper function to simplify code Liu Bo
  0 siblings, 2 replies; 8+ messages in thread
From: Liu Bo @ 2012-06-29  9:59 UTC (permalink / raw)
  To: linux-btrfs

This is kernel side patch for 'btrfs subvolume get-default'.

Our 'btrfs subvolume get-default' did not work as wish, because we do not have
APIs to fetch the subvolume's default state.

This patch treats default state as a flag and returns it to user space.

Signed-off-by: Liu Bo <liubo2009@cn.fujitsu.com>
---
 fs/btrfs/ioctl.c |   37 +++++++++++++++++++++++++++++++++++++
 fs/btrfs/ioctl.h |    1 +
 2 files changed, 38 insertions(+), 0 deletions(-)

diff --git a/fs/btrfs/ioctl.c b/fs/btrfs/ioctl.c
index 2cf6b1b..60fff96 100644
--- a/fs/btrfs/ioctl.c
+++ b/fs/btrfs/ioctl.c
@@ -1487,6 +1487,39 @@ out:
 	return ret;
 }
 
+/* Return 1 for default, otherwise return 0. */
+static int btrfs_root_default(struct btrfs_root *root)
+{
+	struct btrfs_path *path;
+	struct btrfs_disk_key disk_key;
+	struct btrfs_key key;
+	struct btrfs_dir_item *di;
+	int is_default = 0;
+	u64 dir_id;
+
+	path = btrfs_alloc_path();
+	if (!path)
+		return -ENOMEM;
+
+	dir_id = btrfs_super_root_dir(root->fs_info->super_copy);
+	di = btrfs_lookup_dir_item(NULL, root->fs_info->tree_root, path,
+				   dir_id, "default", 7, 0);
+	if (IS_ERR_OR_NULL(di)) {
+		btrfs_free_path(path);
+		printk(KERN_ERR "Umm, no default dir item!\n");
+		return -ENOENT;
+	}
+	btrfs_dir_item_key(path->nodes[0], di, &disk_key);
+	btrfs_disk_key_to_cpu(&key, &disk_key);
+	if (btrfs_comp_cpu_keys(&key, &root->root_key))
+		is_default = 0;
+	else
+		is_default = 1;
+
+	btrfs_free_path(path);
+	return is_default;
+}
+
 static noinline int btrfs_ioctl_subvol_getflags(struct file *file,
 						void __user *arg)
 {
@@ -1501,6 +1534,10 @@ static noinline int btrfs_ioctl_subvol_getflags(struct file *file,
 	down_read(&root->fs_info->subvol_sem);
 	if (btrfs_root_readonly(root))
 		flags |= BTRFS_SUBVOL_RDONLY;
+
+	ret = btrfs_root_default(root);
+	if (ret > 0)
+		flags |= BTRFS_SUBVOL_DEFAULT;
 	up_read(&root->fs_info->subvol_sem);
 
 	if (copy_to_user(arg, &flags, sizeof(flags)))
diff --git a/fs/btrfs/ioctl.h b/fs/btrfs/ioctl.h
index 497c530..3186d2d 100644
--- a/fs/btrfs/ioctl.h
+++ b/fs/btrfs/ioctl.h
@@ -32,6 +32,7 @@ struct btrfs_ioctl_vol_args {
 
 #define BTRFS_SUBVOL_CREATE_ASYNC	(1ULL << 0)
 #define BTRFS_SUBVOL_RDONLY		(1ULL << 1)
+#define BTRFS_SUBVOL_DEFAULT		(1ULL << 2)
 #define BTRFS_FSID_SIZE 16
 #define BTRFS_UUID_SIZE 16
 
-- 
1.6.5.2


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

* [PATCH 2/3] Btrfs: update subvol_getflags/setflags to know new args from user
  2012-06-29  9:59 [PATCH 1/3] Btrfs: add default support for subvol getflags Liu Bo
@ 2012-06-29  9:59 ` Liu Bo
  2012-07-03 11:27   ` Alexander Block
  2012-06-29  9:59 ` [PATCH 3/3] Btrfs: use helper function to simplify code Liu Bo
  1 sibling, 1 reply; 8+ messages in thread
From: Liu Bo @ 2012-06-29  9:59 UTC (permalink / raw)
  To: linux-btrfs

I've modified 'btrfs subvolume list' to show a subvolume's attributes,
such as readonly and default, and adopted a new structure for args for
subvol_getflags/setflags.

So here is the kernel side update.

Signed-off-by: Liu Bo <liubo2009@cn.fujitsu.com>
---
 fs/btrfs/ioctl.c |  100 ++++++++++++++++++++++++++++++++++++++++-------------
 fs/btrfs/ioctl.h |    5 +++
 2 files changed, 80 insertions(+), 25 deletions(-)

diff --git a/fs/btrfs/ioctl.c b/fs/btrfs/ioctl.c
index 60fff96..f9c2180 100644
--- a/fs/btrfs/ioctl.c
+++ b/fs/btrfs/ioctl.c
@@ -1487,6 +1487,31 @@ out:
 	return ret;
 }
 
+static struct btrfs_root *__btrfs_subvol_get_root(struct btrfs_root *root,
+						  u64 root_id)
+{
+	struct btrfs_key root_key;
+	struct btrfs_root *root_ret = NULL;
+
+	if (root->objectid == root_id || !root_id) {
+		root_ret = root;
+		goto get_root;
+	}
+
+	root_key.objectid = root_id;
+	root_key.type = BTRFS_ROOT_ITEM_KEY;
+	root_key.offset = (u64)-1;
+	root_ret = btrfs_read_fs_root_no_name(root->fs_info, &root_key);
+	/* root_ret won't be NULL */
+	if (IS_ERR(root_ret))
+		return root_ret;
+get_root:
+	if (btrfs_root_refs(&root_ret->root_item) == 0)
+		return ERR_PTR(-ENOENT);
+
+	return root_ret;
+}
+
 /* Return 1 for default, otherwise return 0. */ 
 static int btrfs_root_default(struct btrfs_root *root)
 {
@@ -1525,24 +1550,38 @@ static noinline int btrfs_ioctl_subvol_getflags(struct file *file,
 {
 	struct inode *inode = fdentry(file)->d_inode;
 	struct btrfs_root *root = BTRFS_I(inode)->root;
+	struct btrfs_root *new_root = NULL;
 	int ret = 0;
-	u64 flags = 0;
+	struct btrfs_ioctl_get_set_flags_args *get_args;
 
 	if (btrfs_ino(inode) != BTRFS_FIRST_FREE_OBJECTID)
 		return -EINVAL;
 
-	down_read(&root->fs_info->subvol_sem);
-	if (btrfs_root_readonly(root))
-		flags |= BTRFS_SUBVOL_RDONLY;
+	get_args = memdup_user(arg, sizeof(*get_args));
+	if (IS_ERR(get_args))
+		return PTR_ERR(get_args);
 
-	ret = btrfs_root_default(root);
-	if (ret > 0)
-		flags |= BTRFS_SUBVOL_DEFAULT;
-	up_read(&root->fs_info->subvol_sem);
+	new_root = __btrfs_subvol_get_root(root, get_args->objectid);
+	if (IS_ERR(new_root)) {
+		ret = PTR_ERR(new_root);
+		goto out;
+	}
 
-	if (copy_to_user(arg, &flags, sizeof(flags)))
+	down_read(&new_root->fs_info->subvol_sem);
+	if (btrfs_root_readonly(new_root))
+		get_args->flags |= BTRFS_SUBVOL_RDONLY;
+	ret = btrfs_root_default(new_root);
+	if (ret > 0) {
+		get_args->flags |= BTRFS_SUBVOL_DEFAULT;
+		ret = 0;
+	}
+	up_read(&new_root->fs_info->subvol_sem);
+
+	if (copy_to_user(arg, get_args, sizeof(*get_args)))
 		ret = -EFAULT;
 
+out:
+	kfree(get_args);
 	return ret;
 }
 
@@ -1551,8 +1590,10 @@ static noinline int btrfs_ioctl_subvol_setflags(struct file *file,
 {
 	struct inode *inode = fdentry(file)->d_inode;
 	struct btrfs_root *root = BTRFS_I(inode)->root;
+	struct btrfs_root *new_root = NULL;
 	struct btrfs_trans_handle *trans;
-	u64 root_flags;
+	struct btrfs_ioctl_get_set_flags_args *set_args = NULL;
+	u64 root_flags, new_root_flags;
 	u64 flags;
 	int ret = 0;
 
@@ -1565,11 +1606,19 @@ static noinline int btrfs_ioctl_subvol_setflags(struct file *file,
 		goto out_drop_write;
 	}
 
-	if (copy_from_user(&flags, arg, sizeof(flags))) {
-		ret = -EFAULT;
+	set_args = memdup_user(arg, sizeof(*set_args));
+	if (IS_ERR(set_args)) {
+		ret = PTR_ERR(set_args);
+		goto out_drop_write;
+	}
+
+	new_root = __btrfs_subvol_get_root(root, set_args->objectid);
+	if (IS_ERR(new_root)) {
+		ret = PTR_ERR(new_root);
 		goto out_drop_write;
 	}
 
+	flags = set_args->flags;
 	if (flags & BTRFS_SUBVOL_CREATE_ASYNC) {
 		ret = -EINVAL;
 		goto out_drop_write;
@@ -1585,38 +1634,39 @@ static noinline int btrfs_ioctl_subvol_setflags(struct file *file,
 		goto out_drop_write;
 	}
 
-	down_write(&root->fs_info->subvol_sem);
+	down_write(&new_root->fs_info->subvol_sem);
 
 	/* nothing to do */
-	if (!!(flags & BTRFS_SUBVOL_RDONLY) == btrfs_root_readonly(root))
+	if (!!(flags & BTRFS_SUBVOL_RDONLY) == btrfs_root_readonly(new_root))
 		goto out_drop_sem;
 
-	root_flags = btrfs_root_flags(&root->root_item);
+	new_root_flags = root_flags = btrfs_root_flags(&new_root->root_item);
 	if (flags & BTRFS_SUBVOL_RDONLY)
-		btrfs_set_root_flags(&root->root_item,
-				     root_flags | BTRFS_ROOT_SUBVOL_RDONLY);
+		new_root_flags |= BTRFS_ROOT_SUBVOL_RDONLY;
 	else
-		btrfs_set_root_flags(&root->root_item,
-				     root_flags & ~BTRFS_ROOT_SUBVOL_RDONLY);
+		new_root_flags &= ~BTRFS_ROOT_SUBVOL_RDONLY;
 
-	trans = btrfs_start_transaction(root, 1);
+	btrfs_set_root_flags(&new_root->root_item, new_root_flags);
+
+	trans = btrfs_start_transaction(new_root, 1);
 	if (IS_ERR(trans)) {
 		ret = PTR_ERR(trans);
 		goto out_reset;
 	}
 
-	ret = btrfs_update_root(trans, root->fs_info->tree_root,
-				&root->root_key, &root->root_item);
+	ret = btrfs_update_root(trans, new_root->fs_info->tree_root,
+				&new_root->root_key, &new_root->root_item);
 
-	btrfs_commit_transaction(trans, root);
+	btrfs_commit_transaction(trans, new_root);
 out_reset:
 	if (ret)
-		btrfs_set_root_flags(&root->root_item, root_flags);
+		btrfs_set_root_flags(&new_root->root_item, root_flags);
 out_drop_sem:
-	up_write(&root->fs_info->subvol_sem);
+	up_write(&new_root->fs_info->subvol_sem);
 out_drop_write:
 	mnt_drop_write_file(file);
 out:
+	kfree(set_args);
 	return ret;
 }
 
diff --git a/fs/btrfs/ioctl.h b/fs/btrfs/ioctl.h
index 3186d2d..1fa0ce2 100644
--- a/fs/btrfs/ioctl.h
+++ b/fs/btrfs/ioctl.h
@@ -45,6 +45,11 @@ struct btrfs_ioctl_vol_args_v2 {
 	char name[BTRFS_SUBVOL_NAME_MAX + 1];
 };
 
+struct btrfs_ioctl_get_set_flags_args {
+	__u64 objectid;
+	__u64 flags;
+};
+
 /*
  * structure to report errors and progress to userspace, either as a
  * result of a finished scrub, a canceled scrub or a progress inquiry
-- 
1.6.5.2


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

* [PATCH 3/3] Btrfs: use helper function to simplify code
  2012-06-29  9:59 [PATCH 1/3] Btrfs: add default support for subvol getflags Liu Bo
  2012-06-29  9:59 ` [PATCH 2/3] Btrfs: update subvol_getflags/setflags to know new args from user Liu Bo
@ 2012-06-29  9:59 ` Liu Bo
  1 sibling, 0 replies; 8+ messages in thread
From: Liu Bo @ 2012-06-29  9:59 UTC (permalink / raw)
  To: linux-btrfs

We've made a helper function for reading root, so just apply it.

Signed-off-by: Liu Bo <liubo2009@cn.fujitsu.com>
---
 fs/btrfs/ioctl.c |   13 +------------
 1 files changed, 1 insertions(+), 12 deletions(-)

diff --git a/fs/btrfs/ioctl.c b/fs/btrfs/ioctl.c
index f9c2180..9b93fda 100644
--- a/fs/btrfs/ioctl.c
+++ b/fs/btrfs/ioctl.c
@@ -2844,7 +2844,6 @@ static long btrfs_ioctl_default_subvol(struct file *file, void __user *argp)
 	struct btrfs_dir_item *di;
 	struct btrfs_trans_handle *trans;
 	struct btrfs_path *path;
-	struct btrfs_key location;
 	struct btrfs_disk_key disk_key;
 	struct btrfs_super_block *disk_super;
 	u64 features;
@@ -2857,20 +2856,10 @@ static long btrfs_ioctl_default_subvol(struct file *file, void __user *argp)
 	if (copy_from_user(&objectid, argp, sizeof(objectid)))
 		return -EFAULT;
 
-	if (!objectid)
-		objectid = root->root_key.objectid;
-
-	location.objectid = objectid;
-	location.type = BTRFS_ROOT_ITEM_KEY;
-	location.offset = (u64)-1;
-
-	new_root = btrfs_read_fs_root_no_name(root->fs_info, &location);
+	new_root = __btrfs_subvol_get_root(root, objectid);
 	if (IS_ERR(new_root))
 		return PTR_ERR(new_root);
 
-	if (btrfs_root_refs(&new_root->root_item) == 0)
-		return -ENOENT;
-
 	path = btrfs_alloc_path();
 	if (!path)
 		return -ENOMEM;
-- 
1.6.5.2


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

* Re: [PATCH 2/3] Btrfs: update subvol_getflags/setflags to know new args from user
  2012-06-29  9:59 ` [PATCH 2/3] Btrfs: update subvol_getflags/setflags to know new args from user Liu Bo
@ 2012-07-03 11:27   ` Alexander Block
  2012-07-03 12:04     ` Liu Bo
  0 siblings, 1 reply; 8+ messages in thread
From: Alexander Block @ 2012-07-03 11:27 UTC (permalink / raw)
  To: Liu Bo; +Cc: linux-btrfs

On Fri, Jun 29, 2012 at 11:59 AM, Liu Bo <liubo2009@cn.fujitsu.com> wrote:
> I've modified 'btrfs subvolume list' to show a subvolume's attributes,
> such as readonly and default, and adopted a new structure for args for
> subvol_getflags/setflags.
>
> So here is the kernel side update.
>
> Signed-off-by: Liu Bo <liubo2009@cn.fujitsu.com>
> ---
>  fs/btrfs/ioctl.c |  100 ++++++++++++++++++++++++++++++++++++++++-------------
>  fs/btrfs/ioctl.h |    5 +++
>  2 files changed, 80 insertions(+), 25 deletions(-)
>
> diff --git a/fs/btrfs/ioctl.c b/fs/btrfs/ioctl.c
> index 60fff96..f9c2180 100644
> --- a/fs/btrfs/ioctl.c
> +++ b/fs/btrfs/ioctl.c
> @@ -1487,6 +1487,31 @@ out:
>         return ret;
>  }
>
> +static struct btrfs_root *__btrfs_subvol_get_root(struct btrfs_root *root,
> +                                                 u64 root_id)
> +{
> +       struct btrfs_key root_key;
> +       struct btrfs_root *root_ret = NULL;
> +
> +       if (root->objectid == root_id || !root_id) {
> +               root_ret = root;
> +               goto get_root;
> +       }
> +
> +       root_key.objectid = root_id;
> +       root_key.type = BTRFS_ROOT_ITEM_KEY;
> +       root_key.offset = (u64)-1;
> +       root_ret = btrfs_read_fs_root_no_name(root->fs_info, &root_key);
> +       /* root_ret won't be NULL */
> +       if (IS_ERR(root_ret))
> +               return root_ret;
> +get_root:
> +       if (btrfs_root_refs(&root_ret->root_item) == 0)
> +               return ERR_PTR(-ENOENT);
> +
> +       return root_ret;
> +}
> +
>  /* Return 1 for default, otherwise return 0. */
>  static int btrfs_root_default(struct btrfs_root *root)
>  {
> @@ -1525,24 +1550,38 @@ static noinline int btrfs_ioctl_subvol_getflags(struct file *file,
>  {
>         struct inode *inode = fdentry(file)->d_inode;
>         struct btrfs_root *root = BTRFS_I(inode)->root;
> +       struct btrfs_root *new_root = NULL;
>         int ret = 0;
> -       u64 flags = 0;
> +       struct btrfs_ioctl_get_set_flags_args *get_args;
>
>         if (btrfs_ino(inode) != BTRFS_FIRST_FREE_OBJECTID)
>                 return -EINVAL;
>
> -       down_read(&root->fs_info->subvol_sem);
> -       if (btrfs_root_readonly(root))
> -               flags |= BTRFS_SUBVOL_RDONLY;
> +       get_args = memdup_user(arg, sizeof(*get_args));
> +       if (IS_ERR(get_args))
> +               return PTR_ERR(get_args);
>
> -       ret = btrfs_root_default(root);
> -       if (ret > 0)
> -               flags |= BTRFS_SUBVOL_DEFAULT;
> -       up_read(&root->fs_info->subvol_sem);
> +       new_root = __btrfs_subvol_get_root(root, get_args->objectid);
> +       if (IS_ERR(new_root)) {
> +               ret = PTR_ERR(new_root);
> +               goto out;
> +       }
>
> -       if (copy_to_user(arg, &flags, sizeof(flags)))
> +       down_read(&new_root->fs_info->subvol_sem);
> +       if (btrfs_root_readonly(new_root))
> +               get_args->flags |= BTRFS_SUBVOL_RDONLY;
> +       ret = btrfs_root_default(new_root);
> +       if (ret > 0) {
> +               get_args->flags |= BTRFS_SUBVOL_DEFAULT;
> +               ret = 0;
> +       }
> +       up_read(&new_root->fs_info->subvol_sem);
> +
> +       if (copy_to_user(arg, get_args, sizeof(*get_args)))
>                 ret = -EFAULT;
>
> +out:
> +       kfree(get_args);
>         return ret;
>  }
>
> @@ -1551,8 +1590,10 @@ static noinline int btrfs_ioctl_subvol_setflags(struct file *file,
>  {
>         struct inode *inode = fdentry(file)->d_inode;
>         struct btrfs_root *root = BTRFS_I(inode)->root;
> +       struct btrfs_root *new_root = NULL;
>         struct btrfs_trans_handle *trans;
> -       u64 root_flags;
> +       struct btrfs_ioctl_get_set_flags_args *set_args = NULL;
> +       u64 root_flags, new_root_flags;
>         u64 flags;
>         int ret = 0;
>
> @@ -1565,11 +1606,19 @@ static noinline int btrfs_ioctl_subvol_setflags(struct file *file,
>                 goto out_drop_write;
>         }
>
> -       if (copy_from_user(&flags, arg, sizeof(flags))) {
> -               ret = -EFAULT;
> +       set_args = memdup_user(arg, sizeof(*set_args));
> +       if (IS_ERR(set_args)) {
> +               ret = PTR_ERR(set_args);
> +               goto out_drop_write;
> +       }
> +
> +       new_root = __btrfs_subvol_get_root(root, set_args->objectid);
> +       if (IS_ERR(new_root)) {
> +               ret = PTR_ERR(new_root);
>                 goto out_drop_write;
>         }
>
> +       flags = set_args->flags;
>         if (flags & BTRFS_SUBVOL_CREATE_ASYNC) {
>                 ret = -EINVAL;
>                 goto out_drop_write;
> @@ -1585,38 +1634,39 @@ static noinline int btrfs_ioctl_subvol_setflags(struct file *file,
>                 goto out_drop_write;
>         }
>
> -       down_write(&root->fs_info->subvol_sem);
> +       down_write(&new_root->fs_info->subvol_sem);
>
>         /* nothing to do */
> -       if (!!(flags & BTRFS_SUBVOL_RDONLY) == btrfs_root_readonly(root))
> +       if (!!(flags & BTRFS_SUBVOL_RDONLY) == btrfs_root_readonly(new_root))
>                 goto out_drop_sem;
>
> -       root_flags = btrfs_root_flags(&root->root_item);
> +       new_root_flags = root_flags = btrfs_root_flags(&new_root->root_item);
>         if (flags & BTRFS_SUBVOL_RDONLY)
> -               btrfs_set_root_flags(&root->root_item,
> -                                    root_flags | BTRFS_ROOT_SUBVOL_RDONLY);
> +               new_root_flags |= BTRFS_ROOT_SUBVOL_RDONLY;
>         else
> -               btrfs_set_root_flags(&root->root_item,
> -                                    root_flags & ~BTRFS_ROOT_SUBVOL_RDONLY);
> +               new_root_flags &= ~BTRFS_ROOT_SUBVOL_RDONLY;
>
> -       trans = btrfs_start_transaction(root, 1);
> +       btrfs_set_root_flags(&new_root->root_item, new_root_flags);
> +
> +       trans = btrfs_start_transaction(new_root, 1);
>         if (IS_ERR(trans)) {
>                 ret = PTR_ERR(trans);
>                 goto out_reset;
>         }
>
> -       ret = btrfs_update_root(trans, root->fs_info->tree_root,
> -                               &root->root_key, &root->root_item);
> +       ret = btrfs_update_root(trans, new_root->fs_info->tree_root,
> +                               &new_root->root_key, &new_root->root_item);
>
> -       btrfs_commit_transaction(trans, root);
> +       btrfs_commit_transaction(trans, new_root);
>  out_reset:
>         if (ret)
> -               btrfs_set_root_flags(&root->root_item, root_flags);
> +               btrfs_set_root_flags(&new_root->root_item, root_flags);
>  out_drop_sem:
> -       up_write(&root->fs_info->subvol_sem);
> +       up_write(&new_root->fs_info->subvol_sem);
>  out_drop_write:
>         mnt_drop_write_file(file);
>  out:
> +       kfree(set_args);
>         return ret;
>  }
>
> diff --git a/fs/btrfs/ioctl.h b/fs/btrfs/ioctl.h
> index 3186d2d..1fa0ce2 100644
> --- a/fs/btrfs/ioctl.h
> +++ b/fs/btrfs/ioctl.h
> @@ -45,6 +45,11 @@ struct btrfs_ioctl_vol_args_v2 {
>         char name[BTRFS_SUBVOL_NAME_MAX + 1];
>  };
>
> +struct btrfs_ioctl_get_set_flags_args {
> +       __u64 objectid;
> +       __u64 flags;
> +};
> +
Shouldn't BTRFS_IOC_SUBVOL_GETFLAGS/BTRFS_IOC_SUBVOL_SETFLAGS also be
updated? Both still have __u64 as arguments. Also, my patches for the
new btrfs prop command group won't work anymore due to the change in
the ioctl. I'm in the middle of preparing btrfs send/receive to be
sent to the list...I also use the ioctls there and we should agree on
what to do with the ioctls before I send the patches out.
>  /*
>   * structure to report errors and progress to userspace, either as a
>   * result of a finished scrub, a canceled scrub or a progress inquiry
> --
> 1.6.5.2
>
> --
> 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

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

* Re: [PATCH 2/3] Btrfs: update subvol_getflags/setflags to know new args from user
  2012-07-03 11:27   ` Alexander Block
@ 2012-07-03 12:04     ` Liu Bo
  2012-07-03 12:09       ` Alexander Block
  2012-07-03 16:08       ` Josef Bacik
  0 siblings, 2 replies; 8+ messages in thread
From: Liu Bo @ 2012-07-03 12:04 UTC (permalink / raw)
  To: Alexander Block; +Cc: linux-btrfs

On 07/03/2012 07:27 PM, Alexander Block wrote:

> On Fri, Jun 29, 2012 at 11:59 AM, Liu Bo <liubo2009@cn.fujitsu.com> wrote:
>> I've modified 'btrfs subvolume list' to show a subvolume's attributes,
>> such as readonly and default, and adopted a new structure for args for
>> subvol_getflags/setflags.
>>
>> So here is the kernel side update.
>>
>> Signed-off-by: Liu Bo <liubo2009@cn.fujitsu.com>
>> ---
>>  fs/btrfs/ioctl.c |  100 ++++++++++++++++++++++++++++++++++++++++-------------
>>  fs/btrfs/ioctl.h |    5 +++
>>  2 files changed, 80 insertions(+), 25 deletions(-)
>>


[...]


>> diff --git a/fs/btrfs/ioctl.h b/fs/btrfs/ioctl.h
>> index 3186d2d..1fa0ce2 100644
>> --- a/fs/btrfs/ioctl.h
>> +++ b/fs/btrfs/ioctl.h
>> @@ -45,6 +45,11 @@ struct btrfs_ioctl_vol_args_v2 {
>>         char name[BTRFS_SUBVOL_NAME_MAX + 1];
>>  };
>>
>> +struct btrfs_ioctl_get_set_flags_args {
>> +       __u64 objectid;
>> +       __u64 flags;
>> +};
>> +
> Shouldn't BTRFS_IOC_SUBVOL_GETFLAGS/BTRFS_IOC_SUBVOL_SETFLAGS also be
> updated? Both still have __u64 as arguments. Also, my patches for the
> new btrfs prop command group won't work anymore due to the change in
> the ioctl. I'm in the middle of preparing btrfs send/receive to be
> sent to the list...I also use the ioctls there and we should agree on
> what to do with the ioctls before I send the patches out.


Just drop this patch, I've discussed with Ilya about it (and also CCed you).

If we've more properties pending to set/get, 'btrfs property' will be better.

So please go on your work, I'll try to rebase my patch on yours.

thanks,
liubo

>>  /*
>>   * structure to report errors and progress to userspace, either as a
>>   * result of a finished scrub, a canceled scrub or a progress inquiry
>> --
>> 1.6.5.2
>>
>> --
>> 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
> --
> 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
> 



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

* Re: [PATCH 2/3] Btrfs: update subvol_getflags/setflags to know new args from user
  2012-07-03 12:04     ` Liu Bo
@ 2012-07-03 12:09       ` Alexander Block
  2012-07-03 16:08       ` Josef Bacik
  1 sibling, 0 replies; 8+ messages in thread
From: Alexander Block @ 2012-07-03 12:09 UTC (permalink / raw)
  To: Liu Bo; +Cc: linux-btrfs

On Tue, Jul 3, 2012 at 2:04 PM, Liu Bo <liubo2009@cn.fujitsu.com> wrote:
>>>
>>> +struct btrfs_ioctl_get_set_flags_args {
>>> +       __u64 objectid;
>>> +       __u64 flags;
>>> +};
>>> +
>> Shouldn't BTRFS_IOC_SUBVOL_GETFLAGS/BTRFS_IOC_SUBVOL_SETFLAGS also be
>> updated? Both still have __u64 as arguments. Also, my patches for the
>> new btrfs prop command group won't work anymore due to the change in
>> the ioctl. I'm in the middle of preparing btrfs send/receive to be
>> sent to the list...I also use the ioctls there and we should agree on
>> what to do with the ioctls before I send the patches out.
>
>
> Just drop this patch, I've discussed with Ilya about it (and also CCed you).
>
> If we've more properties pending to set/get, 'btrfs property' will be better.
>
> So please go on your work, I'll try to rebase my patch on yours.
Ah sorry, I've somehow missed that. Thanks for the clarification :)
>
> thanks,
> liubo
>

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

* Re: [PATCH 2/3] Btrfs: update subvol_getflags/setflags to know new args from user
  2012-07-03 12:04     ` Liu Bo
  2012-07-03 12:09       ` Alexander Block
@ 2012-07-03 16:08       ` Josef Bacik
  2012-07-04  0:57         ` Liu Bo
  1 sibling, 1 reply; 8+ messages in thread
From: Josef Bacik @ 2012-07-03 16:08 UTC (permalink / raw)
  To: Liu Bo; +Cc: Alexander Block, linux-btrfs

On Tue, Jul 03, 2012 at 06:04:38AM -0600, Liu Bo wrote:
> On 07/03/2012 07:27 PM, Alexander Block wrote:
> 
> > On Fri, Jun 29, 2012 at 11:59 AM, Liu Bo <liubo2009@cn.fujitsu.com> wrote:
> >> I've modified 'btrfs subvolume list' to show a subvolume's attributes,
> >> such as readonly and default, and adopted a new structure for args for
> >> subvol_getflags/setflags.
> >>
> >> So here is the kernel side update.
> >>
> >> Signed-off-by: Liu Bo <liubo2009@cn.fujitsu.com>
> >> ---
> >>  fs/btrfs/ioctl.c |  100 ++++++++++++++++++++++++++++++++++++++++-------------
> >>  fs/btrfs/ioctl.h |    5 +++
> >>  2 files changed, 80 insertions(+), 25 deletions(-)
> >>
> 
> 
> [...]
> 
> 
> >> diff --git a/fs/btrfs/ioctl.h b/fs/btrfs/ioctl.h
> >> index 3186d2d..1fa0ce2 100644
> >> --- a/fs/btrfs/ioctl.h
> >> +++ b/fs/btrfs/ioctl.h
> >> @@ -45,6 +45,11 @@ struct btrfs_ioctl_vol_args_v2 {
> >>         char name[BTRFS_SUBVOL_NAME_MAX + 1];
> >>  };
> >>
> >> +struct btrfs_ioctl_get_set_flags_args {
> >> +       __u64 objectid;
> >> +       __u64 flags;
> >> +};
> >> +
> > Shouldn't BTRFS_IOC_SUBVOL_GETFLAGS/BTRFS_IOC_SUBVOL_SETFLAGS also be
> > updated? Both still have __u64 as arguments. Also, my patches for the
> > new btrfs prop command group won't work anymore due to the change in
> > the ioctl. I'm in the middle of preparing btrfs send/receive to be
> > sent to the list...I also use the ioctls there and we should agree on
> > what to do with the ioctls before I send the patches out.
> 
> 
> Just drop this patch, I've discussed with Ilya about it (and also CCed you).
> 
> If we've more properties pending to set/get, 'btrfs property' will be better.
> 
> So please go on your work, I'll try to rebase my patch on yours.
> 

I've dropped the entire series from btrfs-next because without this patch the
other one fails to build without __btrfs_subvol_get_root.  Resend if you want
the other patches included.  Thanks,

Josef

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

* Re: [PATCH 2/3] Btrfs: update subvol_getflags/setflags to know new args from user
  2012-07-03 16:08       ` Josef Bacik
@ 2012-07-04  0:57         ` Liu Bo
  0 siblings, 0 replies; 8+ messages in thread
From: Liu Bo @ 2012-07-04  0:57 UTC (permalink / raw)
  To: Josef Bacik; +Cc: Alexander Block, linux-btrfs

On 07/04/2012 12:08 AM, Josef Bacik wrote:

> On Tue, Jul 03, 2012 at 06:04:38AM -0600, Liu Bo wrote:
>> On 07/03/2012 07:27 PM, Alexander Block wrote:
>>
>>> On Fri, Jun 29, 2012 at 11:59 AM, Liu Bo <liubo2009@cn.fujitsu.com> wrote:
>>>> I've modified 'btrfs subvolume list' to show a subvolume's attributes,
>>>> such as readonly and default, and adopted a new structure for args for
>>>> subvol_getflags/setflags.
>>>>
>>>> So here is the kernel side update.
>>>>
>>>> Signed-off-by: Liu Bo <liubo2009@cn.fujitsu.com>
>>>> ---
>>>>  fs/btrfs/ioctl.c |  100 ++++++++++++++++++++++++++++++++++++++++-------------
>>>>  fs/btrfs/ioctl.h |    5 +++
>>>>  2 files changed, 80 insertions(+), 25 deletions(-)
>>>>
>>
>> [...]
>>
>>
>>>> diff --git a/fs/btrfs/ioctl.h b/fs/btrfs/ioctl.h
>>>> index 3186d2d..1fa0ce2 100644
>>>> --- a/fs/btrfs/ioctl.h
>>>> +++ b/fs/btrfs/ioctl.h
>>>> @@ -45,6 +45,11 @@ struct btrfs_ioctl_vol_args_v2 {
>>>>         char name[BTRFS_SUBVOL_NAME_MAX + 1];
>>>>  };
>>>>
>>>> +struct btrfs_ioctl_get_set_flags_args {
>>>> +       __u64 objectid;
>>>> +       __u64 flags;
>>>> +};
>>>> +
>>> Shouldn't BTRFS_IOC_SUBVOL_GETFLAGS/BTRFS_IOC_SUBVOL_SETFLAGS also be
>>> updated? Both still have __u64 as arguments. Also, my patches for the
>>> new btrfs prop command group won't work anymore due to the change in
>>> the ioctl. I'm in the middle of preparing btrfs send/receive to be
>>> sent to the list...I also use the ioctls there and we should agree on
>>> what to do with the ioctls before I send the patches out.
>>
>> Just drop this patch, I've discussed with Ilya about it (and also CCed you).
>>
>> If we've more properties pending to set/get, 'btrfs property' will be better.
>>
>> So please go on your work, I'll try to rebase my patch on yours.
>>
> 
> I've dropped the entire series from btrfs-next because without this patch the
> other one fails to build without __btrfs_subvol_get_root.  Resend if you want
> the other patches included.  Thanks,
> 


Sure, sorry for the build trouble.

thanks,
liubo

> 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
> 



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

end of thread, other threads:[~2012-07-04  1:40 UTC | newest]

Thread overview: 8+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2012-06-29  9:59 [PATCH 1/3] Btrfs: add default support for subvol getflags Liu Bo
2012-06-29  9:59 ` [PATCH 2/3] Btrfs: update subvol_getflags/setflags to know new args from user Liu Bo
2012-07-03 11:27   ` Alexander Block
2012-07-03 12:04     ` Liu Bo
2012-07-03 12:09       ` Alexander Block
2012-07-03 16:08       ` Josef Bacik
2012-07-04  0:57         ` Liu Bo
2012-06-29  9:59 ` [PATCH 3/3] Btrfs: use helper function to simplify code Liu Bo

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.