]> git.karo-electronics.de Git - karo-tx-linux.git/commit
cifs: avoid extra allocation for small cifs.idmap keys
authorJeff Layton <jlayton@redhat.com>
Mon, 5 Nov 2012 11:47:03 +0000 (06:47 -0500)
committerJeff Layton <jlayton@redhat.com>
Mon, 5 Nov 2012 11:47:03 +0000 (06:47 -0500)
commit0389e9de59ad25d5f324cdedbdfed74acba93a3e
tree6eddc7cf91f9dd8a59d547ea466c8363f8eac646
parentef405ab54f8b3ee7e3afba64b2ab2bb1708dd29f
cifs: avoid extra allocation for small cifs.idmap keys

The cifs.idmap keytype always allocates memory to hold the payload from
userspace. In the common case where we're translating a SID to a UID or
GID, we're allocating memory to hold something that's less than or equal
to the size of a pointer.

When the payload is the same size as a pointer or smaller, just store
it in the payload.value union member instead. That saves us an extra
allocation on the sid_to_id upcall.

Note that we have to take extra care to check the datalen when we
go to dereference the .data pointer in the union, but the callers
now check that as a matter of course anyway.

Reviewed-by: Shirish Pargaonkar <shirishpargaonkar@gmail.com>
Signed-off-by: Jeff Layton <jlayton@redhat.com>
fs/cifs/cifsacl.c