kernel - Adjust devfs, hammer, and puffs to use the new cache_unlink()
authorMatthew Dillon <dillon@apollo.backplane.com>
Fri, 24 Aug 2012 23:29:49 +0000 (16:29 -0700)
committerMatthew Dillon <dillon@apollo.backplane.com>
Fri, 24 Aug 2012 23:29:49 +0000 (16:29 -0700)
* Adjust devfs, hammer, and puffs to use the new cache_unlink() mechanic.

sys/vfs/devfs/devfs_vnops.c
sys/vfs/hammer/hammer_vnops.c
sys/vfs/puffs/puffs_vnops.c

index 31716ad..6a51c94 100644 (file)
@@ -783,9 +783,7 @@ devfs_vop_nrmdir(struct vop_nrmdir_args *ap)
                }
        }
 
-       cache_setunresolved(ap->a_nch);
-       cache_setvp(ap->a_nch, NULL);
-
+       cache_unlink(ap->a_nch);
 out:
        lockmgr(&devfs_lock, LK_RELEASE);
        return error;
@@ -833,9 +831,7 @@ devfs_vop_nremove(struct vop_nremove_args *ap)
                }
        }
 
-       cache_setunresolved(ap->a_nch);
-       cache_setvp(ap->a_nch, NULL);
-
+       cache_unlink(ap->a_nch);
 out:
        lockmgr(&devfs_lock, LK_RELEASE);
        return error;
index 5422aeb..22f49d6 100644 (file)
@@ -3539,8 +3539,10 @@ retry:
                }
                hammer_done_cursor(&cursor);
                if (error == 0) {
-                       cache_setunresolved(nch);
-                       cache_setvp(nch, NULL);
+                       /*
+                        * Tell the namecache that we are now unlinked.
+                        */
+                       cache_unlink(nch);
 
                        /*
                         * NOTE: ip->vp, if non-NULL, cannot be directly
index d6113f2..7504bf5 100644 (file)
@@ -969,10 +969,8 @@ puffs_vnop_remove(struct vop_nremove_args *ap)
  out:
        vput(dvp);
        vn_unlock(vp);
-       if (!error) {
-               cache_setunresolved(nch);
-               cache_setvp(nch, NULL);
-       }
+       if (error == 0)
+               cache_unlink(nch);
        vrele(vp);
        return error;
 }
@@ -1099,10 +1097,8 @@ puffs_vnop_rmdir(struct vop_nrmdir_args *ap)
  out:
        vput(dvp);
        vn_unlock(vp);
-       if (!error) {
-               cache_setunresolved(nch);
-               cache_setvp(nch, NULL);
-       }
+       if (error == 0)
+               cache_unlink(nch);
        vrele(vp);
        return error;
 }