aboutsummaryrefslogtreecommitdiffstats
path: root/fs/logfs
diff options
context:
space:
mode:
authorAl Viro <viro@zeniv.linux.org.uk>2010-06-07 13:11:34 -0400
committerAl Viro <viro@zeniv.linux.org.uk>2010-08-09 16:48:28 -0400
commit7da08fd17a6e42d80f0f3897a5cbd682e77bcdb4 (patch)
treecb13eeb7767279d25b954832be82a2528d20948c /fs/logfs
parent8e22c1a4e429e9facf309c7e7a03ba9cdfd7b106 (diff)
convert logfs to ->evict_inode()
Signed-off-by: Al Viro <viro@zeniv.linux.org.uk>
Diffstat (limited to 'fs/logfs')
-rw-r--r--fs/logfs/inode.c3
-rw-r--r--fs/logfs/logfs.h3
-rw-r--r--fs/logfs/readwrite.c61
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)
373 373
374const struct super_operations logfs_super_operations = { 374const struct super_operations logfs_super_operations = {
375 .alloc_inode = logfs_alloc_inode, 375 .alloc_inode = logfs_alloc_inode,
376 .clear_inode = logfs_clear_inode,
377 .delete_inode = logfs_delete_inode,
378 .destroy_inode = logfs_destroy_inode, 376 .destroy_inode = logfs_destroy_inode,
377 .evict_inode = logfs_evict_inode,
379 .drop_inode = logfs_drop_inode, 378 .drop_inode = logfs_drop_inode,
380 .put_super = logfs_put_super, 379 .put_super = logfs_put_super,
381 .write_inode = logfs_write_inode, 380 .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);
529/* these logically belong into inode.c but actually reside in readwrite.c */ 529/* these logically belong into inode.c but actually reside in readwrite.c */
530int logfs_read_inode(struct inode *inode); 530int logfs_read_inode(struct inode *inode);
531int __logfs_write_inode(struct inode *inode, long flags); 531int __logfs_write_inode(struct inode *inode, long flags);
532void logfs_delete_inode(struct inode *inode); 532void logfs_evict_inode(struct inode *inode);
533void logfs_clear_inode(struct inode *inode);
534 533
535/* journal.c */ 534/* journal.c */
536void logfs_write_anchor(struct super_block *sb); 535void 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)
1972 return page; 1972 return page;
1973} 1973}
1974 1974
1975/* Cheaper version of write_inode. All changes are concealed in
1976 * aliases, which are moved back. No write to the medium happens.
1977 */
1978void logfs_clear_inode(struct inode *inode)
1979{
1980 struct super_block *sb = inode->i_sb;
1981 struct logfs_inode *li = logfs_inode(inode);
1982 struct logfs_block *block = li->li_block;
1983 struct page *page;
1984
1985 /* Only deleted files may be dirty at this point */
1986 BUG_ON(inode->i_state & I_DIRTY && inode->i_nlink);
1987 if (!block)
1988 return;
1989 if ((logfs_super(sb)->s_flags & LOGFS_SB_FLAG_SHUTDOWN)) {
1990 block->ops->free_block(inode->i_sb, block);
1991 return;
1992 }
1993
1994 BUG_ON(inode->i_ino < LOGFS_RESERVED_INOS);
1995 page = inode_to_page(inode);
1996 BUG_ON(!page); /* FIXME: Use emergency page */
1997 logfs_put_write_page(page);
1998}
1999
2000static int do_write_inode(struct inode *inode) 1975static int do_write_inode(struct inode *inode)
2001{ 1976{
2002 struct super_block *sb = inode->i_sb; 1977 struct super_block *sb = inode->i_sb;
@@ -2164,18 +2139,40 @@ static int do_delete_inode(struct inode *inode)
2164 * ZOMBIE inodes have already been deleted before and should remain dead, 2139 * ZOMBIE inodes have already been deleted before and should remain dead,
2165 * if it weren't for valid checking. No need to kill them again here. 2140 * if it weren't for valid checking. No need to kill them again here.
2166 */ 2141 */
2167void logfs_delete_inode(struct inode *inode) 2142void logfs_evict_inode(struct inode *inode)
2168{ 2143{
2144 struct super_block *sb = inode->i_sb;
2169 struct logfs_inode *li = logfs_inode(inode); 2145 struct logfs_inode *li = logfs_inode(inode);
2146 struct logfs_block *block = li->li_block;
2147 struct page *page;
2170 2148
2171 if (!(li->li_flags & LOGFS_IF_ZOMBIE)) { 2149 if (!inode->i_nlink) {
2172 li->li_flags |= LOGFS_IF_ZOMBIE; 2150 if (!(li->li_flags & LOGFS_IF_ZOMBIE)) {
2173 if (i_size_read(inode) > 0) 2151 li->li_flags |= LOGFS_IF_ZOMBIE;
2174 logfs_truncate(inode, 0); 2152 if (i_size_read(inode) > 0)
2175 do_delete_inode(inode); 2153 logfs_truncate(inode, 0);
2154 do_delete_inode(inode);
2155 }
2176 } 2156 }
2177 truncate_inode_pages(&inode->i_data, 0); 2157 truncate_inode_pages(&inode->i_data, 0);
2178 clear_inode(inode); 2158 end_writeback(inode);
2159
2160 /* Cheaper version of write_inode. All changes are concealed in
2161 * aliases, which are moved back. No write to the medium happens.
2162 */
2163 /* Only deleted files may be dirty at this point */
2164 BUG_ON(inode->i_state & I_DIRTY && inode->i_nlink);
2165 if (!block)
2166 return;
2167 if ((logfs_super(sb)->s_flags & LOGFS_SB_FLAG_SHUTDOWN)) {
2168 block->ops->free_block(inode->i_sb, block);
2169 return;
2170 }
2171
2172 BUG_ON(inode->i_ino < LOGFS_RESERVED_INOS);
2173 page = inode_to_page(inode);
2174 BUG_ON(!page); /* FIXME: Use emergency page */
2175 logfs_put_write_page(page);
2179} 2176}
2180 2177
2181void btree_write_block(struct logfs_block *block) 2178void btree_write_block(struct logfs_block *block)