From a9bb3ba81fba1750139654360cb716ab093103b0 Mon Sep 17 00:00:00 2001 From: Mike Marshall Date: Wed, 6 Apr 2016 11:19:37 -0400 Subject: Orangefs: optimize boilerplate code. Suggested by David Binderman The former can potentially be a performance win over the latter. memcpy(d, s, len); memset(d+len, c, size-len); memset(d, c, size); memcpy(d, s, len); Signed-off-by: Mike Marshall --- fs/orangefs/xattr.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'fs/orangefs/xattr.c') diff --git a/fs/orangefs/xattr.c b/fs/orangefs/xattr.c index 90a8ae7..63a6280d 100644 --- a/fs/orangefs/xattr.c +++ b/fs/orangefs/xattr.c @@ -142,8 +142,8 @@ ssize_t orangefs_inode_getxattr(struct inode *inode, const char *prefix, goto out_release_op; } - memset(buffer, 0, size); memcpy(buffer, new_op->downcall.resp.getxattr.val, length); + memset(buffer + length, 0, size - length); gossip_debug(GOSSIP_XATTR_DEBUG, "orangefs_inode_getxattr: inode %pU " "key %s key_sz %d, val_len %d\n", -- cgit v1.1