aboutsummaryrefslogtreecommitdiffstats
path: root/fs/btrfs/tree-log.c
diff options
context:
space:
mode:
authorYan, Zheng <zheng.yan@oracle.com>2009-09-21 16:00:26 -0400
committerChris Mason <chris.mason@oracle.com>2009-09-21 16:00:26 -0400
commit76dda93c6ae2c1dc3e6cde34569d6aca26b0c918 (patch)
treef5ca46ec89d4ae2c762952d5f35e2c6f95ac046a /fs/btrfs/tree-log.c
parent4df27c4d5cc1dda54ed7d0a8389347f2df359cf9 (diff)
Btrfs: add snapshot/subvolume destroy ioctl
This patch adds snapshot/subvolume destroy ioctl. A subvolume that isn't being used and doesn't contains links to other subvolumes can be destroyed. Signed-off-by: Yan Zheng <zheng.yan@oracle.com> Signed-off-by: Chris Mason <chris.mason@oracle.com>
Diffstat (limited to 'fs/btrfs/tree-log.c')
-rw-r--r--fs/btrfs/tree-log.c13
1 files changed, 11 insertions, 2 deletions
diff --git a/fs/btrfs/tree-log.c b/fs/btrfs/tree-log.c
index 6e674d76186d..4d7d9abef42f 100644
--- a/fs/btrfs/tree-log.c
+++ b/fs/btrfs/tree-log.c
@@ -2841,7 +2841,7 @@ static noinline int check_parent_dirs_for_sync(struct btrfs_trans_handle *trans,
2841 if (!parent || !parent->d_inode || sb != parent->d_inode->i_sb) 2841 if (!parent || !parent->d_inode || sb != parent->d_inode->i_sb)
2842 break; 2842 break;
2843 2843
2844 if (parent == sb->s_root) 2844 if (IS_ROOT(parent))
2845 break; 2845 break;
2846 2846
2847 parent = parent->d_parent; 2847 parent = parent->d_parent;
@@ -2880,6 +2880,12 @@ int btrfs_log_inode_parent(struct btrfs_trans_handle *trans,
2880 goto end_no_trans; 2880 goto end_no_trans;
2881 } 2881 }
2882 2882
2883 if (root != BTRFS_I(inode)->root ||
2884 btrfs_root_refs(&root->root_item) == 0) {
2885 ret = 1;
2886 goto end_no_trans;
2887 }
2888
2883 ret = check_parent_dirs_for_sync(trans, inode, parent, 2889 ret = check_parent_dirs_for_sync(trans, inode, parent,
2884 sb, last_committed); 2890 sb, last_committed);
2885 if (ret) 2891 if (ret)
@@ -2907,12 +2913,15 @@ int btrfs_log_inode_parent(struct btrfs_trans_handle *trans,
2907 break; 2913 break;
2908 2914
2909 inode = parent->d_inode; 2915 inode = parent->d_inode;
2916 if (root != BTRFS_I(inode)->root)
2917 break;
2918
2910 if (BTRFS_I(inode)->generation > 2919 if (BTRFS_I(inode)->generation >
2911 root->fs_info->last_trans_committed) { 2920 root->fs_info->last_trans_committed) {
2912 ret = btrfs_log_inode(trans, root, inode, inode_only); 2921 ret = btrfs_log_inode(trans, root, inode, inode_only);
2913 BUG_ON(ret); 2922 BUG_ON(ret);
2914 } 2923 }
2915 if (parent == sb->s_root) 2924 if (IS_ROOT(parent))
2916 break; 2925 break;
2917 2926
2918 parent = parent->d_parent; 2927 parent = parent->d_parent;