Linux: use standard macro for set_nlink configure test
[openafs.git] / src / afs / LINUX / osi_vfsops.c
index 8abe6b1..2fbb349 100644 (file)
@@ -113,7 +113,7 @@ afs_fill_super(struct super_block *sb, void *data, int silent)
 #endif
 
     /* used for inodes backing_dev_info field, also */
-    afs_backing_dev_info = osi_Alloc(sizeof(struct backing_dev_info));
+    afs_backing_dev_info = kzalloc(sizeof(struct backing_dev_info), GFP_NOFS);
 #if defined(HAVE_LINUX_BDI_INIT)
     bdi_init(afs_backing_dev_info);
 #endif
@@ -146,7 +146,7 @@ afs_fill_super(struct super_block *sb, void *data, int silent)
     code = afs_root(sb);
     if (code) {
        afs_globalVFS = NULL;
-       osi_linux_free_inode_pages();
+       afs_FlushAllVCaches();
         module_put(THIS_MODULE);
     }
 
@@ -341,7 +341,6 @@ afs_put_super(struct super_block *sbp)
     afs_globalVFS = 0;
     afs_globalVp = 0;
 
-    osi_linux_free_inode_pages();      /* invalidate and release remaining AFS inodes. */
     afs_shutdown();
     mntput(afs_cacheMnt);
 
@@ -349,7 +348,7 @@ afs_put_super(struct super_block *sbp)
 #if defined(HAVE_LINUX_BDI_INIT)
     bdi_destroy(afs_backing_dev_info);
 #endif
-    osi_Free(afs_backing_dev_info, sizeof(struct backing_dev_info));
+    kfree(afs_backing_dev_info);
     AFS_GUNLOCK();
 
     sbp->s_dev = 0;
@@ -440,7 +439,11 @@ void
 vattr2inode(struct inode *ip, struct vattr *vp)
 {
     ip->i_ino = vp->va_nodeid;
+#ifdef HAVE_LINUX_SET_NLINK
+    set_nlink(ip, vp->va_nlink);
+#else
     ip->i_nlink = vp->va_nlink;
+#endif
     ip->i_blocks = vp->va_blocks;
 #ifdef STRUCT_INODE_HAS_I_BLKBITS
     ip->i_blkbits = AFS_BLKBITS;
@@ -464,27 +467,3 @@ vattr2inode(struct inode *ip, struct vattr *vp)
     ip->i_ctime.tv_sec = vp->va_ctime.tv_sec;
     ip->i_ctime.tv_nsec = 0;
 }
-
-/* osi_linux_free_inode_pages
- *
- * Free all vnodes remaining in the afs hash.  Must be done before
- * shutting down afs and freeing all memory.
- */
-void
-osi_linux_free_inode_pages(void)
-{
-    int i;
-    struct vcache *tvc, *nvc;
-    extern struct vcache *afs_vhashT[VCSIZE];
-
-    for (i = 0; i < VCSIZE; i++) {
-       for (tvc = afs_vhashT[i]; tvc; ) {
-           int slept;
-       
-           nvc = tvc->hnext;
-           if (afs_FlushVCache(tvc, &slept))           /* slept always 0 for linux? */
-               printf("Failed to invalidate all pages on inode 0x%p\n", tvc);
-           tvc = nvc;
-       }
-    }
-}