aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorYan Zheng <zheng.yan@oracle.com>2009-01-05 15:43:43 -0500
committerChris Mason <chris.mason@oracle.com>2009-01-05 15:43:43 -0500
commit52c2617990fed072220708d6b771dc10f37547b0 (patch)
tree6f97a07b56927bc96fabb0669cd31d0d0d28273a
parente441d54de4fd97dd381f3e73636f5ba51ff4c7d9 (diff)
Btrfs: update directory's size when creating subvol/snapshot
Make sure directory's size properly updated when creating subvol/snapshot. Signed-off-by: Yan Zheng <zheng.yan@oracle.com>
-rw-r--r--fs/btrfs/ioctl.c4
-rw-r--r--fs/btrfs/transaction.c4
2 files changed, 8 insertions, 0 deletions
diff --git a/fs/btrfs/ioctl.c b/fs/btrfs/ioctl.c
index 150784e936e6..ba484aac1b9c 100644
--- a/fs/btrfs/ioctl.c
+++ b/fs/btrfs/ioctl.c
@@ -147,6 +147,10 @@ static noinline int create_subvol(struct btrfs_root *root,
147 if (ret) 147 if (ret)
148 goto fail; 148 goto fail;
149 149
150 btrfs_i_size_write(dir, dir->i_size + namelen * 2);
151 ret = btrfs_update_inode(trans, root, dir);
152 BUG_ON(ret);
153
150 /* add the backref first */ 154 /* add the backref first */
151 ret = btrfs_add_root_ref(trans, root->fs_info->tree_root, 155 ret = btrfs_add_root_ref(trans, root->fs_info->tree_root,
152 objectid, BTRFS_ROOT_BACKREF_KEY, 156 objectid, BTRFS_ROOT_BACKREF_KEY,
diff --git a/fs/btrfs/transaction.c b/fs/btrfs/transaction.c
index 4604178a43a9..4e7b56e9d3a5 100644
--- a/fs/btrfs/transaction.c
+++ b/fs/btrfs/transaction.c
@@ -819,6 +819,10 @@ static noinline int finish_pending_snapshot(struct btrfs_fs_info *fs_info,
819 if (ret) 819 if (ret)
820 goto fail; 820 goto fail;
821 821
822 btrfs_i_size_write(parent_inode, parent_inode->i_size + namelen * 2);
823 ret = btrfs_update_inode(trans, parent_root, parent_inode);
824 BUG_ON(ret);
825
822 /* add the backref first */ 826 /* add the backref first */
823 ret = btrfs_add_root_ref(trans, parent_root->fs_info->tree_root, 827 ret = btrfs_add_root_ref(trans, parent_root->fs_info->tree_root,
824 pending->root_key.objectid, 828 pending->root_key.objectid,