diff options
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.patch | 69 |
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 @@ | |||
1 | From e45792228b6a4487d859334c757322554c960397 Mon Sep 17 00:00:00 2001 | ||
2 | From: Trond Myklebust <Trond.Myklebust@netapp.com> | ||
3 | Date: Tue, 7 Feb 2012 14:59:05 -0500 | ||
4 | Subject: [PATCH 014/109] NFSv4: Reduce the footprint of the idmapper | ||
5 | |||
6 | commit d073e9b541e1ac3f52d72c3a153855d9a9ee3278 upstream. | ||
7 | |||
8 | Instead of pre-allocating the storage for all the strings, we can | ||
9 | significantly reduce the size of that table by doing the allocation | ||
10 | when we do the downcall. | ||
11 | |||
12 | Signed-off-by: Trond Myklebust <Trond.Myklebust@netapp.com> | ||
13 | Reviewed-by: Jeff Layton <jlayton@redhat.com> | ||
14 | [bwh: Backported to 3.2: adjust context in nfs_idmap_delete()] | ||
15 | Signed-off-by: Ben Hutchings <ben@decadent.org.uk> | ||
16 | --- | ||
17 | fs/nfs/idmap.c | 16 +++++++++++++--- | ||
18 | 1 files changed, 13 insertions(+), 3 deletions(-) | ||
19 | |||
20 | diff --git a/fs/nfs/idmap.c b/fs/nfs/idmap.c | ||
21 | index 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 | -- | ||
68 | 1.7.7.6 | ||
69 | |||