ceph: avoid repeatedly computing the size of constant vxattr names

All names defined in the directory and file virtual extended
attribute tables are constant, and the size of each is known at
compile time.  So there's no need to compute their length every
time any file's attribute is listed.

Record the length of each string and use it when needed to determine
the space need to represent them.  In addition, compute the
aggregate size of strings in each table just once at initialization
time.

Signed-off-by: Alex Elder <elder@dreamhost.com>
Signed-off-by: Sage Weil <sage@newdream.net>
This commit is contained in:
Alex Elder
2012-01-23 15:49:28 -06:00
parent aa4066ed7b
commit 3ce6cd1233
3 changed files with 56 additions and 5 deletions

View File

@@ -927,6 +927,7 @@ static int __init init_ceph(void)
if (ret)
goto out;
ceph_xattr_init();
ret = register_filesystem(&ceph_fs_type);
if (ret)
goto out_icache;
@@ -936,6 +937,7 @@ static int __init init_ceph(void)
return 0;
out_icache:
ceph_xattr_exit();
destroy_caches();
out:
return ret;
@@ -945,6 +947,7 @@ static void __exit exit_ceph(void)
{
dout("exit_ceph\n");
unregister_filesystem(&ceph_fs_type);
ceph_xattr_exit();
destroy_caches();
}