mirror of
https://github.com/AuxXxilium/linux_dsm_epyc7002.git
synced 2024-12-04 02:16:45 +07:00
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>
This commit is contained in:
parent
2d09a2ca6a
commit
a9bb3ba81f
@ -74,8 +74,8 @@ static inline void ORANGEFS_khandle_to(const struct orangefs_khandle *kh,
|
||||
void *p, int size)
|
||||
{
|
||||
|
||||
memset(p, 0, size);
|
||||
memcpy(p, kh->u, 16);
|
||||
memset(p + 16, 0, size - 16);
|
||||
|
||||
}
|
||||
|
||||
|
@ -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",
|
||||
|
Loading…
Reference in New Issue
Block a user