Linux: Mark our super block as not updating access time
[openafs.git] / src / afs / LINUX / osi_vfsops.c
index 89f5612..6e67e12 100644 (file)
@@ -21,8 +21,9 @@
 #include "afs/sysincludes.h"
 #include "afsincludes.h"
 #include "afs/afs_stats.h"
-#include "h/smp_lock.h"
+#include <linux/smp_lock.h>
 
+#include "osi_compat.h"
 
 struct vcache *afs_globalVp = 0;
 struct vfs *afs_globalVFS = 0;
@@ -66,7 +67,7 @@ afs_get_sb(struct file_system_type *fs_type, int flags,
 #else
 static struct superblock *
 afs_get_sb(struct file_system_type *fs_type, int flags,
-          const char *dev_name, void *data)
+          const char *dev_name, void *data) {
     return get_sb_nodev(fs_type, flags, data, afs_fill_super);
 }
 #endif
@@ -101,6 +102,7 @@ afs_fill_super(struct super_block *sb, void *data, int silent)
    __module_get(THIS_MODULE);
 
     afs_globalVFS = sb;
+    sb->s_flags |= MS_NOATIME;
     sb->s_blocksize = 1024;
     sb->s_blocksize_bits = 10;
     sb->s_magic = AFS_VFSMAGIC;
@@ -108,6 +110,11 @@ afs_fill_super(struct super_block *sb, void *data, int silent)
 #if defined(HAVE_BDI_INIT)
     bdi_init(&afs_backing_dev_info);
 #endif
+#if defined (STRUCT_SUPER_BLOCK_HAS_S_BDI)
+    sb->s_bdi = &afs_backing_dev_info;
+    /* The name specified here will appear in the flushing thread name - flush-afs */
+    bdi_register(&afs_backing_dev_info, NULL, "afs");
+#endif
 #if !defined(AFS_NONFSTRANS)
     sb->s_export_op = &afs_export_ops;
 #endif
@@ -128,6 +135,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();
         module_put(THIS_MODULE);
     }
 
@@ -211,22 +219,14 @@ 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 afs_kmem_cache_t *afs_inode_cachep;
 
 static struct inode *
 afs_alloc_inode(struct super_block *sb)
 {
     struct vcache *vcp;
 
-#if defined(SLAB_KERNEL)
-    vcp = (struct vcache *) kmem_cache_alloc(afs_inode_cachep, SLAB_KERNEL);
-#else
-    vcp = (struct vcache *) kmem_cache_alloc(afs_inode_cachep, GFP_KERNEL);
-#endif
+    vcp = (struct vcache *) kmem_cache_alloc(afs_inode_cachep, KALLOC_TYPE);
     if (!vcp)
        return NULL;
 
@@ -239,41 +239,25 @@ afs_destroy_inode(struct inode *inode)
     kmem_cache_free(afs_inode_cachep, inode);
 }
 
-static void
-#if defined(HAVE_KMEM_CACHE_T)
-init_once(void * foo, kmem_cache_t * cachep, unsigned long flags)
-#elif 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
+void
+init_once(void * foo)
 {
     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));
+    inode_init_once(AFSTOV(vcp));
 }
 
 int
 afs_init_inodecache(void)
 {
-#ifndef SLAB_RECLAIM_ACCOUNT
-#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);
+               sizeof(struct vcache), 0,
+               SLAB_HWCACHE_ALIGN | SLAB_RECLAIM_ACCOUNT, init_once_func, NULL);
 #else
     afs_inode_cachep = kmem_cache_create("afs_inode_cache",
-                                        sizeof(struct vcache),
-                                        0, SLAB_HWCACHE_ALIGN | SLAB_RECLAIM_ACCOUNT,
-                                        init_once);
+               sizeof(struct vcache), 0,
+               SLAB_HWCACHE_ALIGN | SLAB_RECLAIM_ACCOUNT, init_once_func);
 #endif
     if (afs_inode_cachep == NULL)
        return -ENOMEM;