Skip to content
Snippets Groups Projects
Commit dbd5768f authored by Jan Kara's avatar Jan Kara Committed by Fengguang Wu
Browse files

vfs: Rename end_writeback() to clear_inode()


After we moved inode_sync_wait() from end_writeback() it doesn't make sense
to call the function end_writeback() anymore. Rename it to clear_inode()
which well says what the function really does - set I_CLEAR flag.

Signed-off-by: default avatarJan Kara <jack@suse.cz>
Signed-off-by: default avatarFengguang Wu <fengguang.wu@intel.com>
parent 7994e6f7
No related merge requests found
...@@ -297,7 +297,8 @@ in the beginning of ->setattr unconditionally. ...@@ -297,7 +297,8 @@ in the beginning of ->setattr unconditionally.
be used instead. It gets called whenever the inode is evicted, whether it has be used instead. It gets called whenever the inode is evicted, whether it has
remaining links or not. Caller does *not* evict the pagecache or inode-associated remaining links or not. Caller does *not* evict the pagecache or inode-associated
metadata buffers; getting rid of those is responsibility of method, as it had metadata buffers; getting rid of those is responsibility of method, as it had
been for ->delete_inode(). been for ->delete_inode(). Caller makes sure async writeback cannot be running
for the inode while (or after) ->evict_inode() is called.
->drop_inode() returns int now; it's called on final iput() with ->drop_inode() returns int now; it's called on final iput() with
inode->i_lock held and it returns true if filesystems wants the inode to be inode->i_lock held and it returns true if filesystems wants the inode to be
...@@ -306,14 +307,11 @@ updated appropriately. generic_delete_inode() is also alive and it consists ...@@ -306,14 +307,11 @@ updated appropriately. generic_delete_inode() is also alive and it consists
simply of return 1. Note that all actual eviction work is done by caller after simply of return 1. Note that all actual eviction work is done by caller after
->drop_inode() returns. ->drop_inode() returns.
clear_inode() is gone; use end_writeback() instead. As before, it must As before, clear_inode() must be called exactly once on each call of
be called exactly once on each call of ->evict_inode() (as it used to be for ->evict_inode() (as it used to be for each call of ->delete_inode()). Unlike
each call of ->delete_inode()). Unlike before, if you are using inode-associated before, if you are using inode-associated metadata buffers (i.e.
metadata buffers (i.e. mark_buffer_dirty_inode()), it's your responsibility to mark_buffer_dirty_inode()), it's your responsibility to call
call invalidate_inode_buffers() before end_writeback(). invalidate_inode_buffers() before clear_inode().
No async writeback (and thus no calls of ->write_inode()) will happen
after end_writeback() returns, so actions that should not overlap with ->write_inode()
(e.g. freeing on-disk inode if i_nlink is 0) ought to be done after that call.
NOTE: checking i_nlink in the beginning of ->write_inode() and bailing out NOTE: checking i_nlink in the beginning of ->write_inode() and bailing out
if it's zero is not *and* *never* *had* *been* enough. Final unlink() and iput() if it's zero is not *and* *never* *had* *been* enough. Final unlink() and iput()
......
...@@ -151,7 +151,7 @@ static void ...@@ -151,7 +151,7 @@ static void
spufs_evict_inode(struct inode *inode) spufs_evict_inode(struct inode *inode)
{ {
struct spufs_inode_info *ei = SPUFS_I(inode); struct spufs_inode_info *ei = SPUFS_I(inode);
end_writeback(inode); clear_inode(inode);
if (ei->i_ctx) if (ei->i_ctx)
put_spu_context(ei->i_ctx); put_spu_context(ei->i_ctx);
if (ei->i_gang) if (ei->i_gang)
......
...@@ -115,7 +115,7 @@ static struct inode *hypfs_make_inode(struct super_block *sb, umode_t mode) ...@@ -115,7 +115,7 @@ static struct inode *hypfs_make_inode(struct super_block *sb, umode_t mode)
static void hypfs_evict_inode(struct inode *inode) static void hypfs_evict_inode(struct inode *inode)
{ {
end_writeback(inode); clear_inode(inode);
kfree(inode->i_private); kfree(inode->i_private);
} }
......
...@@ -448,7 +448,7 @@ void v9fs_evict_inode(struct inode *inode) ...@@ -448,7 +448,7 @@ void v9fs_evict_inode(struct inode *inode)
struct v9fs_inode *v9inode = V9FS_I(inode); struct v9fs_inode *v9inode = V9FS_I(inode);
truncate_inode_pages(inode->i_mapping, 0); truncate_inode_pages(inode->i_mapping, 0);
end_writeback(inode); clear_inode(inode);
filemap_fdatawrite(inode->i_mapping); filemap_fdatawrite(inode->i_mapping);
#ifdef CONFIG_9P_FSCACHE #ifdef CONFIG_9P_FSCACHE
......
...@@ -264,7 +264,7 @@ affs_evict_inode(struct inode *inode) ...@@ -264,7 +264,7 @@ affs_evict_inode(struct inode *inode)
} }
invalidate_inode_buffers(inode); invalidate_inode_buffers(inode);
end_writeback(inode); clear_inode(inode);
affs_free_prealloc(inode); affs_free_prealloc(inode);
cache_page = (unsigned long)AFFS_I(inode)->i_lc; cache_page = (unsigned long)AFFS_I(inode)->i_lc;
if (cache_page) { if (cache_page) {
......
...@@ -423,7 +423,7 @@ void afs_evict_inode(struct inode *inode) ...@@ -423,7 +423,7 @@ void afs_evict_inode(struct inode *inode)
ASSERTCMP(inode->i_ino, ==, vnode->fid.vnode); ASSERTCMP(inode->i_ino, ==, vnode->fid.vnode);
truncate_inode_pages(&inode->i_data, 0); truncate_inode_pages(&inode->i_data, 0);
end_writeback(inode); clear_inode(inode);
afs_give_up_callback(vnode); afs_give_up_callback(vnode);
......
...@@ -101,7 +101,7 @@ static int autofs4_show_options(struct seq_file *m, struct dentry *root) ...@@ -101,7 +101,7 @@ static int autofs4_show_options(struct seq_file *m, struct dentry *root)
static void autofs4_evict_inode(struct inode *inode) static void autofs4_evict_inode(struct inode *inode)
{ {
end_writeback(inode); clear_inode(inode);
kfree(inode->i_private); kfree(inode->i_private);
} }
......
...@@ -174,7 +174,7 @@ static void bfs_evict_inode(struct inode *inode) ...@@ -174,7 +174,7 @@ static void bfs_evict_inode(struct inode *inode)
truncate_inode_pages(&inode->i_data, 0); truncate_inode_pages(&inode->i_data, 0);
invalidate_inode_buffers(inode); invalidate_inode_buffers(inode);
end_writeback(inode); clear_inode(inode);
if (inode->i_nlink) if (inode->i_nlink)
return; return;
......
...@@ -505,7 +505,7 @@ static struct inode *bm_get_inode(struct super_block *sb, int mode) ...@@ -505,7 +505,7 @@ static struct inode *bm_get_inode(struct super_block *sb, int mode)
static void bm_evict_inode(struct inode *inode) static void bm_evict_inode(struct inode *inode)
{ {
end_writeback(inode); clear_inode(inode);
kfree(inode->i_private); kfree(inode->i_private);
} }
......
...@@ -487,7 +487,7 @@ static void bdev_evict_inode(struct inode *inode) ...@@ -487,7 +487,7 @@ static void bdev_evict_inode(struct inode *inode)
struct list_head *p; struct list_head *p;
truncate_inode_pages(&inode->i_data, 0); truncate_inode_pages(&inode->i_data, 0);
invalidate_inode_buffers(inode); /* is it needed here? */ invalidate_inode_buffers(inode); /* is it needed here? */
end_writeback(inode); clear_inode(inode);
spin_lock(&bdev_lock); spin_lock(&bdev_lock);
while ( (p = bdev->bd_inodes.next) != &bdev->bd_inodes ) { while ( (p = bdev->bd_inodes.next) != &bdev->bd_inodes ) {
__bd_forget(list_entry(p, struct inode, i_devices)); __bd_forget(list_entry(p, struct inode, i_devices));
......
...@@ -3756,7 +3756,7 @@ void btrfs_evict_inode(struct inode *inode) ...@@ -3756,7 +3756,7 @@ void btrfs_evict_inode(struct inode *inode)
btrfs_end_transaction(trans, root); btrfs_end_transaction(trans, root);
btrfs_btree_balance_dirty(root, nr); btrfs_btree_balance_dirty(root, nr);
no_delete: no_delete:
end_writeback(inode); clear_inode(inode);
return; return;
} }
......
...@@ -272,7 +272,7 @@ static void ...@@ -272,7 +272,7 @@ static void
cifs_evict_inode(struct inode *inode) cifs_evict_inode(struct inode *inode)
{ {
truncate_inode_pages(&inode->i_data, 0); truncate_inode_pages(&inode->i_data, 0);
end_writeback(inode); clear_inode(inode);
cifs_fscache_release_inode_cookie(inode); cifs_fscache_release_inode_cookie(inode);
} }
......
...@@ -244,7 +244,7 @@ static void coda_put_super(struct super_block *sb) ...@@ -244,7 +244,7 @@ static void coda_put_super(struct super_block *sb)
static void coda_evict_inode(struct inode *inode) static void coda_evict_inode(struct inode *inode)
{ {
truncate_inode_pages(&inode->i_data, 0); truncate_inode_pages(&inode->i_data, 0);
end_writeback(inode); clear_inode(inode);
coda_cache_clear_inode(inode); coda_cache_clear_inode(inode);
} }
......
...@@ -133,7 +133,7 @@ static int ecryptfs_statfs(struct dentry *dentry, struct kstatfs *buf) ...@@ -133,7 +133,7 @@ static int ecryptfs_statfs(struct dentry *dentry, struct kstatfs *buf)
static void ecryptfs_evict_inode(struct inode *inode) static void ecryptfs_evict_inode(struct inode *inode)
{ {
truncate_inode_pages(&inode->i_data, 0); truncate_inode_pages(&inode->i_data, 0);
end_writeback(inode); clear_inode(inode);
iput(ecryptfs_inode_to_lower(inode)); iput(ecryptfs_inode_to_lower(inode));
} }
......
...@@ -1473,7 +1473,7 @@ void exofs_evict_inode(struct inode *inode) ...@@ -1473,7 +1473,7 @@ void exofs_evict_inode(struct inode *inode)
goto no_delete; goto no_delete;
inode->i_size = 0; inode->i_size = 0;
end_writeback(inode); clear_inode(inode);
/* if we are deleting an obj that hasn't been created yet, wait. /* if we are deleting an obj that hasn't been created yet, wait.
* This also makes sure that create_done cannot be called with an * This also makes sure that create_done cannot be called with an
...@@ -1503,5 +1503,5 @@ void exofs_evict_inode(struct inode *inode) ...@@ -1503,5 +1503,5 @@ void exofs_evict_inode(struct inode *inode)
return; return;
no_delete: no_delete:
end_writeback(inode); clear_inode(inode);
} }
...@@ -90,7 +90,7 @@ void ext2_evict_inode(struct inode * inode) ...@@ -90,7 +90,7 @@ void ext2_evict_inode(struct inode * inode)
} }
invalidate_inode_buffers(inode); invalidate_inode_buffers(inode);
end_writeback(inode); clear_inode(inode);
ext2_discard_reservation(inode); ext2_discard_reservation(inode);
rsv = EXT2_I(inode)->i_block_alloc_info; rsv = EXT2_I(inode)->i_block_alloc_info;
......
...@@ -272,18 +272,18 @@ void ext3_evict_inode (struct inode *inode) ...@@ -272,18 +272,18 @@ void ext3_evict_inode (struct inode *inode)
if (ext3_mark_inode_dirty(handle, inode)) { if (ext3_mark_inode_dirty(handle, inode)) {
/* If that failed, just dquot_drop() and be done with that */ /* If that failed, just dquot_drop() and be done with that */
dquot_drop(inode); dquot_drop(inode);
end_writeback(inode); clear_inode(inode);
} else { } else {
ext3_xattr_delete_inode(handle, inode); ext3_xattr_delete_inode(handle, inode);
dquot_free_inode(inode); dquot_free_inode(inode);
dquot_drop(inode); dquot_drop(inode);
end_writeback(inode); clear_inode(inode);
ext3_free_inode(handle, inode); ext3_free_inode(handle, inode);
} }
ext3_journal_stop(handle); ext3_journal_stop(handle);
return; return;
no_delete: no_delete:
end_writeback(inode); clear_inode(inode);
dquot_drop(inode); dquot_drop(inode);
} }
......
...@@ -1007,7 +1007,7 @@ static void destroy_inodecache(void) ...@@ -1007,7 +1007,7 @@ static void destroy_inodecache(void)
void ext4_clear_inode(struct inode *inode) void ext4_clear_inode(struct inode *inode)
{ {
invalidate_inode_buffers(inode); invalidate_inode_buffers(inode);
end_writeback(inode); clear_inode(inode);
dquot_drop(inode); dquot_drop(inode);
ext4_discard_preallocations(inode); ext4_discard_preallocations(inode);
if (EXT4_I(inode)->jinode) { if (EXT4_I(inode)->jinode) {
......
...@@ -454,7 +454,7 @@ static void fat_evict_inode(struct inode *inode) ...@@ -454,7 +454,7 @@ static void fat_evict_inode(struct inode *inode)
fat_truncate_blocks(inode, 0); fat_truncate_blocks(inode, 0);
} }
invalidate_inode_buffers(inode); invalidate_inode_buffers(inode);
end_writeback(inode); clear_inode(inode);
fat_cache_inval_inode(inode); fat_cache_inval_inode(inode);
fat_detach(inode); fat_detach(inode);
} }
......
...@@ -355,6 +355,6 @@ void ...@@ -355,6 +355,6 @@ void
vxfs_evict_inode(struct inode *ip) vxfs_evict_inode(struct inode *ip)
{ {
truncate_inode_pages(&ip->i_data, 0); truncate_inode_pages(&ip->i_data, 0);
end_writeback(ip); clear_inode(ip);
call_rcu(&ip->i_rcu, vxfs_i_callback); call_rcu(&ip->i_rcu, vxfs_i_callback);
} }
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment