diff options
author | Al Viro <viro@zeniv.linux.org.uk> | 2010-06-07 19:11:34 +0200 |
---|---|---|
committer | Al Viro <viro@zeniv.linux.org.uk> | 2010-08-09 22:48:28 +0200 |
commit | 7da08fd17a6e42d80f0f3897a5cbd682e77bcdb4 (patch) | |
tree | cb13eeb7767279d25b954832be82a2528d20948c | |
parent | logfs: get rid of magical inodes (diff) | |
download | linux-7da08fd17a6e42d80f0f3897a5cbd682e77bcdb4.tar.xz linux-7da08fd17a6e42d80f0f3897a5cbd682e77bcdb4.zip |
convert logfs to ->evict_inode()
Signed-off-by: Al Viro <viro@zeniv.linux.org.uk>
Diffstat (limited to '')
-rw-r--r-- | fs/logfs/inode.c | 3 | ||||
-rw-r--r-- | fs/logfs/logfs.h | 3 | ||||
-rw-r--r-- | fs/logfs/readwrite.c | 61 |
3 files changed, 31 insertions, 36 deletions
diff --git a/fs/logfs/inode.c b/fs/logfs/inode.c index 7811a2a35935..78be674d95c8 100644 --- a/fs/logfs/inode.c +++ b/fs/logfs/inode.c @@ -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, diff --git a/fs/logfs/logfs.h b/fs/logfs/logfs.h index 5e65171dad23..5e3b72077951 100644 --- a/fs/logfs/logfs.h +++ b/fs/logfs/logfs.h @@ -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); diff --git a/fs/logfs/readwrite.c b/fs/logfs/readwrite.c index 580d126d597d..6127baf0e188 100644 --- a/fs/logfs/readwrite.c +++ b/fs/logfs/readwrite.c @@ -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) |