]> nv-tegra.nvidia Code Review - linux-2.6.git/blobdiff - fs/inode.c
[PATCH] Light weight event counters
[linux-2.6.git] / fs / inode.c
index 85da11044adc0c1482362377aedf5f721c19bbb3..14a6c4147e4ecd68456ce14dad0ef259c08b59a0 100644 (file)
@@ -56,8 +56,8 @@
 #define I_HASHBITS     i_hash_shift
 #define I_HASHMASK     i_hash_mask
 
-static unsigned int i_hash_mask;
-static unsigned int i_hash_shift;
+static unsigned int i_hash_mask __read_mostly;
+static unsigned int i_hash_shift __read_mostly;
 
 /*
  * Each inode can be on two separate lists. One is
@@ -73,7 +73,7 @@ static unsigned int i_hash_shift;
 
 LIST_HEAD(inode_in_use);
 LIST_HEAD(inode_unused);
-static struct hlist_head *inode_hashtable;
+static struct hlist_head *inode_hashtable __read_mostly;
 
 /*
  * A simple spinlock to protect the list manipulations.
@@ -98,13 +98,13 @@ static DEFINE_MUTEX(iprune_mutex);
  */
 struct inodes_stat_t inodes_stat;
 
-static kmem_cache_t * inode_cachep;
+static kmem_cache_t * inode_cachep __read_mostly;
 
 static struct inode *alloc_inode(struct super_block *sb)
 {
-       static struct address_space_operations empty_aops;
+       static const struct address_space_operations empty_aops;
        static struct inode_operations empty_iops;
-       static struct file_operations empty_fops;
+       static const struct file_operations empty_fops;
        struct inode *inode;
 
        if (sb->s_op->alloc_inode)
@@ -172,8 +172,7 @@ static struct inode *alloc_inode(struct super_block *sb)
 
 void destroy_inode(struct inode *inode) 
 {
-       if (inode_has_buffers(inode))
-               BUG();
+       BUG_ON(inode_has_buffers(inode));
        security_inode_free(inode);
        if (inode->i_sb->s_op->destroy_inode)
                inode->i_sb->s_op->destroy_inode(inode);
@@ -249,12 +248,9 @@ void clear_inode(struct inode *inode)
        might_sleep();
        invalidate_inode_buffers(inode);
        
-       if (inode->i_data.nrpages)
-               BUG();
-       if (!(inode->i_state & I_FREEING))
-               BUG();
-       if (inode->i_state & I_CLEAR)
-               BUG();
+       BUG_ON(inode->i_data.nrpages);
+       BUG_ON(!(inode->i_state & I_FREEING));
+       BUG_ON(inode->i_state & I_CLEAR);
        wait_on_inode(inode);
        DQUOT_DROP(inode);
        if (inode->i_sb && inode->i_sb->s_op->clear_inode)
@@ -456,15 +452,14 @@ static void prune_icache(int nr_to_scan)
                nr_pruned++;
        }
        inodes_stat.nr_unused -= nr_pruned;
+       if (current_is_kswapd())
+               __count_vm_events(KSWAPD_INODESTEAL, reap);
+       else
+               __count_vm_events(PGINODESTEAL, reap);
        spin_unlock(&inode_lock);
 
        dispose_list(&freeable);
        mutex_unlock(&iprune_mutex);
-
-       if (current_is_kswapd())
-               mod_page_state(kswapd_inodesteal, reap);
-       else
-               mod_page_state(pginodesteal, reap);
 }
 
 /*
@@ -1054,8 +1049,7 @@ void generic_delete_inode(struct inode *inode)
        hlist_del_init(&inode->i_hash);
        spin_unlock(&inode_lock);
        wake_up_inode(inode);
-       if (inode->i_state != I_CLEAR)
-               BUG();
+       BUG_ON(inode->i_state != I_CLEAR);
        destroy_inode(inode);
 }