commit 47adbb0a36cf0dc3c2f48b49a11a92924cd79271
Author: Erez Zadok <[EMAIL PROTECTED]>
Date:   Mon Sep 24 01:09:14 2007 -0400

    Unionfs: add un/likely conditionals on readdir ops
    
    Signed-off-by: Erez Zadok <[EMAIL PROTECTED]>

diff --git a/fs/unionfs/rdstate.c b/fs/unionfs/rdstate.c
index 5c9d14b..5fca3a5 100644
--- a/fs/unionfs/rdstate.c
+++ b/fs/unionfs/rdstate.c
@@ -45,7 +45,7 @@ int unionfs_init_filldir_cache(void)
 
 void unionfs_destroy_filldir_cache(void)
 {
-       if (unionfs_filldir_cachep)
+       if (likely(unionfs_filldir_cachep))
                kmem_cache_destroy(unionfs_filldir_cachep);
 }
 
@@ -72,7 +72,8 @@ static int guesstimate_hash_size(struct inode *inode)
                return UNIONFS_I(inode)->hashsize;
 
        for (bindex = ibstart(inode); bindex <= ibend(inode); bindex++) {
-               if (!(lower_inode = unionfs_lower_inode_idx(inode, bindex)))
+               lower_inode = unionfs_lower_inode_idx(inode, bindex);
+               if (unlikely(!lower_inode))
                        continue;
 
                if (lower_inode->i_size == DENTPAGE)
@@ -136,7 +137,7 @@ struct unionfs_dir_state *alloc_rdstate(struct inode 
*inode, int bindex)
                sizeof(struct list_head);
 
        rdstate = kmalloc(mallocsize, GFP_KERNEL);
-       if (!rdstate)
+       if (unlikely(!rdstate))
                return NULL;
 
        spin_lock(&UNIONFS_I(inode)->rdlock);
@@ -217,7 +218,7 @@ struct filldir_node *find_filldir_node(struct 
unionfs_dir_state *rdstate,
                         * if the duplicate is in this branch, then the file
                         * system is corrupted.
                         */
-                       if (cursor->bindex == rdstate->bindex) {
+                       if (unlikely(cursor->bindex == rdstate->bindex)) {
                                printk(KERN_DEBUG "unionfs: filldir: possible "
                                       "I/O error: a file is duplicated "
                                       "in the same branch %d: %s\n",
@@ -227,7 +228,7 @@ struct filldir_node *find_filldir_node(struct 
unionfs_dir_state *rdstate,
                }
        }
 
-       if (!found)
+       if (unlikely(!found))
                cursor = NULL;
 
        return cursor;
@@ -249,7 +250,7 @@ int add_filldir_node(struct unionfs_dir_state *rdstate, 
const char *name,
        head = &(rdstate->list[index]);
 
        new = kmem_cache_alloc(unionfs_filldir_cachep, GFP_KERNEL);
-       if (!new) {
+       if (unlikely(!new)) {
                err = -ENOMEM;
                goto out;
        }
@@ -264,7 +265,7 @@ int add_filldir_node(struct unionfs_dir_state *rdstate, 
const char *name,
                new->name = new->iname;
        else {
                new->name = kmalloc(namelen + 1, GFP_KERNEL);
-               if (!new->name) {
+               if (unlikely(!new->name)) {
                        kmem_cache_free(unionfs_filldir_cachep, new);
                        new = NULL;
                        goto out;
_______________________________________________
unionfs-cvs mailing list: http://unionfs.filesystems.org/
[email protected]
http://www.fsl.cs.sunysb.edu/mailman/listinfo/unionfs-cvs

Reply via email to