cur_op = op;
spin_lock(&cur_op->lock);
list_del(&cur_op->list);
- cur_op->op_linger_tmp--;
- /*
- * if there is a trailer, re-add it to
- * the request list.
- */
- if (cur_op->op_linger == 2 &&
- cur_op->op_linger_tmp == 1) {
- if (cur_op->upcall.trailer_size <= 0 ||
- cur_op->upcall.trailer_buf == NULL)
- gossip_err("BUG:trailer_size is %ld and trailer buf is %p\n", (long)cur_op->upcall.trailer_size, cur_op->upcall.trailer_buf);
- /* re-add it to the head of the list */
- list_add(&cur_op->list,
- &pvfs2_request_list);
- }
spin_unlock(&cur_op->lock);
break;
}
"client-core: reading op tag %llu %s\n",
llu(cur_op->tag), get_opname_string(cur_op));
if (op_state_in_progress(cur_op) || op_state_serviced(cur_op)) {
- if (cur_op->op_linger == 1)
- gossip_err("WARNING: Current op already queued...skipping\n");
- } else if (cur_op->op_linger == 1 ||
- (cur_op->op_linger == 2 &&
- cur_op->op_linger_tmp == 0)) {
+ gossip_err("WARNING: Current op already queued...skipping\n");
+ } else {
/*
* atomically move the operation to the
* htable_ops_in_progress
spin_unlock(&cur_op->lock);
- /* 2 cases
- * a) OPs with no trailers
- * b) OPs with trailers, Stage 1
- * Either way push the upcall out
- */
- if (cur_op->op_linger == 1 ||
- (cur_op->op_linger == 2 && cur_op->op_linger_tmp == 1)) {
- len = MAX_ALIGNED_DEV_REQ_UPSIZE;
- if ((size_t) len <= count) {
- ret = copy_to_user(buf,
- &proto_ver,
- sizeof(__s32));
+ /* Push the upcall out */
+ len = MAX_ALIGNED_DEV_REQ_UPSIZE;
+ if ((size_t) len <= count) {
+ ret = copy_to_user(buf,
+ &proto_ver,
+ sizeof(__s32));
+ if (ret == 0) {
+ ret = copy_to_user(buf + sizeof(__s32),
+ &magic,
+ sizeof(__s32));
+ if (ret == 0) {
+ ret = copy_to_user(buf+2 * sizeof(__s32),
+ &cur_op->tag,
+ sizeof(__u64));
if (ret == 0) {
- ret = copy_to_user(buf + sizeof(__s32),
- &magic,
- sizeof(__s32));
- if (ret == 0) {
- ret = copy_to_user(buf+2 * sizeof(__s32),
- &cur_op->tag,
- sizeof(__u64));
- if (ret == 0) {
- ret = copy_to_user(
- buf +
- 2 *
- sizeof(__s32) +
- sizeof(__u64),
- &cur_op->upcall,
- sizeof(struct pvfs2_upcall_s));
- }
- }
- }
-
- if (ret) {
- gossip_err("Failed to copy data to user space\n");
- len = -EFAULT;
+ ret = copy_to_user(
+ buf +
+ 2 *
+ sizeof(__s32) +
+ sizeof(__u64),
+ &cur_op->upcall,
+ sizeof(struct pvfs2_upcall_s));
}
- } else {
- gossip_err
- ("Failed to copy data to user space\n");
- len = -EIO;
- }
- }
- /* Stage 2: Push the trailer out */
- else if (cur_op->op_linger == 2 && cur_op->op_linger_tmp == 0) {
- len = cur_op->upcall.trailer_size;
- if ((size_t) len <= count) {
- ret = copy_to_user(buf,
- cur_op->upcall.trailer_buf,
- len);
- if (ret) {
- gossip_err("Failed to copy trailer to user space\n");
- len = -EFAULT;
- }
- } else {
- gossip_err("Read buffer for trailer is too small (%ld as opposed to %ld)\n",
- (long)count,
- (long)len);
- len = -EIO;
}
+ }
+
+ if (ret) {
+ gossip_err("Failed to copy data to user space\n");
+ len = -EFAULT;
+ }
} else {
- gossip_err("cur_op: %p (op_linger %d), (op_linger_tmp %d), erroneous request list?\n",
- cur_op,
- cur_op->op_linger,
- cur_op->op_linger_tmp);
- len = 0;
+ gossip_err
+ ("Failed to copy data to user space\n");
+ len = -EIO;
}
} else if (file->f_flags & O_NONBLOCK) {
/*
* application reading/writing this device to return until
* the buffers are done being used.
*/
- if ((op->upcall.type == PVFS2_VFS_OP_FILE_IO &&
- op->upcall.req.io.async_vfs_io == PVFS_VFS_SYNC_IO) ||
- op->upcall.type == PVFS2_VFS_OP_FILE_IOX) {
+ if (op->upcall.type == PVFS2_VFS_OP_FILE_IO &&
+ op->upcall.req.io.async_vfs_io == PVFS_VFS_SYNC_IO) {
int timed_out = 0;
DECLARE_WAITQUEUE(wait_entry, current);
return "OP_FSYNC";
else if (type == PVFS2_VFS_OP_FSKEY)
return "OP_FSKEY";
- else if (type == PVFS2_VFS_OP_FILE_IOX)
- return "OP_FILE_IOX";
}
return "OP_UNKNOWN?";
}
-static struct pvfs2_kernel_op_s *op_alloc_common(__s32 op_linger, __s32 type)
+struct pvfs2_kernel_op_s *op_alloc(__s32 type)
{
struct pvfs2_kernel_op_s *new_op = NULL;
new_op->upcall.gid = from_kgid(current_user_ns(),
current_fsgid());
-
- new_op->op_linger = new_op->op_linger_tmp = op_linger;
} else {
gossip_err("op_alloc: kmem_cache_alloc failed!\n");
}
return new_op;
}
-struct pvfs2_kernel_op_s *op_alloc(__s32 type)
-{
- return op_alloc_common(1, type);
-}
-
-struct pvfs2_kernel_op_s *op_alloc_trailer(__s32 type)
-{
- return op_alloc_common(2, type);
-}
-
void op_release(struct pvfs2_kernel_op_s *pvfs2_op)
{
if (pvfs2_op) {
int io_completed;
wait_queue_head_t io_completion_waitq;
- /*
- * upcalls requiring variable length trailers require that this struct
- * be in the request list even after client-core does a read() on the
- * device to dequeue the upcall.
- * if op_linger field goes to 0, we dequeue this op off the list.
- * else we let it stay. What gets passed to the read() is
- * a) if op_linger field is = 1, pvfs2_kernel_op_s itself
- * b) else if = 0, we pass ->upcall.trailer_buf
- * We expect to have only a single upcall trailer buffer,
- * so we expect callers with trailers
- * to set this field to 2 and others to set it to 1.
- */
- __s32 op_linger, op_linger_tmp;
/* VFS aio fields */
/* used by the async I/O code to stash the pvfs2_kiocb_s structure */
int op_cache_initialize(void);
int op_cache_finalize(void);
struct pvfs2_kernel_op_s *op_alloc(__s32 type);
-struct pvfs2_kernel_op_s *op_alloc_trailer(__s32 type);
char *get_opname_string(struct pvfs2_kernel_op_s *new_op);
void op_release(struct pvfs2_kernel_op_s *op);