convert logfs to ->evict_inode()

Signed-off-by: Al Viro <viro@zeniv.linux.org.uk>
This commit is contained in:
Al Viro 2010-06-07 13:11:34 -04:00
parent 8e22c1a4e4
commit 7da08fd17a
3 changed files with 31 additions and 36 deletions

View File

@ -373,9 +373,8 @@ static void logfs_put_super(struct super_block *sb)
const struct super_operations logfs_super_operations = {
.alloc_inode = logfs_alloc_inode,
.clear_inode = logfs_clear_inode,
.delete_inode = logfs_delete_inode,
.destroy_inode = logfs_destroy_inode,
.evict_inode = logfs_evict_inode,
.drop_inode = logfs_drop_inode,
.put_super = logfs_put_super,
.write_inode = logfs_write_inode,

View File

@ -529,8 +529,7 @@ void logfs_set_blocks(struct inode *inode, u64 no);
/* these logically belong into inode.c but actually reside in readwrite.c */
int logfs_read_inode(struct inode *inode);
int __logfs_write_inode(struct inode *inode, long flags);
void logfs_delete_inode(struct inode *inode);
void logfs_clear_inode(struct inode *inode);
void logfs_evict_inode(struct inode *inode);
/* journal.c */
void logfs_write_anchor(struct super_block *sb);

View File

@ -1972,31 +1972,6 @@ static struct page *inode_to_page(struct inode *inode)
return page;
}
/* Cheaper version of write_inode. All changes are concealed in
* aliases, which are moved back. No write to the medium happens.
*/
void logfs_clear_inode(struct inode *inode)
{
struct super_block *sb = inode->i_sb;
struct logfs_inode *li = logfs_inode(inode);
struct logfs_block *block = li->li_block;
struct page *page;
/* Only deleted files may be dirty at this point */
BUG_ON(inode->i_state & I_DIRTY && inode->i_nlink);
if (!block)
return;
if ((logfs_super(sb)->s_flags & LOGFS_SB_FLAG_SHUTDOWN)) {
block->ops->free_block(inode->i_sb, block);
return;
}
BUG_ON(inode->i_ino < LOGFS_RESERVED_INOS);
page = inode_to_page(inode);
BUG_ON(!page); /* FIXME: Use emergency page */
logfs_put_write_page(page);
}
static int do_write_inode(struct inode *inode)
{
struct super_block *sb = inode->i_sb;
@ -2164,18 +2139,40 @@ static int do_delete_inode(struct inode *inode)
* ZOMBIE inodes have already been deleted before and should remain dead,
* if it weren't for valid checking. No need to kill them again here.
*/
void logfs_delete_inode(struct inode *inode)
void logfs_evict_inode(struct inode *inode)
{
struct super_block *sb = inode->i_sb;
struct logfs_inode *li = logfs_inode(inode);
struct logfs_block *block = li->li_block;
struct page *page;
if (!(li->li_flags & LOGFS_IF_ZOMBIE)) {
li->li_flags |= LOGFS_IF_ZOMBIE;
if (i_size_read(inode) > 0)
logfs_truncate(inode, 0);
do_delete_inode(inode);
if (!inode->i_nlink) {
if (!(li->li_flags & LOGFS_IF_ZOMBIE)) {
li->li_flags |= LOGFS_IF_ZOMBIE;
if (i_size_read(inode) > 0)
logfs_truncate(inode, 0);
do_delete_inode(inode);
}
}
truncate_inode_pages(&inode->i_data, 0);
clear_inode(inode);
end_writeback(inode);
/* Cheaper version of write_inode. All changes are concealed in
* aliases, which are moved back. No write to the medium happens.
*/
/* Only deleted files may be dirty at this point */
BUG_ON(inode->i_state & I_DIRTY && inode->i_nlink);
if (!block)
return;
if ((logfs_super(sb)->s_flags & LOGFS_SB_FLAG_SHUTDOWN)) {
block->ops->free_block(inode->i_sb, block);
return;
}
BUG_ON(inode->i_ino < LOGFS_RESERVED_INOS);
page = inode_to_page(inode);
BUG_ON(!page); /* FIXME: Use emergency page */
logfs_put_write_page(page);
}
void btree_write_block(struct logfs_block *block)