]> git.karo-electronics.de Git - mv-sheeva.git/commitdiff
new helper: end_writeback()
authorAl Viro <viro@zeniv.linux.org.uk>
Sat, 5 Jun 2010 00:55:25 +0000 (20:55 -0400)
committerAl Viro <viro@zeniv.linux.org.uk>
Mon, 9 Aug 2010 20:47:49 +0000 (16:47 -0400)
Essentially, the minimal variant of ->evict_inode().  It's
a trimmed-down clear_inode(), sans any fs callbacks.  Once
it returns we know that no async writeback will be happening;
every ->evict_inode() instance should do that once and do that
before doing anything ->write_inode() could interfere with
(e.g. freeing the on-disk inode).

Signed-off-by: Al Viro <viro@zeniv.linux.org.uk>
fs/hugetlbfs/inode.c
fs/inode.c
include/linux/fs.h

index bf1a2f400e7064f675255e3dfc184fedbf5d0acc..6e5bd42f38604dd1573992bb16aad0076a03be03 100644 (file)
@@ -374,7 +374,7 @@ static void truncate_hugepages(struct inode *inode, loff_t lstart)
 static void hugetlbfs_evict_inode(struct inode *inode)
 {
        truncate_hugepages(inode, 0);
-       clear_inode(inode);
+       end_writeback(inode);
 }
 
 static inline void
index 9aff7deaf8168644856a271889550f07e21941ed..93e7a5ecbc2645b987d52bb8afcdc48cffca1512 100644 (file)
@@ -294,6 +294,18 @@ void __iget(struct inode *inode)
        inodes_stat.nr_unused--;
 }
 
+void end_writeback(struct inode *inode)
+{
+       might_sleep();
+       BUG_ON(inode->i_data.nrpages);
+       BUG_ON(!list_empty(&inode->i_data.private_list));
+       BUG_ON(!(inode->i_state & I_FREEING));
+       BUG_ON(inode->i_state & I_CLEAR);
+       inode_sync_wait(inode);
+       inode->i_state = I_FREEING | I_CLEAR;
+}
+EXPORT_SYMBOL(end_writeback);
+
 /**
  * clear_inode - clear an inode
  * @inode: inode to clear
index e0ecb8e75ebf86675a0116cb61a6de5f2356b65e..3c23c1dcb1bd0d1e72631d4ccd41240b6b2c9ffb 100644 (file)
@@ -2184,6 +2184,7 @@ extern void unlock_new_inode(struct inode *);
 extern void __iget(struct inode * inode);
 extern void iget_failed(struct inode *);
 extern void clear_inode(struct inode *);
+extern void end_writeback(struct inode *);
 extern void destroy_inode(struct inode *);
 extern void __destroy_inode(struct inode *);
 extern struct inode *new_inode(struct super_block *);