diff options
author | Andrzej Hajda <a.hajda@samsung.com> | 2015-02-13 17:36:41 -0500 |
---|---|---|
committer | Linus Torvalds <torvalds@linux-foundation.org> | 2015-02-14 00:21:36 -0500 |
commit | fcc139ae227b97bd81352e9102d8e79498d1e930 (patch) | |
tree | ba99b24ed6f6a39193e12dc35e10406b0332c6f3 /fs/namespace.c | |
parent | 3dec16ea38afce38ceb49c8938901318797a08c4 (diff) |
fs/namespace: convert devname allocation to kstrdup_const
VFS frequently performs duplication of strings located in read-only memory
section. Replacing kstrdup by kstrdup_const allows to avoid such
operations.
Signed-off-by: Andrzej Hajda <a.hajda@samsung.com>
Cc: Marek Szyprowski <m.szyprowski@samsung.com>
Cc: Kyungmin Park <kyungmin.park@samsung.com>
Cc: Mike Turquette <mturquette@linaro.org>
Cc: Alexander Viro <viro@zeniv.linux.org.uk>
Cc: Christoph Lameter <cl@linux.com>
Cc: Pekka Enberg <penberg@kernel.org>
Cc: David Rientjes <rientjes@google.com>
Cc: Joonsoo Kim <iamjoonsoo.kim@lge.com>
Cc: Tejun Heo <tj@kernel.org>
Cc: Greg KH <greg@kroah.com>
Cc: Geert Uytterhoeven <geert@linux-m68k.org>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
Diffstat (limited to 'fs/namespace.c')
-rw-r--r-- | fs/namespace.c | 6 |
1 files changed, 3 insertions, 3 deletions
diff --git a/fs/namespace.c b/fs/namespace.c index cd1e9681a0cf..6dae553dd69c 100644 --- a/fs/namespace.c +++ b/fs/namespace.c | |||
@@ -201,7 +201,7 @@ static struct mount *alloc_vfsmnt(const char *name) | |||
201 | goto out_free_cache; | 201 | goto out_free_cache; |
202 | 202 | ||
203 | if (name) { | 203 | if (name) { |
204 | mnt->mnt_devname = kstrdup(name, GFP_KERNEL); | 204 | mnt->mnt_devname = kstrdup_const(name, GFP_KERNEL); |
205 | if (!mnt->mnt_devname) | 205 | if (!mnt->mnt_devname) |
206 | goto out_free_id; | 206 | goto out_free_id; |
207 | } | 207 | } |
@@ -234,7 +234,7 @@ static struct mount *alloc_vfsmnt(const char *name) | |||
234 | 234 | ||
235 | #ifdef CONFIG_SMP | 235 | #ifdef CONFIG_SMP |
236 | out_free_devname: | 236 | out_free_devname: |
237 | kfree(mnt->mnt_devname); | 237 | kfree_const(mnt->mnt_devname); |
238 | #endif | 238 | #endif |
239 | out_free_id: | 239 | out_free_id: |
240 | mnt_free_id(mnt); | 240 | mnt_free_id(mnt); |
@@ -568,7 +568,7 @@ int sb_prepare_remount_readonly(struct super_block *sb) | |||
568 | 568 | ||
569 | static void free_vfsmnt(struct mount *mnt) | 569 | static void free_vfsmnt(struct mount *mnt) |
570 | { | 570 | { |
571 | kfree(mnt->mnt_devname); | 571 | kfree_const(mnt->mnt_devname); |
572 | #ifdef CONFIG_SMP | 572 | #ifdef CONFIG_SMP |
573 | free_percpu(mnt->mnt_pcp); | 573 | free_percpu(mnt->mnt_pcp); |
574 | #endif | 574 | #endif |