From: Yan Zheng Date: Mon, 5 Jan 2009 20:43:43 +0000 (-0500) Subject: Btrfs: update directory's size when creating subvol/snapshot X-Git-Tag: v2.6.29-rc1~27^2~9^2~9 X-Git-Url: http://pilppa.com/gitweb/?a=commitdiff_plain;h=52c2617990fed072220708d6b771dc10f37547b0;p=linux-2.6-omap-h63xx.git 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 --- diff --git a/fs/btrfs/ioctl.c b/fs/btrfs/ioctl.c index 150784e936e..ba484aac1b9 100644 --- a/fs/btrfs/ioctl.c +++ b/fs/btrfs/ioctl.c @@ -147,6 +147,10 @@ static noinline int create_subvol(struct btrfs_root *root, if (ret) goto fail; + btrfs_i_size_write(dir, dir->i_size + namelen * 2); + ret = btrfs_update_inode(trans, root, dir); + BUG_ON(ret); + /* add the backref first */ ret = btrfs_add_root_ref(trans, root->fs_info->tree_root, objectid, BTRFS_ROOT_BACKREF_KEY, diff --git a/fs/btrfs/transaction.c b/fs/btrfs/transaction.c index 4604178a43a..4e7b56e9d3a 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, if (ret) goto fail; + btrfs_i_size_write(parent_inode, parent_inode->i_size + namelen * 2); + ret = btrfs_update_inode(trans, parent_root, parent_inode); + BUG_ON(ret); + /* add the backref first */ ret = btrfs_add_root_ref(trans, parent_root->fs_info->tree_root, pending->root_key.objectid,