Commit e55cf7ca authored by David Sterba's avatar David Sterba

btrfs: pass btrfs_inode to btrfs_add_delayed_iput

The function is for internal interfaces so we should use the
btrfs_inode.
Reviewed-by: default avatarAnand Jain <anand.jain@oracle.com>
Signed-off-by: default avatarDavid Sterba <dsterba@suse.com>
parent 5fc24314
...@@ -501,7 +501,7 @@ int btrfs_update_inode_fallback(struct btrfs_trans_handle *trans, ...@@ -501,7 +501,7 @@ int btrfs_update_inode_fallback(struct btrfs_trans_handle *trans,
int btrfs_orphan_add(struct btrfs_trans_handle *trans, struct btrfs_inode *inode); int btrfs_orphan_add(struct btrfs_trans_handle *trans, struct btrfs_inode *inode);
int btrfs_orphan_cleanup(struct btrfs_root *root); int btrfs_orphan_cleanup(struct btrfs_root *root);
int btrfs_cont_expand(struct btrfs_inode *inode, loff_t oldsize, loff_t size); int btrfs_cont_expand(struct btrfs_inode *inode, loff_t oldsize, loff_t size);
void btrfs_add_delayed_iput(struct inode *inode); void btrfs_add_delayed_iput(struct btrfs_inode *inode);
void btrfs_run_delayed_iputs(struct btrfs_fs_info *fs_info); void btrfs_run_delayed_iputs(struct btrfs_fs_info *fs_info);
int btrfs_wait_on_delayed_iputs(struct btrfs_fs_info *fs_info); int btrfs_wait_on_delayed_iputs(struct btrfs_fs_info *fs_info);
int btrfs_prealloc_file_range(struct inode *inode, int mode, int btrfs_prealloc_file_range(struct inode *inode, int mode,
......
...@@ -3228,7 +3228,7 @@ static int extent_write_cache_pages(struct address_space *mapping, ...@@ -3228,7 +3228,7 @@ static int extent_write_cache_pages(struct address_space *mapping,
if (wbc->range_cyclic || (wbc->nr_to_write > 0 && range_whole)) if (wbc->range_cyclic || (wbc->nr_to_write > 0 && range_whole))
mapping->writeback_index = done_index; mapping->writeback_index = done_index;
btrfs_add_delayed_iput(inode); btrfs_add_delayed_iput(BTRFS_I(inode));
return ret; return ret;
} }
......
...@@ -260,7 +260,7 @@ int btrfs_remove_free_space_inode(struct btrfs_trans_handle *trans, ...@@ -260,7 +260,7 @@ int btrfs_remove_free_space_inode(struct btrfs_trans_handle *trans,
} }
ret = btrfs_orphan_add(trans, BTRFS_I(inode)); ret = btrfs_orphan_add(trans, BTRFS_I(inode));
if (ret) { if (ret) {
btrfs_add_delayed_iput(inode); btrfs_add_delayed_iput(BTRFS_I(inode));
goto out; goto out;
} }
clear_nlink(inode); clear_nlink(inode);
...@@ -274,7 +274,7 @@ int btrfs_remove_free_space_inode(struct btrfs_trans_handle *trans, ...@@ -274,7 +274,7 @@ int btrfs_remove_free_space_inode(struct btrfs_trans_handle *trans,
spin_unlock(&block_group->lock); spin_unlock(&block_group->lock);
} }
/* One for the lookup ref */ /* One for the lookup ref */
btrfs_add_delayed_iput(inode); btrfs_add_delayed_iput(BTRFS_I(inode));
key.objectid = BTRFS_FREE_SPACE_OBJECTID; key.objectid = BTRFS_FREE_SPACE_OBJECTID;
key.type = 0; key.type = 0;
......
...@@ -1493,7 +1493,7 @@ static noinline void async_cow_start(struct btrfs_work *work) ...@@ -1493,7 +1493,7 @@ static noinline void async_cow_start(struct btrfs_work *work)
compressed_extents = compress_file_range(async_chunk); compressed_extents = compress_file_range(async_chunk);
if (compressed_extents == 0) { if (compressed_extents == 0) {
btrfs_add_delayed_iput(&async_chunk->inode->vfs_inode); btrfs_add_delayed_iput(async_chunk->inode);
async_chunk->inode = NULL; async_chunk->inode = NULL;
} }
} }
...@@ -1533,7 +1533,7 @@ static noinline void async_cow_free(struct btrfs_work *work) ...@@ -1533,7 +1533,7 @@ static noinline void async_cow_free(struct btrfs_work *work)
async_chunk = container_of(work, struct async_chunk, work); async_chunk = container_of(work, struct async_chunk, work);
if (async_chunk->inode) if (async_chunk->inode)
btrfs_add_delayed_iput(&async_chunk->inode->vfs_inode); btrfs_add_delayed_iput(async_chunk->inode);
if (async_chunk->blkcg_css) if (async_chunk->blkcg_css)
css_put(async_chunk->blkcg_css); css_put(async_chunk->blkcg_css);
...@@ -3016,7 +3016,7 @@ static void btrfs_writepage_fixup_worker(struct btrfs_work *work) ...@@ -3016,7 +3016,7 @@ static void btrfs_writepage_fixup_worker(struct btrfs_work *work)
* that could need flushing space. Recursing back to fixup worker would * that could need flushing space. Recursing back to fixup worker would
* deadlock. * deadlock.
*/ */
btrfs_add_delayed_iput(&inode->vfs_inode); btrfs_add_delayed_iput(inode);
} }
/* /*
...@@ -3590,18 +3590,17 @@ unsigned int btrfs_verify_data_csum(struct btrfs_bio *bbio, ...@@ -3590,18 +3590,17 @@ unsigned int btrfs_verify_data_csum(struct btrfs_bio *bbio,
* the inode to the delayed iput machinery. Delayed iputs are processed at * the inode to the delayed iput machinery. Delayed iputs are processed at
* transaction commit time/superblock commit/cleaner kthread. * transaction commit time/superblock commit/cleaner kthread.
*/ */
void btrfs_add_delayed_iput(struct inode *inode) void btrfs_add_delayed_iput(struct btrfs_inode *inode)
{ {
struct btrfs_fs_info *fs_info = btrfs_sb(inode->i_sb); struct btrfs_fs_info *fs_info = inode->root->fs_info;
struct btrfs_inode *binode = BTRFS_I(inode);
if (atomic_add_unless(&inode->i_count, -1, 1)) if (atomic_add_unless(&inode->vfs_inode.i_count, -1, 1))
return; return;
atomic_inc(&fs_info->nr_delayed_iputs); atomic_inc(&fs_info->nr_delayed_iputs);
spin_lock(&fs_info->delayed_iput_lock); spin_lock(&fs_info->delayed_iput_lock);
ASSERT(list_empty(&binode->delayed_iput)); ASSERT(list_empty(&inode->delayed_iput));
list_add_tail(&binode->delayed_iput, &fs_info->delayed_iputs); list_add_tail(&inode->delayed_iput, &fs_info->delayed_iputs);
spin_unlock(&fs_info->delayed_iput_lock); spin_unlock(&fs_info->delayed_iput_lock);
if (!test_bit(BTRFS_FS_CLEANER_RUNNING, &fs_info->flags)) if (!test_bit(BTRFS_FS_CLEANER_RUNNING, &fs_info->flags))
wake_up_process(fs_info->cleaner_kthread); wake_up_process(fs_info->cleaner_kthread);
...@@ -9661,7 +9660,7 @@ static int start_delalloc_inodes(struct btrfs_root *root, ...@@ -9661,7 +9660,7 @@ static int start_delalloc_inodes(struct btrfs_root *root,
&work->work); &work->work);
} else { } else {
ret = filemap_fdatawrite_wbc(inode->i_mapping, wbc); ret = filemap_fdatawrite_wbc(inode->i_mapping, wbc);
btrfs_add_delayed_iput(inode); btrfs_add_delayed_iput(BTRFS_I(inode));
if (ret || wbc->nr_to_write <= 0) if (ret || wbc->nr_to_write <= 0)
goto out; goto out;
} }
......
...@@ -504,7 +504,7 @@ void btrfs_put_ordered_extent(struct btrfs_ordered_extent *entry) ...@@ -504,7 +504,7 @@ void btrfs_put_ordered_extent(struct btrfs_ordered_extent *entry)
ASSERT(list_empty(&entry->log_list)); ASSERT(list_empty(&entry->log_list));
ASSERT(RB_EMPTY_NODE(&entry->rb_node)); ASSERT(RB_EMPTY_NODE(&entry->rb_node));
if (entry->inode) if (entry->inode)
btrfs_add_delayed_iput(entry->inode); btrfs_add_delayed_iput(BTRFS_I(entry->inode));
while (!list_empty(&entry->list)) { while (!list_empty(&entry->list)) {
cur = entry->list.next; cur = entry->list.next;
sum = list_entry(cur, struct btrfs_ordered_sum, list); sum = list_entry(cur, struct btrfs_ordered_sum, list);
......
...@@ -1117,7 +1117,7 @@ int replace_file_extents(struct btrfs_trans_handle *trans, ...@@ -1117,7 +1117,7 @@ int replace_file_extents(struct btrfs_trans_handle *trans,
inode = find_next_inode(root, key.objectid); inode = find_next_inode(root, key.objectid);
first = 0; first = 0;
} else if (inode && btrfs_ino(BTRFS_I(inode)) < key.objectid) { } else if (inode && btrfs_ino(BTRFS_I(inode)) < key.objectid) {
btrfs_add_delayed_iput(inode); btrfs_add_delayed_iput(BTRFS_I(inode));
inode = find_next_inode(root, key.objectid); inode = find_next_inode(root, key.objectid);
} }
if (inode && btrfs_ino(BTRFS_I(inode)) == key.objectid) { if (inode && btrfs_ino(BTRFS_I(inode)) == key.objectid) {
...@@ -1181,7 +1181,7 @@ int replace_file_extents(struct btrfs_trans_handle *trans, ...@@ -1181,7 +1181,7 @@ int replace_file_extents(struct btrfs_trans_handle *trans,
if (dirty) if (dirty)
btrfs_mark_buffer_dirty(leaf); btrfs_mark_buffer_dirty(leaf);
if (inode) if (inode)
btrfs_add_delayed_iput(inode); btrfs_add_delayed_iput(BTRFS_I(inode));
return ret; return ret;
} }
......
...@@ -5473,7 +5473,7 @@ static int log_new_dir_dentries(struct btrfs_trans_handle *trans, ...@@ -5473,7 +5473,7 @@ static int log_new_dir_dentries(struct btrfs_trans_handle *trans,
} }
if (!need_log_inode(trans, BTRFS_I(di_inode))) { if (!need_log_inode(trans, BTRFS_I(di_inode))) {
btrfs_add_delayed_iput(di_inode); btrfs_add_delayed_iput(BTRFS_I(di_inode));
break; break;
} }
...@@ -5482,7 +5482,7 @@ static int log_new_dir_dentries(struct btrfs_trans_handle *trans, ...@@ -5482,7 +5482,7 @@ static int log_new_dir_dentries(struct btrfs_trans_handle *trans,
log_mode = LOG_INODE_ALL; log_mode = LOG_INODE_ALL;
ret = btrfs_log_inode(trans, BTRFS_I(di_inode), ret = btrfs_log_inode(trans, BTRFS_I(di_inode),
log_mode, ctx); log_mode, ctx);
btrfs_add_delayed_iput(di_inode); btrfs_add_delayed_iput(BTRFS_I(di_inode));
if (ret) if (ret)
goto out; goto out;
if (ctx->log_new_dentries) { if (ctx->log_new_dentries) {
...@@ -5676,11 +5676,11 @@ static int add_conflicting_inode(struct btrfs_trans_handle *trans, ...@@ -5676,11 +5676,11 @@ static int add_conflicting_inode(struct btrfs_trans_handle *trans,
* so that the log ends up with the new name and without the old name. * so that the log ends up with the new name and without the old name.
*/ */
if (!need_log_inode(trans, BTRFS_I(inode))) { if (!need_log_inode(trans, BTRFS_I(inode))) {
btrfs_add_delayed_iput(inode); btrfs_add_delayed_iput(BTRFS_I(inode));
return 0; return 0;
} }
btrfs_add_delayed_iput(inode); btrfs_add_delayed_iput(BTRFS_I(inode));
ino_elem = kmalloc(sizeof(*ino_elem), GFP_NOFS); ino_elem = kmalloc(sizeof(*ino_elem), GFP_NOFS);
if (!ino_elem) if (!ino_elem)
...@@ -5755,7 +5755,7 @@ static int log_conflicting_inodes(struct btrfs_trans_handle *trans, ...@@ -5755,7 +5755,7 @@ static int log_conflicting_inodes(struct btrfs_trans_handle *trans,
*/ */
ret = btrfs_log_inode(trans, BTRFS_I(inode), ret = btrfs_log_inode(trans, BTRFS_I(inode),
LOG_INODE_ALL, ctx); LOG_INODE_ALL, ctx);
btrfs_add_delayed_iput(inode); btrfs_add_delayed_iput(BTRFS_I(inode));
if (ret) if (ret)
break; break;
continue; continue;
...@@ -5772,7 +5772,7 @@ static int log_conflicting_inodes(struct btrfs_trans_handle *trans, ...@@ -5772,7 +5772,7 @@ static int log_conflicting_inodes(struct btrfs_trans_handle *trans,
* that, we can avoid doing it again. * that, we can avoid doing it again.
*/ */
if (!need_log_inode(trans, BTRFS_I(inode))) { if (!need_log_inode(trans, BTRFS_I(inode))) {
btrfs_add_delayed_iput(inode); btrfs_add_delayed_iput(BTRFS_I(inode));
continue; continue;
} }
...@@ -5784,7 +5784,7 @@ static int log_conflicting_inodes(struct btrfs_trans_handle *trans, ...@@ -5784,7 +5784,7 @@ static int log_conflicting_inodes(struct btrfs_trans_handle *trans,
* log with the new name before we unpin it. * log with the new name before we unpin it.
*/ */
ret = btrfs_log_inode(trans, BTRFS_I(inode), LOG_INODE_EXISTS, ctx); ret = btrfs_log_inode(trans, BTRFS_I(inode), LOG_INODE_EXISTS, ctx);
btrfs_add_delayed_iput(inode); btrfs_add_delayed_iput(BTRFS_I(inode));
if (ret) if (ret)
break; break;
} }
...@@ -6294,7 +6294,7 @@ static int log_new_delayed_dentries(struct btrfs_trans_handle *trans, ...@@ -6294,7 +6294,7 @@ static int log_new_delayed_dentries(struct btrfs_trans_handle *trans,
} }
if (!need_log_inode(trans, BTRFS_I(di_inode))) { if (!need_log_inode(trans, BTRFS_I(di_inode))) {
btrfs_add_delayed_iput(di_inode); btrfs_add_delayed_iput(BTRFS_I(di_inode));
continue; continue;
} }
...@@ -6307,7 +6307,7 @@ static int log_new_delayed_dentries(struct btrfs_trans_handle *trans, ...@@ -6307,7 +6307,7 @@ static int log_new_delayed_dentries(struct btrfs_trans_handle *trans,
if (!ret && ctx->log_new_dentries) if (!ret && ctx->log_new_dentries)
ret = log_new_dir_dentries(trans, BTRFS_I(di_inode), ctx); ret = log_new_dir_dentries(trans, BTRFS_I(di_inode), ctx);
btrfs_add_delayed_iput(di_inode); btrfs_add_delayed_iput(BTRFS_I(di_inode));
if (ret) if (ret)
break; break;
...@@ -6768,7 +6768,7 @@ static int btrfs_log_all_parents(struct btrfs_trans_handle *trans, ...@@ -6768,7 +6768,7 @@ static int btrfs_log_all_parents(struct btrfs_trans_handle *trans,
} }
if (!need_log_inode(trans, BTRFS_I(dir_inode))) { if (!need_log_inode(trans, BTRFS_I(dir_inode))) {
btrfs_add_delayed_iput(dir_inode); btrfs_add_delayed_iput(BTRFS_I(dir_inode));
continue; continue;
} }
...@@ -6778,7 +6778,7 @@ static int btrfs_log_all_parents(struct btrfs_trans_handle *trans, ...@@ -6778,7 +6778,7 @@ static int btrfs_log_all_parents(struct btrfs_trans_handle *trans,
if (!ret && ctx->log_new_dentries) if (!ret && ctx->log_new_dentries)
ret = log_new_dir_dentries(trans, ret = log_new_dir_dentries(trans,
BTRFS_I(dir_inode), ctx); BTRFS_I(dir_inode), ctx);
btrfs_add_delayed_iput(dir_inode); btrfs_add_delayed_iput(BTRFS_I(dir_inode));
if (ret) if (ret)
goto out; goto out;
} }
...@@ -6823,7 +6823,7 @@ static int log_new_ancestors(struct btrfs_trans_handle *trans, ...@@ -6823,7 +6823,7 @@ static int log_new_ancestors(struct btrfs_trans_handle *trans,
need_log_inode(trans, BTRFS_I(inode))) need_log_inode(trans, BTRFS_I(inode)))
ret = btrfs_log_inode(trans, BTRFS_I(inode), ret = btrfs_log_inode(trans, BTRFS_I(inode),
LOG_INODE_EXISTS, ctx); LOG_INODE_EXISTS, ctx);
btrfs_add_delayed_iput(inode); btrfs_add_delayed_iput(BTRFS_I(inode));
if (ret) if (ret)
return ret; return ret;
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment