]> err.no Git - linux-2.6/blobdiff - fs/inode.c
Merge rsync://rsync.kernel.org/pub/scm/linux/kernel/git/torvalds/linux-2.6
[linux-2.6] / fs / inode.c
index af8fd78d2099a0852d7867a4b2691924c1ed3982..1f9a3a2b89bc67add68e90faa78612ebf6e884cf 100644 (file)
@@ -26,7 +26,6 @@
  * This is needed for the following functions:
  *  - inode_has_buffers
  *  - invalidate_inode_buffers
- *  - fsync_bdev
  *  - invalidate_bdev
  *
  * FIXME: remove all knowledge of the buffer layer from this file
@@ -332,14 +331,6 @@ static int invalidate_list(struct list_head *head, struct list_head *dispose)
        return busy;
 }
 
-/*
- * This is a two-stage process. First we collect all
- * offending inodes onto the throw-away list, and in
- * the second stage we actually dispose of them. This
- * is because we don't want to sleep while messing
- * with the global lists..
- */
 /**
  *     invalidate_inodes       - discard the inodes on a device
  *     @sb: superblock
@@ -366,16 +357,11 @@ int invalidate_inodes(struct super_block * sb)
 
 EXPORT_SYMBOL(invalidate_inodes);
  
-int __invalidate_device(struct block_device *bdev, int do_sync)
+int __invalidate_device(struct block_device *bdev)
 {
-       struct super_block *sb;
-       int res;
+       struct super_block *sb = get_super(bdev);
+       int res = 0;
 
-       if (do_sync)
-               fsync_bdev(bdev);
-
-       res = 0;
-       sb = get_super(bdev);
        if (sb) {
                /*
                 * no need to lock the super, get_super holds the
@@ -390,7 +376,6 @@ int __invalidate_device(struct block_device *bdev, int do_sync)
        invalidate_bdev(bdev, 0);
        return res;
 }
-
 EXPORT_SYMBOL(__invalidate_device);
 
 static int can_unuse(struct inode *inode)
@@ -515,7 +500,7 @@ repeat:
                        continue;
                if (!test(inode, data))
                        continue;
-               if (inode->i_state & (I_FREEING|I_CLEAR)) {
+               if (inode->i_state & (I_FREEING|I_CLEAR|I_WILL_FREE)) {
                        __wait_on_freeing_inode(inode);
                        goto repeat;
                }
@@ -540,7 +525,7 @@ repeat:
                        continue;
                if (inode->i_sb != sb)
                        continue;
-               if (inode->i_state & (I_FREEING|I_CLEAR)) {
+               if (inode->i_state & (I_FREEING|I_CLEAR|I_WILL_FREE)) {
                        __wait_on_freeing_inode(inode);
                        goto repeat;
                }
@@ -742,7 +727,7 @@ EXPORT_SYMBOL(iunique);
 struct inode *igrab(struct inode *inode)
 {
        spin_lock(&inode_lock);
-       if (!(inode->i_state & I_FREEING))
+       if (!(inode->i_state & (I_FREEING|I_WILL_FREE)))
                __iget(inode);
        else
                /*
@@ -1039,17 +1024,21 @@ static void generic_forget_inode(struct inode *inode)
                if (!(inode->i_state & (I_DIRTY|I_LOCK)))
                        list_move(&inode->i_list, &inode_unused);
                inodes_stat.nr_unused++;
-               spin_unlock(&inode_lock);
-               if (!sb || (sb->s_flags & MS_ACTIVE))
+               if (!sb || (sb->s_flags & MS_ACTIVE)) {
+                       spin_unlock(&inode_lock);
                        return;
+               }
+               inode->i_state |= I_WILL_FREE;
+               spin_unlock(&inode_lock);
                write_inode_now(inode, 1);
                spin_lock(&inode_lock);
+               inode->i_state &= ~I_WILL_FREE;
                inodes_stat.nr_unused--;
                hlist_del_init(&inode->i_hash);
        }
        list_del_init(&inode->i_list);
        list_del_init(&inode->i_sb_list);
-       inode->i_state|=I_FREEING;
+       inode->i_state |= I_FREEING;
        inodes_stat.nr_inodes--;
        spin_unlock(&inode_lock);
        if (inode->i_data.nrpages)
@@ -1336,7 +1325,7 @@ void __init inode_init(unsigned long mempages)
 
        /* inode slab cache */
        inode_cachep = kmem_cache_create("inode_cache", sizeof(struct inode),
-                               0, SLAB_PANIC, init_once, NULL);
+                               0, SLAB_RECLAIM_ACCOUNT|SLAB_PANIC, init_once, NULL);
        set_shrinker(DEFAULT_SEEKS, shrink_icache_memory);
 
        /* Hash may have been set up in inode_init_early */