mirror of
https://github.com/Fishwaldo/Star64_linux.git
synced 2025-07-23 23:32:14 +00:00
Btrfs: Integrate metadata reservation with start_transaction
Besides simplify the code, this change makes sure all metadata reservation for normal metadata operations are released after committing transaction. Changes since V1: Add code that check if unlink and rmdir will free space. Add ENOSPC handling for clone ioctl. Signed-off-by: Yan Zheng <zheng.yan@oracle.com> Signed-off-by: Chris Mason <chris.mason@oracle.com>
This commit is contained in:
parent
f0486c68e4
commit
a22285a6a3
15 changed files with 685 additions and 535 deletions
|
@ -1522,7 +1522,7 @@ static int transaction_kthread(void *arg)
|
|||
goto sleep;
|
||||
}
|
||||
mutex_unlock(&root->fs_info->trans_mutex);
|
||||
trans = btrfs_start_transaction(root, 1);
|
||||
trans = btrfs_join_transaction(root, 1);
|
||||
ret = btrfs_commit_transaction(trans, root);
|
||||
|
||||
sleep:
|
||||
|
@ -2409,11 +2409,11 @@ int btrfs_commit_super(struct btrfs_root *root)
|
|||
down_write(&root->fs_info->cleanup_work_sem);
|
||||
up_write(&root->fs_info->cleanup_work_sem);
|
||||
|
||||
trans = btrfs_start_transaction(root, 1);
|
||||
trans = btrfs_join_transaction(root, 1);
|
||||
ret = btrfs_commit_transaction(trans, root);
|
||||
BUG_ON(ret);
|
||||
/* run commit again to drop the original snapshot */
|
||||
trans = btrfs_start_transaction(root, 1);
|
||||
trans = btrfs_join_transaction(root, 1);
|
||||
btrfs_commit_transaction(trans, root);
|
||||
ret = btrfs_write_and_wait_transaction(NULL, root);
|
||||
BUG_ON(ret);
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue