vfs: embed struct filename inside of names_cache allocation if possible
authorJeff Layton <jlayton@redhat.com>
Wed, 10 Oct 2012 20:43:13 +0000 (16:43 -0400)
committerAl Viro <viro@zeniv.linux.org.uk>
Sat, 13 Oct 2012 00:15:10 +0000 (20:15 -0400)
commit7950e3852ab86826b7349a535d2e8b0000340d7f
treeb07bcf28bf0fc3bdc610595287250c3c3a3d974a
parentadb5c2473d3f91526c79db972aafb20a56d3fbb3
vfs: embed struct filename inside of names_cache allocation if possible

In the common case where a name is much smaller than PATH_MAX, an extra
allocation for struct filename is unnecessary. Before allocating a
separate one, try to embed the struct filename inside the buffer first. If
it turns out that that's not long enough, then fall back to allocating a
separate struct filename and redoing the copy.

Signed-off-by: Jeff Layton <jlayton@redhat.com>
Signed-off-by: Al Viro <viro@zeniv.linux.org.uk>
fs/namei.c
include/linux/fs.h