@@ -1255,7 +1255,8 @@ static noinline int btrfs_ioctl_ino_lookup(struct file *file,
}
static noinline int btrfs_ioctl_snap_destroy(struct file *file,
- void __user *arg)
+ void __user *arg,
+ int async)
{
struct dentry *parent = fdentry(file);
struct dentry *dentry;
@@ -1338,7 +1339,10 @@ static noinline int btrfs_ioctl_snap_destroy(struct file *file,
dest->root_key.objectid);
BUG_ON(ret);
- ret = btrfs_commit_transaction(trans, root);
+ if (async)
+ ret = btrfs_end_transaction(trans, root);
+ else
+ ret = btrfs_commit_transaction(trans, root);
BUG_ON(ret);
inode->i_flags |= S_DEAD;
out_up_write:
@@ -2037,7 +2041,9 @@ long btrfs_ioctl(struct file *file, unsigned int
case BTRFS_IOC_SUBVOL_CREATE:
return btrfs_ioctl_snap_create(file, argp, 1, 0);
case BTRFS_IOC_SNAP_DESTROY:
- return btrfs_ioctl_snap_destroy(file, argp);
+ return btrfs_ioctl_snap_destroy(file, argp, 0);
+ case BTRFS_IOC_SNAP_DESTROY_ASYNC:
+ return btrfs_ioctl_snap_destroy(file, argp, 1);
case BTRFS_IOC_DEFAULT_SUBVOL:
return btrfs_ioctl_default_subvol(file, argp);
case BTRFS_IOC_DEFRAG:
@@ -184,4 +184,6 @@ struct btrfs_ioctl_space_args {
#define BTRFS_IOC_WAIT_SYNC _IOW(BTRFS_IOCTL_MAGIC, 22, __u64)
#define BTRFS_IOC_SNAP_CREATE_ASYNC _IOW(BTRFS_IOCTL_MAGIC, 23, \
struct btrfs_ioctl_vol_args)
+#define BTRFS_IOC_SNAP_DESTROY_ASYNC _IOW(BTRFS_IOCTL_MAGIC, 24, \
+ struct btrfs_ioctl_vol_args)
#endif