linux-btrfs.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH 0/3] Removal of BTRFS_SUBVOL_CREATE_ASYNC support
@ 2020-03-13 15:23 Nikolay Borisov
  2020-03-13 15:23 ` [PATCH 1/3] btrfs: Remove " Nikolay Borisov
                   ` (3 more replies)
  0 siblings, 4 replies; 7+ messages in thread
From: Nikolay Borisov @ 2020-03-13 15:23 UTC (permalink / raw)
  To: linux-btrfs; +Cc: Nikolay Borisov

Having deprecated this feature in 5.4 now it's time to actually delete it.

First patch removes the user-visible support. The other 2 remove unneeded
arguments and code.

Nikolay Borisov (3):
  btrfs: Remove BTRFS_SUBVOL_CREATE_ASYNC support
  btrfs: Remove transid argument from btrfs_ioctl_snap_create_transid
  btrfs: Remove async_transid
    btrfs_mksubvol/create_subvol/create_snapshot

 fs/btrfs/ioctl.c           | 73 +++++++++-----------------------------
 include/uapi/linux/btrfs.h |  7 ++--
 2 files changed, 18 insertions(+), 62 deletions(-)

--
2.17.1


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

* [PATCH 1/3] btrfs: Remove BTRFS_SUBVOL_CREATE_ASYNC support
  2020-03-13 15:23 [PATCH 0/3] Removal of BTRFS_SUBVOL_CREATE_ASYNC support Nikolay Borisov
@ 2020-03-13 15:23 ` Nikolay Borisov
  2020-03-13 21:28   ` David Sterba
  2020-03-13 15:23 ` [PATCH 2/3] btrfs: Remove transid argument from btrfs_ioctl_snap_create_transid Nikolay Borisov
                   ` (2 subsequent siblings)
  3 siblings, 1 reply; 7+ messages in thread
From: Nikolay Borisov @ 2020-03-13 15:23 UTC (permalink / raw)
  To: linux-btrfs; +Cc: Nikolay Borisov

This functionality was deprecated in kernel 5.4. Since no one has
complained of the impending removal it's time we did so.

Signed-off-by: Nikolay Borisov <nborisov@suse.com>
---
 fs/btrfs/ioctl.c           | 25 +------------------------
 include/uapi/linux/btrfs.h |  7 ++-----
 2 files changed, 3 insertions(+), 29 deletions(-)

