orangefs: implement xattr cache

This uses the same timeout as the getattr cache.  This substantially
increases performance when writing files with smaller buffer sizes.

When writing, the size is (often) changed, which causes a call to
notify_change which calls security_inode_need_killpriv which needs a
getxattr.  Caching it reduces traffic to the server.

Signed-off-by: Martin Brandenburg <martin@omnibond.com>
Signed-off-by: Mike Marshall <hubcap@omnibond.com>
This commit is contained in:
Martin Brandenburg
2017-12-12 13:46:30 -05:00
committed by Mike Marshall
parent 37624b5854
commit fc2e2e9c43
4 changed files with 127 additions and 1 deletions

View File

@@ -10,6 +10,7 @@
#include "orangefs-bufmap.h"
#include <linux/parser.h>
#include <linux/hashtable.h>
/* a cache for orangefs-inode objects (i.e. orangefs inode private data) */
static struct kmem_cache *orangefs_inode_cache;
@@ -128,6 +129,15 @@ static void orangefs_i_callback(struct rcu_head *head)
{
struct inode *inode = container_of(head, struct inode, i_rcu);
struct orangefs_inode_s *orangefs_inode = ORANGEFS_I(inode);
struct orangefs_cached_xattr *cx;
struct hlist_node *tmp;
int i;
hash_for_each_safe(orangefs_inode->xattr_cache, i, tmp, cx, node) {
hlist_del(&cx->node);
kfree(cx);
}
kmem_cache_free(orangefs_inode_cache, orangefs_inode);
}