summaryrefslogtreecommitdiffstats
path: root/fs/btrfs/inode.c
diff options
context:
space:
mode:
authorDongsheng Yang <yangds.fnst@cn.fujitsu.com>2015-02-06 10:26:52 -0500
committerChris Mason <clm@fb.com>2015-04-13 10:52:50 -0400
commite2d1f92399afb6ec518b68867ed10db2585b283a (patch)
treea6964e3b445268bf5c67c4b482de6c98b03571c8 /fs/btrfs/inode.c
parent237c0e9f1fbfdca7287f3539f1fa73e5063156b5 (diff)
btrfs: qgroup: do a reservation in a higher level.
There are two problems in qgroup: a). The PAGE_CACHE is 4K, even when we are writing a data of 1K, qgroup will reserve a 4K size. It will cause the last 3K in a qgroup is not available to user. b). When user is writing a inline data, qgroup will not reserve it, it means this is a window we can exceed the limit of a qgroup. The main idea of this patch is reserving the data size of write_bytes rather than the reserve_bytes. It means qgroup will not care about the data size btrfs will reserve for user, but only care about the data size user is going to write. Then reserve it when user want to write and release it in transaction committed. In this way, qgroup can be released from the complex procedure in btrfs and only do the reserve when user want to write and account when the data is written in commit_transaction(). Signed-off-by: Dongsheng Yang <yangds.fnst@cn.fujitsu.com> Signed-off-by: Chris Mason <clm@fb.com>
Diffstat (limited to 'fs/btrfs/inode.c')
-rw-r--r--fs/btrfs/inode.c15
1 files changed, 0 insertions, 15 deletions
diff --git a/fs/btrfs/inode.c b/fs/btrfs/inode.c
index a9f69a0d4b08..27b59b8362f9 100644
--- a/fs/btrfs/inode.c
+++ b/fs/btrfs/inode.c
@@ -754,9 +754,6 @@ retry:
754 } 754 }
755 goto out_free; 755 goto out_free;
756 } 756 }
757 btrfs_qgroup_update_reserved_bytes(root->fs_info,
758 root->root_key.objectid,
759 ins.offset, 1);
760 /* 757 /*
761 * here we're doing allocation and writeback of the 758 * here we're doing allocation and writeback of the
762 * compressed pages 759 * compressed pages
@@ -981,10 +978,6 @@ static noinline int cow_file_range(struct inode *inode,
981 if (ret < 0) 978 if (ret < 0)
982 goto out_unlock; 979 goto out_unlock;
983 980
984 btrfs_qgroup_update_reserved_bytes(root->fs_info,
985 root->root_key.objectid,
986 ins.offset, 1);
987
988 em = alloc_extent_map(); 981 em = alloc_extent_map();
989 if (!em) { 982 if (!em) {
990 ret = -ENOMEM; 983 ret = -ENOMEM;
@@ -7037,10 +7030,6 @@ static struct extent_map *btrfs_new_extent_direct(struct inode *inode,
7037 return ERR_PTR(ret); 7030 return ERR_PTR(ret);
7038 } 7031 }
7039 7032
7040 btrfs_qgroup_update_reserved_bytes(root->fs_info,
7041 root->root_key.objectid,
7042 ins.offset, 1);
7043
7044 return em; 7033 return em;
7045} 7034}
7046 7035
@@ -9595,10 +9584,6 @@ static int __btrfs_prealloc_file_range(struct inode *inode, int mode,
9595 break; 9584 break;
9596 } 9585 }
9597 9586
9598 btrfs_qgroup_update_reserved_bytes(root->fs_info,
9599 root->root_key.objectid,
9600 ins.offset, 1);
9601
9602 btrfs_drop_extent_cache(inode, cur_offset, 9587 btrfs_drop_extent_cache(inode, cur_offset,
9603 cur_offset + ins.offset -1, 0); 9588 cur_offset + ins.offset -1, 0);
9604 9589