diff options
author | Mike Marshall <hubcap@omnibond.com> | 2016-04-06 11:19:37 -0400 |
---|---|---|
committer | Mike Marshall <hubcap@omnibond.com> | 2016-04-08 14:08:27 -0400 |
commit | a9bb3ba81fba1750139654360cb716ab093103b0 (patch) | |
tree | 98483c708424a6aa36a66a823d6e90fc9102840f | |
parent | 2d09a2ca6a6c66d765458df2653f888c4a481c81 (diff) |
Orangefs: optimize boilerplate code.
Suggested by David Binderman <dcb314@hotmail.com>
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 <hubcap@omnibond.com>
-rw-r--r-- | fs/orangefs/protocol.h | 2 | ||||
-rw-r--r-- | fs/orangefs/xattr.c | 2 |
2 files changed, 2 insertions, 2 deletions
diff --git a/fs/orangefs/protocol.h b/fs/orangefs/protocol.h index 50578a28bd9e..a7f21a3b2d02 100644 --- a/fs/orangefs/protocol.h +++ b/fs/orangefs/protocol.h | |||
@@ -74,8 +74,8 @@ static inline void ORANGEFS_khandle_to(const struct orangefs_khandle *kh, | |||
74 | void *p, int size) | 74 | void *p, int size) |
75 | { | 75 | { |
76 | 76 | ||
77 | memset(p, 0, size); | ||
78 | memcpy(p, kh->u, 16); | 77 | memcpy(p, kh->u, 16); |
78 | memset(p + 16, 0, size - 16); | ||
79 | 79 | ||
80 | } | 80 | } |
81 | 81 | ||
diff --git a/fs/orangefs/xattr.c b/fs/orangefs/xattr.c index 90a8ae77d641..63a6280d8c3a 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, | |||
142 | goto out_release_op; | 142 | goto out_release_op; |
143 | } | 143 | } |
144 | 144 | ||
145 | memset(buffer, 0, size); | ||
146 | memcpy(buffer, new_op->downcall.resp.getxattr.val, length); | 145 | memcpy(buffer, new_op->downcall.resp.getxattr.val, length); |
146 | memset(buffer + length, 0, size - length); | ||
147 | gossip_debug(GOSSIP_XATTR_DEBUG, | 147 | gossip_debug(GOSSIP_XATTR_DEBUG, |
148 | "orangefs_inode_getxattr: inode %pU " | 148 | "orangefs_inode_getxattr: inode %pU " |
149 | "key %s key_sz %d, val_len %d\n", | 149 | "key %s key_sz %d, val_len %d\n", |