Linux CM: Files don't need a page
authorSimon Wilkinson <sxw@your-file-system.com>
Sun, 17 Apr 2011 20:41:15 +0000 (21:41 +0100)
committerDerrick Brashear <shadow@dementia.org>
Sun, 5 Jun 2011 14:39:14 +0000 (07:39 -0700)
We were using osi_AllocLargeSpace to allocate our files. This gives
a page to every struct osi_file we create, which seems a little bit
excessive. Just use kmalloc directly instead, and let the kernel's
allocator deal with the slabbing.

Change-Id: I40d32ad0d7090e2b3b60be983d4f441968dc69dc
Reviewed-on: http://gerrit.openafs.org/4750
Reviewed-by: Marc Dionne <marc.c.dionne@gmail.com>
Tested-by: BuildBot <buildbot@rampaginggeek.com>
Reviewed-by: Derrick Brashear <shadow@dementia.org>

src/afs/LINUX/osi_file.c

index 3c20fd9..843ce7a 100644 (file)
@@ -83,8 +83,8 @@ osi_UFSOpen(afs_dcache_id_t *ainode)
        crhold(&afs_osi_cred);  /* don't let it evaporate, since it is static */
        afs_osicred_initialized = 1;
     }
-    afile = (struct osi_file *)osi_AllocLargeSpace(sizeof(struct osi_file));
     AFS_GUNLOCK();
+    afile = kmalloc(sizeof(struct osi_file), GFP_NOFS);
     if (!afile) {
        osi_Panic("osi_UFSOpen: Failed to allocate %d bytes for osi_file.\n",
                  (int)sizeof(struct osi_file));
@@ -149,8 +149,7 @@ osi_UFSClose(struct osi_file *afile)
            filp_close(afile->filp, NULL);
        }
     }
-
-    osi_FreeLargeSpace(afile);
+    kfree(afile);
     return 0;
 }