diff --git a/fs/btrfs/ioctl.c b/fs/btrfs/ioctl.c
index bdc3a6bab904..af1be567fec7 100644
--- a/fs/btrfs/ioctl.c
+++ b/fs/btrfs/ioctl.c
@@ -1818,8 +1818,6 @@ static noinline int btrfs_ioctl_snap_create_v2(struct file *file,
 {
 	struct btrfs_ioctl_vol_args_v2 *vol_args;
 	int ret;
-	u64 transid = 0;
-	u64 *ptr = NULL;
 	bool readonly = false;
 	struct btrfs_qgroup_inherit *inherit = NULL;
 
@@ -1836,15 +1834,6 @@ static noinline int btrfs_ioctl_snap_create_v2(struct file *file,
 		goto free_args;
 	}
 
-	if (vol_args->flags & BTRFS_SUBVOL_CREATE_ASYNC) {
-		struct inode *inode = file_inode(file);
-		struct btrfs_fs_info *fs_info = btrfs_sb(inode->i_sb);
-
-		btrfs_warn(fs_info,
-"SNAP_CREATE_V2 ioctl with CREATE_ASYNC is deprecated and will be removed in kernel 5.7");
-
-		ptr = &transid;
-	}
 	if (vol_args->flags & BTRFS_SUBVOL_RDONLY)
 		readonly = true;
 	if (vol_args->flags & BTRFS_SUBVOL_QGROUP_INHERIT) {
@@ -1860,17 +1849,10 @@ static noinline int btrfs_ioctl_snap_create_v2(struct file *file,
 	}
 
 	ret = btrfs_ioctl_snap_create_transid(file, vol_args->name,
-					      vol_args->fd, subvol, ptr,
+					      vol_args->fd, subvol, NULL,
 					      readonly, inherit);
 	if (ret)
 		goto free_inherit;
-
-	if (ptr && copy_to_user(arg +
-				offsetof(struct btrfs_ioctl_vol_args_v2,
-					transid),
-				ptr, sizeof(*ptr)))
-		ret = -EFAULT;
-
 free_inherit:
 	kfree(inherit);
 free_args:
@@ -1930,11 +1912,6 @@ static noinline int btrfs_ioctl_subvol_setflags(struct file *file,
 		goto out_drop_write;
 	}
 
-	if (flags & BTRFS_SUBVOL_CREATE_ASYNC) {
-		ret = -EINVAL;
-		goto out_drop_write;
-	}
-
 	if (flags & ~BTRFS_SUBVOL_RDONLY) {
 		ret = -EOPNOTSUPP;
 		goto out_drop_write;
diff --git a/include/uapi/linux/btrfs.h b/include/uapi/linux/btrfs.h
index b5f3ea36d3cb..ed9c9612a5b4 100644
--- a/include/uapi/linux/btrfs.h
+++ b/include/uapi/linux/btrfs.h
@@ -36,7 +36,6 @@ struct btrfs_ioctl_vol_args {
 #define BTRFS_DEVICE_PATH_NAME_MAX	1024
 #define BTRFS_SUBVOL_NAME_MAX 		4039
 
-#define BTRFS_SUBVOL_CREATE_ASYNC	(1ULL << 0)
 #define BTRFS_SUBVOL_RDONLY		(1ULL << 1)
 #define BTRFS_SUBVOL_QGROUP_INHERIT	(1ULL << 2)
 
@@ -45,8 +44,7 @@ struct btrfs_ioctl_vol_args {
 #define BTRFS_SUBVOL_SPEC_BY_ID	(1ULL << 4)
 
 #define BTRFS_VOL_ARG_V2_FLAGS_SUPPORTED		\
-			(BTRFS_SUBVOL_CREATE_ASYNC |	\
-			BTRFS_SUBVOL_RDONLY |		\
+			(BTRFS_SUBVOL_RDONLY |		\
 			BTRFS_SUBVOL_QGROUP_INHERIT |	\
 			BTRFS_DEVICE_SPEC_BY_ID |	\
 			BTRFS_SUBVOL_SPEC_BY_ID)
@@ -116,8 +114,7 @@ struct btrfs_ioctl_qgroup_limit_args {
 
 /* Supported flags for BTRFS_IOC_SNAP_CREATE_V2 and BTRFS_IOC_SUBVOL_CREATE_V2 */
 #define BTRFS_SUBVOL_CREATE_ARGS_MASK					\
-	(BTRFS_SUBVOL_CREATE_ASYNC |					\
-	 BTRFS_SUBVOL_RDONLY |						\
+	 (BTRFS_SUBVOL_RDONLY |						\
 	 BTRFS_SUBVOL_QGROUP_INHERIT)
 
 /* Supported flags for BTRFS_IOC_SNAP_DESTROY_V2 */
-- 
2.17.1


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

* [PATCH 2/3] btrfs: Remove transid argument from btrfs_ioctl_snap_create_transid
  2020-03-13 15:23 [PATCH 0/3] Removal of BTRFS_SUBVOL_CREATE_ASYNC support Nikolay Borisov
  2020-03-13 15:23 ` [PATCH 1/3] btrfs: Remove " Nikolay Borisov
@ 2020-03-13 15:23 ` Nikolay Borisov
  2020-03-13 21:32   ` David Sterba
  2020-03-13 15:23 ` [PATCH 3/3] btrfs: Remove async_transid btrfs_mksubvol/create_subvol/create_snapshot Nikolay Borisov
  2020-03-16 17:01 ` [PATCH 0/3] Removal of BTRFS_SUBVOL_CREATE_ASYNC support David Sterba
  3 siblings, 1 reply; 7+ messages in thread
From: Nikolay Borisov @ 2020-03-13 15:23 UTC (permalink / raw)
  To: linux-btrfs; +Cc: Nikolay Borisov

btrfs_ioctl_snap_create_transid no longer takes a transid argument, so
remove it and rename the function to __btrfs_ioctl_snap_create to
reflect it's an internal, worker function.

Signed-off-by: Nikolay Borisov <nborisov@suse.com>
---
 fs/btrfs/ioctl.c | 18 ++++++++----------
 1 file changed, 8 insertions(+), 10 deletions(-)

diff --git a/fs/btrfs/ioctl.c b/fs/btrfs/ioctl.c
index af1be567fec7..e18a56d87553 100644
--- a/fs/btrfs/ioctl.c
+++ b/fs/btrfs/ioctl.c
@@ -1729,9 +1729,9 @@ static noinline int btrfs_ioctl_resize(struct file *file,
 	return ret;
 }
 
-static noinline int btrfs_ioctl_snap_create_transid(struct file *file,
+static noinline int __btrfs_ioctl_snap_create(struct file *file,
 				const char *name, unsigned long fd, int subvol,
-				u64 *transid, bool readonly,
+				bool readonly,
 				struct btrfs_qgroup_inherit *inherit)
 {
 	int namelen;
@@ -1758,7 +1758,7 @@ static noinline int btrfs_ioctl_snap_create_transid(struct file *file,
 
 	if (subvol) {
 		ret = btrfs_mksubvol(&file->f_path, name, namelen,
-				     NULL, transid, readonly, inherit);
+				     NULL, readonly, inherit);
 	} else {
 		struct fd src = fdget(fd);
 		struct inode *src_inode;
@@ -1781,7 +1781,7 @@ static noinline int btrfs_ioctl_snap_create_transid(struct file *file,
 		} else {
 			ret = btrfs_mksubvol(&file->f_path, name, namelen,
 					     BTRFS_I(src_inode)->root,
-					     transid, readonly, inherit);
+					     readonly, inherit);
 		}
 		fdput(src);
 	}
@@ -1805,9 +1805,8 @@ static noinline int btrfs_ioctl_snap_create(struct file *file,
 		return PTR_ERR(vol_args);
 	vol_args->name[BTRFS_PATH_NAME_MAX] = '\0';
 
-	ret = btrfs_ioctl_snap_create_transid(file, vol_args->name,
-					      vol_args->fd, subvol,
-					      NULL, false, NULL);
+	ret = __btrfs_ioctl_snap_create(file, vol_args->name, vol_args->fd,
+					subvol, false, NULL);
 
 	kfree(vol_args);
 	return ret;
@@ -1848,9 +1847,8 @@ static noinline int btrfs_ioctl_snap_create_v2(struct file *file,
 		}
 	}
 
-	ret = btrfs_ioctl_snap_create_transid(file, vol_args->name,
-					      vol_args->fd, subvol, NULL,
-					      readonly, inherit);
+	ret = __btrfs_ioctl_snap_create(file, vol_args->name, vol_args->fd,
+					subvol, readonly, inherit);
 	if (ret)
 		goto free_inherit;
 free_inherit:
-- 
2.17.1


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

* [PATCH 3/3] btrfs: Remove async_transid btrfs_mksubvol/create_subvol/create_snapshot
  2020-03-13 15:23 [PATCH 0/3] Removal of BTRFS_SUBVOL_CREATE_ASYNC support Nikolay Borisov
  2020-03-13 15:23 ` [PATCH 1/3] btrfs: Remove " Nikolay Borisov
  2020-03-13 15:23 ` [PATCH 2/3] btrfs: Remove transid argument from btrfs_ioctl_snap_create_transid Nikolay Borisov
@ 2020-03-13 15:23 ` Nikolay Borisov
  2020-03-16 17:01 ` [PATCH 0/3] Removal of BTRFS_SUBVOL_CREATE_ASYNC support David Sterba
  3 siblings, 0 replies; 7+ messages in thread
From: Nikolay Borisov @ 2020-03-13 15:23 UTC (permalink / raw)
  To: linux-btrfs; +Cc: Nikolay Borisov

With BTRFS_SUBVOL_CREATE_ASYNC support remove it's no longer required
to pass the async_transid parameter so remove it and any code using it.

Signed-off-by: Nikolay Borisov <nborisov@suse.com>
---
 fs/btrfs/ioctl.c | 32 ++++++++------------------------
 1 file changed, 8 insertions(+), 24 deletions(-)

diff --git a/fs/btrfs/ioctl.c b/fs/btrfs/ioctl.c
index e18a56d87553..88bb2c43f437 100644
--- a/fs/btrfs/ioctl.c
+++ b/fs/btrfs/ioctl.c
@@ -551,7 +551,6 @@ int __pure btrfs_is_empty_uuid(u8 *uuid)
 static noinline int create_subvol(struct inode *dir,
 				  struct dentry *dentry,
 				  const char *name, int namelen,
-				  u64 *async_transid,
 				  struct btrfs_qgroup_inherit *inherit)
 {
 	struct btrfs_fs_info *fs_info = btrfs_sb(dir->i_sb);
@@ -723,14 +722,7 @@ static noinline int create_subvol(struct inode *dir,
 	trans->bytes_reserved = 0;
 	btrfs_subvolume_release_metadata(fs_info, &block_rsv);
 
-	if (async_transid) {
-		*async_transid = trans->transid;
-		err = btrfs_commit_transaction_async(trans, 1);
-		if (err)
-			err = btrfs_commit_transaction(trans);
-	} else {
-		err = btrfs_commit_transaction(trans);
-	}
+	err = btrfs_commit_transaction(trans);
 	if (err && !ret)
 		ret = err;
 
@@ -748,8 +740,7 @@ static noinline int create_subvol(struct inode *dir,
 }
 
 static int create_snapshot(struct btrfs_root *root, struct inode *dir,
-			   struct dentry *dentry,
-			   u64 *async_transid, bool readonly,
+			   struct dentry *dentry, bool readonly,
 			   struct btrfs_qgroup_inherit *inherit)
 {
 	struct btrfs_fs_info *fs_info = btrfs_sb(dir->i_sb);
@@ -833,14 +824,8 @@ static int create_snapshot(struct btrfs_root *root, struct inode *dir,
 	list_add(&pending_snapshot->list,
 		 &trans->transaction->pending_snapshots);
 	spin_unlock(&fs_info->trans_lock);
-	if (async_transid) {
-		*async_transid = trans->transid;
-		ret = btrfs_commit_transaction_async(trans, 1);
-		if (ret)
-			ret = btrfs_commit_transaction(trans);
-	} else {
-		ret = btrfs_commit_transaction(trans);
-	}
+
+	ret = btrfs_commit_transaction(trans);
 	if (ret)
 		goto fail;
 
@@ -946,7 +931,7 @@ static inline int btrfs_may_create(struct inode *dir, struct dentry *child)
 static noinline int btrfs_mksubvol(const struct path *parent,
 				   const char *name, int namelen,
 				   struct btrfs_root *snap_src,
-				   u64 *async_transid, bool readonly,
+				   bool readonly,
 				   struct btrfs_qgroup_inherit *inherit)
 {
 	struct inode *dir = d_inode(parent->dentry);
@@ -983,11 +968,10 @@ static noinline int btrfs_mksubvol(const struct path *parent,
 		goto out_up_read;
 
 	if (snap_src) {
-		error = create_snapshot(snap_src, dir, dentry,
-					async_transid, readonly, inherit);
+		error = create_snapshot(snap_src, dir, dentry, readonly,
+					inherit);
 	} else {
-		error = create_subvol(dir, dentry, name, namelen,
-				      async_transid, inherit);
+		error = create_subvol(dir, dentry, name, namelen, inherit);
 	}
 	if (!error)
 		fsnotify_mkdir(dir, dentry);
-- 
2.17.1


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

* Re: [PATCH 1/3] btrfs: Remove BTRFS_SUBVOL_CREATE_ASYNC support
  2020-03-13 15:23 ` [PATCH 1/3] btrfs: Remove " Nikolay Borisov
@ 2020-03-13 21:28   ` David Sterba
  0 siblings, 0 replies; 7+ messages in thread
From: David Sterba @ 2020-03-13 21:28 UTC (permalink / raw)
  To: Nikolay Borisov; +Cc: linux-btrfs

On Fri, Mar 13, 2020 at 05:23:18PM +0200, Nikolay Borisov wrote:
> --- a/include/uapi/linux/btrfs.h
> +++ b/include/uapi/linux/btrfs.h
> @@ -36,7 +36,6 @@ struct btrfs_ioctl_vol_args {
>  #define BTRFS_DEVICE_PATH_NAME_MAX	1024
>  #define BTRFS_SUBVOL_NAME_MAX 		4039
>  
> -#define BTRFS_SUBVOL_CREATE_ASYNC	(1ULL << 0)

Removing it completely is probably fine but the 1st bit must not be
reused anytime soon, so at least some comment should be left here.

>  #define BTRFS_SUBVOL_RDONLY		(1ULL << 1)
>  #define BTRFS_SUBVOL_QGROUP_INHERIT	(1ULL << 2)
>  
> @@ -45,8 +44,7 @@ struct btrfs_ioctl_vol_args {
>  #define BTRFS_SUBVOL_SPEC_BY_ID	(1ULL << 4)
>  
>  #define BTRFS_VOL_ARG_V2_FLAGS_SUPPORTED		\
> -			(BTRFS_SUBVOL_CREATE_ASYNC |	\
> -			BTRFS_SUBVOL_RDONLY |		\
> +			(BTRFS_SUBVOL_RDONLY |		\
>  			BTRFS_SUBVOL_QGROUP_INHERIT |	\
>  			BTRFS_DEVICE_SPEC_BY_ID |	\
>  			BTRFS_SUBVOL_SPEC_BY_ID)
> @@ -116,8 +114,7 @@ struct btrfs_ioctl_qgroup_limit_args {
>  
>  /* Supported flags for BTRFS_IOC_SNAP_CREATE_V2 and BTRFS_IOC_SUBVOL_CREATE_V2 */
>  #define BTRFS_SUBVOL_CREATE_ARGS_MASK					\
> -	(BTRFS_SUBVOL_CREATE_ASYNC |					\
> -	 BTRFS_SUBVOL_RDONLY |						\
> +	 (BTRFS_SUBVOL_RDONLY |						\

So this would catch any potential use of the flag and the ioctl can
simply remove all the related code. Ok.

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

* Re: [PATCH 2/3] btrfs: Remove transid argument from btrfs_ioctl_snap_create_transid
  2020-03-13 15:23 ` [PATCH 2/3] btrfs: Remove transid argument from btrfs_ioctl_snap_create_transid Nikolay Borisov
@ 2020-03-13 21:32   ` David Sterba
  0 siblings, 0 replies; 7+ messages in thread
From: David Sterba @ 2020-03-13 21:32 UTC (permalink / raw)
  To: Nikolay Borisov; +Cc: linux-btrfs

On Fri, Mar 13, 2020 at 05:23:19PM +0200, Nikolay Borisov wrote:
> btrfs_ioctl_snap_create_transid no longer takes a transid argument, so
> remove it and rename the function to __btrfs_ioctl_snap_create to
> reflect it's an internal, worker function.

Hm, this use of an underscored version does not look all great to me.
You're right that it's a worker, so it could get a completely new name.
The functions directly handling the ioctls have _ioctl_ in their name
but in this case I don't think it's necessary and gives us more freedom
to come up with a better name. I don't have a suggestion for now.

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

* Re: [PATCH 0/3] Removal of BTRFS_SUBVOL_CREATE_ASYNC support
  2020-03-13 15:23 [PATCH 0/3] Removal of BTRFS_SUBVOL_CREATE_ASYNC support Nikolay Borisov
                   ` (2 preceding siblings ...)
  2020-03-13 15:23 ` [PATCH 3/3] btrfs: Remove async_transid btrfs_mksubvol/create_subvol/create_snapshot Nikolay Borisov
@ 2020-03-16 17:01 ` David Sterba
  3 siblings, 0 replies; 7+ messages in thread
From: David Sterba @ 2020-03-16 17:01 UTC (permalink / raw)
  To: Nikolay Borisov; +Cc: linux-btrfs

On Fri, Mar 13, 2020 at 05:23:17PM +0200, Nikolay Borisov wrote:
> Having deprecated this feature in 5.4 now it's time to actually delete it.
> 
> First patch removes the user-visible support. The other 2 remove unneeded
> arguments and code.
> 
> Nikolay Borisov (3):
>   btrfs: Remove BTRFS_SUBVOL_CREATE_ASYNC support
>   btrfs: Remove transid argument from btrfs_ioctl_snap_create_transid
>   btrfs: Remove async_transid
>     btrfs_mksubvol/create_subvol/create_snapshot

I've merged the patches to misc-next, with the comment added to patch 1
otherwise unchanged (not counting whitespace fixups). The rename
suggested for patch 2 can happen later.

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

end of thread, other threads:[~2020-03-16 17:02 UTC | newest]

Thread overview: 7+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2020-03-13 15:23 [PATCH 0/3] Removal of BTRFS_SUBVOL_CREATE_ASYNC support Nikolay Borisov
2020-03-13 15:23 ` [PATCH 1/3] btrfs: Remove " Nikolay Borisov
2020-03-13 21:28   ` David Sterba
2020-03-13 15:23 ` [PATCH 2/3] btrfs: Remove transid argument from btrfs_ioctl_snap_create_transid Nikolay Borisov
2020-03-13 21:32   ` David Sterba
2020-03-13 15:23 ` [PATCH 3/3] btrfs: Remove async_transid btrfs_mksubvol/create_subvol/create_snapshot Nikolay Borisov
2020-03-16 17:01 ` [PATCH 0/3] Removal of BTRFS_SUBVOL_CREATE_ASYNC support David Sterba

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