mirror of
https://mirrors.bfsu.edu.cn/git/linux.git
synced 2024-12-19 09:04:51 +08:00
btrfs: Make btrfs_orphan_reserve_metadata take btrfs_inode
Signed-off-by: Nikolay Borisov <nborisov@suse.com> Signed-off-by: David Sterba <dsterba@suse.com>
This commit is contained in:
parent
0e6bf9b13c
commit
8ed7a2a0e0
@ -2695,7 +2695,7 @@ void btrfs_trans_release_metadata(struct btrfs_trans_handle *trans,
|
|||||||
struct btrfs_fs_info *fs_info);
|
struct btrfs_fs_info *fs_info);
|
||||||
void btrfs_trans_release_chunk_metadata(struct btrfs_trans_handle *trans);
|
void btrfs_trans_release_chunk_metadata(struct btrfs_trans_handle *trans);
|
||||||
int btrfs_orphan_reserve_metadata(struct btrfs_trans_handle *trans,
|
int btrfs_orphan_reserve_metadata(struct btrfs_trans_handle *trans,
|
||||||
struct inode *inode);
|
struct btrfs_inode *inode);
|
||||||
void btrfs_orphan_release_metadata(struct inode *inode);
|
void btrfs_orphan_release_metadata(struct inode *inode);
|
||||||
int btrfs_subvolume_reserve_metadata(struct btrfs_root *root,
|
int btrfs_subvolume_reserve_metadata(struct btrfs_root *root,
|
||||||
struct btrfs_block_rsv *rsv,
|
struct btrfs_block_rsv *rsv,
|
||||||
|
@ -5742,10 +5742,10 @@ void btrfs_trans_release_chunk_metadata(struct btrfs_trans_handle *trans)
|
|||||||
|
|
||||||
/* Can only return 0 or -ENOSPC */
|
/* Can only return 0 or -ENOSPC */
|
||||||
int btrfs_orphan_reserve_metadata(struct btrfs_trans_handle *trans,
|
int btrfs_orphan_reserve_metadata(struct btrfs_trans_handle *trans,
|
||||||
struct inode *inode)
|
struct btrfs_inode *inode)
|
||||||
{
|
{
|
||||||
struct btrfs_fs_info *fs_info = btrfs_sb(inode->i_sb);
|
struct btrfs_fs_info *fs_info = btrfs_sb(inode->vfs_inode.i_sb);
|
||||||
struct btrfs_root *root = BTRFS_I(inode)->root;
|
struct btrfs_root *root = inode->root;
|
||||||
/*
|
/*
|
||||||
* We always use trans->block_rsv here as we will have reserved space
|
* We always use trans->block_rsv here as we will have reserved space
|
||||||
* for our orphan when starting the transaction, using get_block_rsv()
|
* for our orphan when starting the transaction, using get_block_rsv()
|
||||||
@ -5762,8 +5762,8 @@ int btrfs_orphan_reserve_metadata(struct btrfs_trans_handle *trans,
|
|||||||
*/
|
*/
|
||||||
u64 num_bytes = btrfs_calc_trans_metadata_size(fs_info, 1);
|
u64 num_bytes = btrfs_calc_trans_metadata_size(fs_info, 1);
|
||||||
|
|
||||||
trace_btrfs_space_reservation(fs_info, "orphan",
|
trace_btrfs_space_reservation(fs_info, "orphan", btrfs_ino(inode),
|
||||||
btrfs_ino(BTRFS_I(inode)), num_bytes, 1);
|
num_bytes, 1);
|
||||||
return btrfs_block_rsv_migrate(src_rsv, dst_rsv, num_bytes, 1);
|
return btrfs_block_rsv_migrate(src_rsv, dst_rsv, num_bytes, 1);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -3215,7 +3215,7 @@ int btrfs_orphan_add(struct btrfs_trans_handle *trans, struct inode *inode)
|
|||||||
|
|
||||||
/* grab metadata reservation from transaction handle */
|
/* grab metadata reservation from transaction handle */
|
||||||
if (reserve) {
|
if (reserve) {
|
||||||
ret = btrfs_orphan_reserve_metadata(trans, inode);
|
ret = btrfs_orphan_reserve_metadata(trans, BTRFS_I(inode));
|
||||||
ASSERT(!ret);
|
ASSERT(!ret);
|
||||||
if (ret) {
|
if (ret) {
|
||||||
atomic_dec(&root->orphan_inodes);
|
atomic_dec(&root->orphan_inodes);
|
||||||
|
Loading…
Reference in New Issue
Block a user