aboutsummaryrefslogtreecommitdiffstats
path: root/fs/btrfs/inode.c
diff options
context:
space:
mode:
authorMiao Xie <miaox@cn.fujitsu.com>2012-09-06 06:02:28 -0400
committerChris Mason <chris.mason@fusionio.com>2012-10-01 15:19:11 -0400
commit66d8f3dd1c87813d7f1cf8b774cb03e9b8d7e87e (patch)
tree74d18d716f42e15958a9723ece4cd98dfdfd6a74 /fs/btrfs/inode.c
parent6352b91da1a2108bb8cc5115e8714f90d706f15f (diff)
Btrfs: add a new "type" field into the block reservation structure
Sometimes we need choose the method of the reservation according to the type of the block reservation, such as the reservation for the delayed inode update. Now we identify the type just by comparing the address of the reservation variants, it is very ugly if it is a temporary one because we need compare it with all the common reservation variants. So we add a new "type" field to keep the type the reservation variants. Signed-off-by: Miao Xie <miaox@cn.fujitsu.com>
Diffstat (limited to 'fs/btrfs/inode.c')
-rw-r--r--fs/btrfs/inode.c8
1 files changed, 4 insertions, 4 deletions
diff --git a/fs/btrfs/inode.c b/fs/btrfs/inode.c
index 073af0724bc0..d34eb329720d 100644
--- a/fs/btrfs/inode.c
+++ b/fs/btrfs/inode.c
@@ -2195,7 +2195,7 @@ int btrfs_orphan_add(struct btrfs_trans_handle *trans, struct inode *inode)
2195 int ret; 2195 int ret;
2196 2196
2197 if (!root->orphan_block_rsv) { 2197 if (!root->orphan_block_rsv) {
2198 block_rsv = btrfs_alloc_block_rsv(root); 2198 block_rsv = btrfs_alloc_block_rsv(root, BTRFS_BLOCK_RSV_TEMP);
2199 if (!block_rsv) 2199 if (!block_rsv)
2200 return -ENOMEM; 2200 return -ENOMEM;
2201 } 2201 }
@@ -3070,7 +3070,7 @@ out:
3070static void __unlink_end_trans(struct btrfs_trans_handle *trans, 3070static void __unlink_end_trans(struct btrfs_trans_handle *trans,
3071 struct btrfs_root *root) 3071 struct btrfs_root *root)
3072{ 3072{
3073 if (trans->block_rsv == &root->fs_info->global_block_rsv) { 3073 if (trans->block_rsv->type == BTRFS_BLOCK_RSV_GLOBAL) {
3074 btrfs_block_rsv_release(root, trans->block_rsv, 3074 btrfs_block_rsv_release(root, trans->block_rsv,
3075 trans->bytes_reserved); 3075 trans->bytes_reserved);
3076 trans->block_rsv = &root->fs_info->trans_block_rsv; 3076 trans->block_rsv = &root->fs_info->trans_block_rsv;
@@ -3821,7 +3821,7 @@ void btrfs_evict_inode(struct inode *inode)
3821 goto no_delete; 3821 goto no_delete;
3822 } 3822 }
3823 3823
3824 rsv = btrfs_alloc_block_rsv(root); 3824 rsv = btrfs_alloc_block_rsv(root, BTRFS_BLOCK_RSV_TEMP);
3825 if (!rsv) { 3825 if (!rsv) {
3826 btrfs_orphan_del(NULL, inode); 3826 btrfs_orphan_del(NULL, inode);
3827 goto no_delete; 3827 goto no_delete;
@@ -6851,7 +6851,7 @@ static int btrfs_truncate(struct inode *inode)
6851 * 3) fs_info->trans_block_rsv - this will have 1 items worth left for 6851 * 3) fs_info->trans_block_rsv - this will have 1 items worth left for
6852 * updating the inode. 6852 * updating the inode.
6853 */ 6853 */
6854 rsv = btrfs_alloc_block_rsv(root); 6854 rsv = btrfs_alloc_block_rsv(root, BTRFS_BLOCK_RSV_TEMP);
6855 if (!rsv) 6855 if (!rsv)
6856 return -ENOMEM; 6856 return -ENOMEM;
6857 rsv->size = min_size; 6857 rsv->size = min_size;