summaryrefslogtreecommitdiffstats
path: root/recipes-kernel/linux/linux-ti33x-psp-3.2/3.2.24/0014-NFSv4-Reduce-the-footprint-of-the-idmapper.patch
diff options
context:
space:
mode:
Diffstat (limited to 'recipes-kernel/linux/linux-ti33x-psp-3.2/3.2.24/0014-NFSv4-Reduce-the-footprint-of-the-idmapper.patch')
-rw-r--r--recipes-kernel/linux/linux-ti33x-psp-3.2/3.2.24/0014-NFSv4-Reduce-the-footprint-of-the-idmapper.patch69
1 files changed, 69 insertions, 0 deletions
diff --git a/recipes-kernel/linux/linux-ti33x-psp-3.2/3.2.24/0014-NFSv4-Reduce-the-footprint-of-the-idmapper.patch b/recipes-kernel/linux/linux-ti33x-psp-3.2/3.2.24/0014-NFSv4-Reduce-the-footprint-of-the-idmapper.patch
new file mode 100644
index 00000000..008fc3ed
--- /dev/null
+++ b/recipes-kernel/linux/linux-ti33x-psp-3.2/3.2.24/0014-NFSv4-Reduce-the-footprint-of-the-idmapper.patch
@@ -0,0 +1,69 @@
1From e45792228b6a4487d859334c757322554c960397 Mon Sep 17 00:00:00 2001
2From: Trond Myklebust <Trond.Myklebust@netapp.com>
3Date: Tue, 7 Feb 2012 14:59:05 -0500
4Subject: [PATCH 014/109] NFSv4: Reduce the footprint of the idmapper
5
6commit d073e9b541e1ac3f52d72c3a153855d9a9ee3278 upstream.
7
8Instead of pre-allocating the storage for all the strings, we can
9significantly reduce the size of that table by doing the allocation
10when we do the downcall.
11
12Signed-off-by: Trond Myklebust <Trond.Myklebust@netapp.com>
13Reviewed-by: Jeff Layton <jlayton@redhat.com>
14[bwh: Backported to 3.2: adjust context in nfs_idmap_delete()]
15Signed-off-by: Ben Hutchings <ben@decadent.org.uk>
16---
17 fs/nfs/idmap.c | 16 +++++++++++++---
18 1 files changed, 13 insertions(+), 3 deletions(-)
19
20diff --git a/fs/nfs/idmap.c b/fs/nfs/idmap.c
21index 47d1c6f..b8c41c3 100644
22--- a/fs/nfs/idmap.c
23+++ b/fs/nfs/idmap.c
24@@ -318,7 +318,7 @@ struct idmap_hashent {
25 unsigned long ih_expires;
26 __u32 ih_id;
27 size_t ih_namelen;
28- char ih_name[IDMAP_NAMESZ];
29+ const char *ih_name;
30 };
31
32 struct idmap_hashtable {
33@@ -382,11 +382,16 @@ void
34 nfs_idmap_delete(struct nfs_client *clp)
35 {
36 struct idmap *idmap = clp->cl_idmap;
37+ int i;
38
39 if (!idmap)
40 return;
41 rpc_unlink(idmap->idmap_dentry);
42 clp->cl_idmap = NULL;
43+ for (i = 0; i < ARRAY_SIZE(idmap->idmap_user_hash.h_entries); i++)
44+ kfree(idmap->idmap_user_hash.h_entries[i].ih_name);
45+ for (i = 0; i < ARRAY_SIZE(idmap->idmap_group_hash.h_entries); i++)
46+ kfree(idmap->idmap_group_hash.h_entries[i].ih_name);
47 kfree(idmap);
48 }
49
50@@ -449,9 +454,14 @@ static void
51 idmap_update_entry(struct idmap_hashent *he, const char *name,
52 size_t namelen, __u32 id)
53 {
54+ char *str = kmalloc(namelen + 1, GFP_KERNEL);
55+ if (str == NULL)
56+ return;
57+ kfree(he->ih_name);
58 he->ih_id = id;
59- memcpy(he->ih_name, name, namelen);
60- he->ih_name[namelen] = '\0';
61+ memcpy(str, name, namelen);
62+ str[namelen] = '\0';
63+ he->ih_name = str;
64 he->ih_namelen = namelen;
65 he->ih_expires = jiffies + nfs_idmap_cache_timeout;
66 }
67--
681.7.7.6
69