DEVEL15-linux-disable-readahad-20081108
[openafs.git] / src / afs / LINUX / osi_vfsops.c
index 64699d1..92dc336 100644 (file)
@@ -39,7 +39,7 @@ struct vfsmount *afs_cacheMnt;
 int afs_was_mounted = 0;       /* Used to force reload if mount/unmount/mount */
 
 extern struct super_operations afs_sops;
-#if defined(AFS_LINUX26_ENV)
+#if defined(AFS_LINUX26_ENV) && !defined(AFS_NONFSTRANS)
 extern struct export_operations afs_export_ops;
 #endif
 extern afs_rwlock_t afs_xvcache;
@@ -146,9 +146,12 @@ afs_read_super(struct super_block *sb, void *data, int silent)
     sb->s_blocksize_bits = 10;
     sb->s_magic = AFS_VFSMAGIC;
     sb->s_op = &afs_sops;      /* Super block (vfs) ops */
-#if defined(AFS_LINUX26_ENV)
+#if defined(AFS_LINUX26_ENV) && !defined(AFS_NONFSTRANS)
     sb->s_export_op = &afs_export_ops;
 #endif
+#if defined(HAVE_BDI_INIT)
+    bdi_init(&afs_backing_dev_info);
+#endif
 #if defined(MAX_NON_LFS)
 #ifdef AFS_64BIT_CLIENT
 #if !defined(MAX_LFS_FILESIZE)
@@ -269,7 +272,11 @@ afs_notify_change(struct dentry *dp, struct iattr *iattrp)
 
 
 #if defined(STRUCT_SUPER_HAS_ALLOC_INODE)
+#if defined(HAVE_KMEM_CACHE_T)
 static kmem_cache_t *afs_inode_cachep;
+#else
+struct kmem_cache *afs_inode_cachep;
+#endif
 
 static struct inode *
 afs_alloc_inode(struct super_block *sb)
@@ -294,12 +301,22 @@ afs_destroy_inode(struct inode *inode)
 }
 
 static void
+#if defined(HAVE_KMEM_CACHE_T)
 init_once(void * foo, kmem_cache_t * cachep, unsigned long flags)
+#else
+#if defined(KMEM_CACHE_INIT)
+init_once(struct kmem_cache * cachep, void * foo)
+#else
+init_once(void * foo, struct kmem_cache * cachep, unsigned long flags)
+#endif
+#endif
 {
     struct vcache *vcp = (struct vcache *) foo;
 
+#if defined(SLAB_CTOR_VERIFY)
     if ((flags & (SLAB_CTOR_VERIFY|SLAB_CTOR_CONSTRUCTOR)) ==
        SLAB_CTOR_CONSTRUCTOR)
+#endif
        inode_init_once(AFSTOV(vcp));
 }
 
@@ -310,10 +327,17 @@ afs_init_inodecache(void)
 #define SLAB_RECLAIM_ACCOUNT 0
 #endif
 
+#if defined(KMEM_CACHE_TAKES_DTOR)
     afs_inode_cachep = kmem_cache_create("afs_inode_cache",
                                         sizeof(struct vcache),
                                         0, SLAB_HWCACHE_ALIGN | SLAB_RECLAIM_ACCOUNT,
                                         init_once, NULL);
+#else
+    afs_inode_cachep = kmem_cache_create("afs_inode_cache",
+                                        sizeof(struct vcache),
+                                        0, SLAB_HWCACHE_ALIGN | SLAB_RECLAIM_ACCOUNT,
+                                        init_once);
+#endif
     if (afs_inode_cachep == NULL)
        return -ENOMEM;
     return 0;
@@ -379,6 +403,9 @@ afs_put_super(struct super_block *sbp)
 #endif
 
     osi_linux_verify_alloced_memory();
+#if defined(HAVE_BDI_INIT)
+    bdi_destroy(&afs_backing_dev_info);
+#endif
     AFS_GUNLOCK();
 
     sbp->s_dev = 0;
@@ -455,6 +482,7 @@ struct super_operations afs_sops = {
 #endif
 };
 
+
 /************** Support routines ************************/
 
 /* vattr_setattr
@@ -520,6 +548,7 @@ vattr2inode(struct inode *ip, struct vattr *vp)
     ip->i_size = vp->va_size;
 #if defined(AFS_LINUX26_ENV)
     ip->i_atime.tv_sec = vp->va_atime.tv_sec;
+    ip->i_atime.tv_nsec = 0;
     ip->i_mtime.tv_sec = vp->va_mtime.tv_sec;
     /* Set the mtime nanoseconds to the sysname generation number.
      * This convinces NFS clients that all directories have changed
@@ -527,6 +556,7 @@ vattr2inode(struct inode *ip, struct vattr *vp)
      */
     ip->i_mtime.tv_nsec = afs_sysnamegen;
     ip->i_ctime.tv_sec = vp->va_ctime.tv_sec;
+    ip->i_ctime.tv_nsec = 0;
 #else
     ip->i_atime = vp->va_atime.tv_sec;
     ip->i_mtime = vp->va_mtime.tv_sec;