From patchwork Mon Mar 22 19:13:30 2010 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Sage Weil X-Patchwork-Id: 87490 Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by demeter.kernel.org (8.14.3/8.14.3) with ESMTP id o2MJDhtp031885 for ; Mon, 22 Mar 2010 19:13:43 GMT Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1755197Ab0CVTNm (ORCPT ); Mon, 22 Mar 2010 15:13:42 -0400 Received: from cobra.newdream.net ([66.33.216.30]:38150 "EHLO cobra.newdream.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1755091Ab0CVTNj (ORCPT ); Mon, 22 Mar 2010 15:13:39 -0400 Received: from localhost.localdomain (ip-66-33-206-8.dreamhost.com [66.33.206.8]) by cobra.newdream.net (Postfix) with ESMTPA id 5E09BBCBEC; Mon, 22 Mar 2010 12:14:43 -0700 (PDT) From: Sage Weil To: linux-btrfs@vger.kernel.org Cc: Sage Weil Subject: [PATCH 5/5] btrfs: add SNAP_DESTROY_ASYNC ioctl Date: Mon, 22 Mar 2010 12:13:30 -0700 Message-Id: <1269285210-19085-6-git-send-email-sage@newdream.net> X-Mailer: git-send-email 1.6.6.1 In-Reply-To: <1269285210-19085-5-git-send-email-sage@newdream.net> References: <1269285210-19085-1-git-send-email-sage@newdream.net> <1269285210-19085-2-git-send-email-sage@newdream.net> <1269285210-19085-3-git-send-email-sage@newdream.net> <1269285210-19085-4-git-send-email-sage@newdream.net> <1269285210-19085-5-git-send-email-sage@newdream.net> Sender: linux-btrfs-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-btrfs@vger.kernel.org X-Greylist: IP, sender and recipient auto-whitelisted, not delayed by milter-greylist-4.2.3 (demeter.kernel.org [140.211.167.41]); Mon, 22 Mar 2010 19:13:44 +0000 (UTC) diff --git a/fs/btrfs/ioctl.c b/fs/btrfs/ioctl.c index fd824a7..c8e6470 100644 --- a/fs/btrfs/ioctl.c +++ b/fs/btrfs/ioctl.c @@ -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: diff --git a/fs/btrfs/ioctl.h b/fs/btrfs/ioctl.h index 4f7fe37..8109257 100644 --- a/fs/btrfs/ioctl.h +++ b/fs/btrfs/ioctl.h @@ -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