diff options
author | Al Viro <viro@zeniv.linux.org.uk> | 2016-01-23 14:04:31 -0500 |
---|---|---|
committer | Mike Marshall <hubcap@omnibond.com> | 2016-01-23 15:20:11 -0500 |
commit | 115b93a8595c878759c7c1fdbd95fbbeacbe9168 (patch) | |
tree | 7af85d0290e25d5cd6a25eec67e205233e0ce5a4 /fs/orangefs/orangefs-cache.c | |
parent | b0bc3a7b621cb8d7bcce507f323249a7340f4141 (diff) | |
download | lwn-115b93a8595c878759c7c1fdbd95fbbeacbe9168.tar.gz lwn-115b93a8595c878759c7c1fdbd95fbbeacbe9168.zip |
orangefs: clean up op_alloc()
fold orangefs_op_initialize() in there, don't bother locking something
nobody else could've seen yet, use kmem_cache_zalloc() instead of
explicit memset()...
Signed-off-by: Al Viro <viro@zeniv.linux.org.uk>
Signed-off-by: Mike Marshall <hubcap@omnibond.com>
Diffstat (limited to 'fs/orangefs/orangefs-cache.c')
-rw-r--r-- | fs/orangefs/orangefs-cache.c | 13 |
1 files changed, 9 insertions, 4 deletions
diff --git a/fs/orangefs/orangefs-cache.c b/fs/orangefs/orangefs-cache.c index 90c11a0daf74..e72ac2083ac0 100644 --- a/fs/orangefs/orangefs-cache.c +++ b/fs/orangefs/orangefs-cache.c @@ -111,17 +111,22 @@ struct orangefs_kernel_op_s *op_alloc(__s32 type) { struct orangefs_kernel_op_s *new_op = NULL; - new_op = kmem_cache_alloc(op_cache, ORANGEFS_CACHE_ALLOC_FLAGS); + new_op = kmem_cache_zalloc(op_cache, ORANGEFS_CACHE_ALLOC_FLAGS); if (new_op) { - memset(new_op, 0, sizeof(struct orangefs_kernel_op_s)); - INIT_LIST_HEAD(&new_op->list); spin_lock_init(&new_op->lock); init_waitqueue_head(&new_op->waitq); atomic_set(&new_op->ref_count, 1); - orangefs_op_initialize(new_op); + init_completion(&new_op->done); + + new_op->upcall.type = ORANGEFS_VFS_OP_INVALID; + new_op->downcall.type = ORANGEFS_VFS_OP_INVALID; + new_op->downcall.status = -1; + + new_op->op_state = OP_VFS_STATE_UNKNOWN; + new_op->tag = 0; /* initialize the op specific tag and upcall credentials */ spin_lock(&next_tag_value_lock); |