mirror of
https://github.com/edk2-porting/linux-next.git
synced 2024-12-17 17:53:56 +08:00
btrfs: make btrfs_is_free_space_inode 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
6ef06d2790
commit
70ddc553b5
@ -243,14 +243,14 @@ static inline void btrfs_i_size_write(struct btrfs_inode *inode, u64 size)
|
||||
inode->disk_i_size = size;
|
||||
}
|
||||
|
||||
static inline bool btrfs_is_free_space_inode(struct inode *inode)
|
||||
static inline bool btrfs_is_free_space_inode(struct btrfs_inode *inode)
|
||||
{
|
||||
struct btrfs_root *root = BTRFS_I(inode)->root;
|
||||
struct btrfs_root *root = inode->root;
|
||||
|
||||
if (root == root->fs_info->tree_root &&
|
||||
btrfs_ino(BTRFS_I(inode)) != BTRFS_BTREE_INODE_OBJECTID)
|
||||
btrfs_ino(inode) != BTRFS_BTREE_INODE_OBJECTID)
|
||||
return true;
|
||||
if (BTRFS_I(inode)->location.objectid == BTRFS_FREE_INO_OBJECTID)
|
||||
if (inode->location.objectid == BTRFS_FREE_INO_OBJECTID)
|
||||
return true;
|
||||
return false;
|
||||
}
|
||||
|
@ -3123,7 +3123,7 @@ static inline void btrfs_force_ra(struct address_space *mapping,
|
||||
}
|
||||
|
||||
struct inode *btrfs_lookup_dentry(struct inode *dir, struct dentry *dentry);
|
||||
int btrfs_set_inode_index(struct inode *dir, u64 *index);
|
||||
int btrfs_set_inode_index(struct btrfs_inode *dir, u64 *index);
|
||||
int btrfs_unlink_inode(struct btrfs_trans_handle *trans,
|
||||
struct btrfs_root *root,
|
||||
struct btrfs_inode *dir, struct btrfs_inode *inode,
|
||||
|
@ -4148,7 +4148,7 @@ int btrfs_alloc_data_chunk_ondemand(struct inode *inode, u64 bytes)
|
||||
/* make sure bytes are sectorsize aligned */
|
||||
bytes = ALIGN(bytes, fs_info->sectorsize);
|
||||
|
||||
if (btrfs_is_free_space_inode(inode)) {
|
||||
if (btrfs_is_free_space_inode(BTRFS_I(inode))) {
|
||||
need_commit = 0;
|
||||
ASSERT(current->journal_info);
|
||||
}
|
||||
@ -5947,7 +5947,7 @@ int btrfs_delalloc_reserve_metadata(struct inode *inode, u64 num_bytes)
|
||||
* If we have a transaction open (can happen if we call truncate_block
|
||||
* from truncate), then we need FLUSH_LIMIT so we don't deadlock.
|
||||
*/
|
||||
if (btrfs_is_free_space_inode(inode)) {
|
||||
if (btrfs_is_free_space_inode(BTRFS_I(inode))) {
|
||||
flush = BTRFS_RESERVE_NO_FLUSH;
|
||||
delalloc_lock = false;
|
||||
} else if (current->journal_info) {
|
||||
|
@ -214,7 +214,7 @@ static int __btrfs_lookup_bio_sums(struct inode *inode, struct bio *bio,
|
||||
* read from the commit root and sidestep a nasty deadlock
|
||||
* between reading the free space cache and updating the csum tree.
|
||||
*/
|
||||
if (btrfs_is_free_space_inode(inode)) {
|
||||
if (btrfs_is_free_space_inode(BTRFS_I(inode))) {
|
||||
path->search_commit_root = 1;
|
||||
path->skip_locking = 1;
|
||||
}
|
||||
|
@ -933,7 +933,7 @@ static noinline int cow_file_range(struct inode *inode,
|
||||
struct extent_map *em;
|
||||
int ret = 0;
|
||||
|
||||
if (btrfs_is_free_space_inode(inode)) {
|
||||
if (btrfs_is_free_space_inode(BTRFS_I(inode))) {
|
||||
WARN_ON_ONCE(1);
|
||||
ret = -EINVAL;
|
||||
goto out_unlock;
|
||||
@ -1231,7 +1231,7 @@ static noinline int run_delalloc_nocow(struct inode *inode,
|
||||
return -ENOMEM;
|
||||
}
|
||||
|
||||
nolock = btrfs_is_free_space_inode(inode);
|
||||
nolock = btrfs_is_free_space_inode(BTRFS_I(inode));
|
||||
|
||||
cow_start = (u64)-1;
|
||||
cur_offset = start;
|
||||
@ -1670,7 +1670,7 @@ static void btrfs_set_bit_hook(struct inode *inode,
|
||||
if (!(state->state & EXTENT_DELALLOC) && (*bits & EXTENT_DELALLOC)) {
|
||||
struct btrfs_root *root = BTRFS_I(inode)->root;
|
||||
u64 len = state->end + 1 - state->start;
|
||||
bool do_list = !btrfs_is_free_space_inode(inode);
|
||||
bool do_list = !btrfs_is_free_space_inode(BTRFS_I(inode));
|
||||
|
||||
if (*bits & EXTENT_FIRST_DELALLOC) {
|
||||
*bits &= ~EXTENT_FIRST_DELALLOC;
|
||||
@ -1720,7 +1720,7 @@ static void btrfs_clear_bit_hook(struct inode *inode,
|
||||
*/
|
||||
if ((state->state & EXTENT_DELALLOC) && (*bits & EXTENT_DELALLOC)) {
|
||||
struct btrfs_root *root = BTRFS_I(inode)->root;
|
||||
bool do_list = !btrfs_is_free_space_inode(inode);
|
||||
bool do_list = !btrfs_is_free_space_inode(BTRFS_I(inode));
|
||||
|
||||
if (*bits & EXTENT_FIRST_DELALLOC) {
|
||||
*bits &= ~EXTENT_FIRST_DELALLOC;
|
||||
@ -1854,7 +1854,7 @@ static int btrfs_submit_bio_hook(struct inode *inode, struct bio *bio,
|
||||
|
||||
skip_sum = BTRFS_I(inode)->flags & BTRFS_INODE_NODATASUM;
|
||||
|
||||
if (btrfs_is_free_space_inode(inode))
|
||||
if (btrfs_is_free_space_inode(BTRFS_I(inode)))
|
||||
metadata = BTRFS_WQ_ENDIO_FREE_SPACE;
|
||||
|
||||
if (bio_op(bio) != REQ_OP_WRITE) {
|
||||
@ -2793,7 +2793,7 @@ static int btrfs_finish_ordered_io(struct btrfs_ordered_extent *ordered_extent)
|
||||
bool nolock;
|
||||
bool truncated = false;
|
||||
|
||||
nolock = btrfs_is_free_space_inode(inode);
|
||||
nolock = btrfs_is_free_space_inode(BTRFS_I(inode));
|
||||
|
||||
if (test_bit(BTRFS_ORDERED_IOERR, &ordered_extent->flags)) {
|
||||
ret = -EIO;
|
||||
@ -2993,7 +2993,7 @@ static int btrfs_writepage_end_io_hook(struct page *page, u64 start, u64 end,
|
||||
end - start + 1, uptodate))
|
||||
return 0;
|
||||
|
||||
if (btrfs_is_free_space_inode(inode)) {
|
||||
if (btrfs_is_free_space_inode(BTRFS_I(inode))) {
|
||||
wq = fs_info->endio_freespace_worker;
|
||||
func = btrfs_freespace_write_helper;
|
||||
} else {
|
||||
@ -3865,7 +3865,7 @@ noinline int btrfs_update_inode(struct btrfs_trans_handle *trans,
|
||||
* The data relocation inode should also be directly updated
|
||||
* without delay
|
||||
*/
|
||||
if (!btrfs_is_free_space_inode(inode)
|
||||
if (!btrfs_is_free_space_inode(BTRFS_I(inode))
|
||||
&& root->root_key.objectid != BTRFS_DATA_RELOC_TREE_OBJECTID
|
||||
&& !test_bit(BTRFS_FS_LOG_RECOVERING, &fs_info->flags)) {
|
||||
btrfs_update_root_times(trans, root);
|
||||
@ -4319,7 +4319,7 @@ int btrfs_truncate_inode_items(struct btrfs_trans_handle *trans,
|
||||
* for non-free space inodes and ref cows, we want to back off from
|
||||
* time to time
|
||||
*/
|
||||
if (!btrfs_is_free_space_inode(inode) &&
|
||||
if (!btrfs_is_free_space_inode(BTRFS_I(inode)) &&
|
||||
test_bit(BTRFS_ROOT_REF_COWS, &root->state))
|
||||
be_nice = 1;
|
||||
|
||||
@ -5180,7 +5180,7 @@ void btrfs_evict_inode(struct inode *inode)
|
||||
if (inode->i_nlink &&
|
||||
((btrfs_root_refs(&root->root_item) != 0 &&
|
||||
root->root_key.objectid != BTRFS_ROOT_TREE_OBJECTID) ||
|
||||
btrfs_is_free_space_inode(inode)))
|
||||
btrfs_is_free_space_inode(BTRFS_I(inode))))
|
||||
goto no_delete;
|
||||
|
||||
if (is_bad_inode(inode)) {
|
||||
@ -5897,7 +5897,8 @@ int btrfs_write_inode(struct inode *inode, struct writeback_control *wbc)
|
||||
if (test_bit(BTRFS_INODE_DUMMY, &BTRFS_I(inode)->runtime_flags))
|
||||
return 0;
|
||||
|
||||
if (btrfs_fs_closing(root->fs_info) && btrfs_is_free_space_inode(inode))
|
||||
if (btrfs_fs_closing(root->fs_info) &&
|
||||
btrfs_is_free_space_inode(BTRFS_I(inode)))
|
||||
nolock = true;
|
||||
|
||||
if (wbc->sync_mode == WB_SYNC_ALL) {
|
||||
|
Loading…
Reference in New Issue
Block a user