提交 115b93a8 编写于 作者: A Al Viro 提交者: Mike Marshall

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: NAl Viro <viro@zeniv.linux.org.uk>
Signed-off-by: NMike Marshall <hubcap@omnibond.com>
上级 b0bc3a7b
...@@ -111,17 +111,22 @@ struct orangefs_kernel_op_s *op_alloc(__s32 type) ...@@ -111,17 +111,22 @@ struct orangefs_kernel_op_s *op_alloc(__s32 type)
{ {
struct orangefs_kernel_op_s *new_op = NULL; 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) { if (new_op) {
memset(new_op, 0, sizeof(struct orangefs_kernel_op_s));
INIT_LIST_HEAD(&new_op->list); INIT_LIST_HEAD(&new_op->list);
spin_lock_init(&new_op->lock); spin_lock_init(&new_op->lock);
init_waitqueue_head(&new_op->waitq); init_waitqueue_head(&new_op->waitq);
atomic_set(&new_op->ref_count, 1); 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 */ /* initialize the op specific tag and upcall credentials */
spin_lock(&next_tag_value_lock); spin_lock(&next_tag_value_lock);
......
...@@ -565,8 +565,6 @@ int orangefs_inode_getattr(struct inode *inode, __u32 mask); ...@@ -565,8 +565,6 @@ int orangefs_inode_getattr(struct inode *inode, __u32 mask);
int orangefs_inode_setattr(struct inode *inode, struct iattr *iattr); int orangefs_inode_setattr(struct inode *inode, struct iattr *iattr);
void orangefs_op_initialize(struct orangefs_kernel_op_s *op);
void orangefs_make_bad_inode(struct inode *inode); void orangefs_make_bad_inode(struct inode *inode);
void orangefs_block_signals(sigset_t *); void orangefs_block_signals(sigset_t *);
......
...@@ -593,22 +593,6 @@ int orangefs_cancel_op_in_progress(__u64 tag) ...@@ -593,22 +593,6 @@ int orangefs_cancel_op_in_progress(__u64 tag)
return ret; return ret;
} }
void orangefs_op_initialize(struct orangefs_kernel_op_s *op)
{
if (op) {
spin_lock(&op->lock);
init_completion(&op->done);
op->upcall.type = ORANGEFS_VFS_OP_INVALID;
op->downcall.type = ORANGEFS_VFS_OP_INVALID;
op->downcall.status = -1;
op->op_state = OP_VFS_STATE_UNKNOWN;
op->tag = 0;
spin_unlock(&op->lock);
}
}
void orangefs_make_bad_inode(struct inode *inode) void orangefs_make_bad_inode(struct inode *inode)
{ {
if (is_root_handle(inode)) { if (is_root_handle(inode)) {
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册