diff options
author | Anand Avati <avati@redhat.com> | 2013-02-15 17:14:50 -0800 |
---|---|---|
committer | Vijay Bellur <vbellur@redhat.com> | 2013-09-05 06:27:05 -0700 |
commit | 285de41f1105e18fa7bcf309fe43fb9e6d08508e (patch) | |
tree | 58c889fbdfce0656548de05daff64718e5c4f014 /xlators/performance | |
parent | 9032b1dfbbf8d0bbf8731959ad1048f7bbc530a3 (diff) |
call-stub: internal refactor
- re-structure members of call_stub_t with new simpler layout
- easier to inspect call_stub_t contents in gdb now
- fix a bunch of double unrefs and double frees in cbk stub
- change all STACK_UNWIND to STACK_UNWIND_STRICT and thereby fixed
a lot of bad params
- implement new API call_unwind_error() which can even be called on
fop_XXX_stub(), and not necessarily fop_XXX_cbk_stub()
Change-Id: Idf979f14d46256af0afb9658915cc79de157b2d7
BUG: 846240
Signed-off-by: Anand Avati <avati@redhat.com>
Reviewed-on: http://review.gluster.org/4520
Tested-by: Gluster Build System <jenkins@build.gluster.com>
Reviewed-by: Jeff Darcy <jdarcy@redhat.com>
Reviewed-on: http://review.gluster.org/5820
Reviewed-by: Raghavendra Bhat <raghavendra@redhat.com>
Diffstat (limited to 'xlators/performance')
-rw-r--r-- | xlators/performance/write-behind/src/write-behind.c | 80 |
1 files changed, 40 insertions, 40 deletions
diff --git a/xlators/performance/write-behind/src/write-behind.c b/xlators/performance/write-behind/src/write-behind.c index 31cb74ed8c9..1e769008955 100644 --- a/xlators/performance/write-behind/src/write-behind.c +++ b/xlators/performance/write-behind/src/write-behind.c @@ -482,8 +482,8 @@ wb_enqueue_common (wb_inode_t *wb_inode, call_stub_t *stub, int tempted) req->ordering.tempted = tempted; if (stub->fop == GF_FOP_WRITE) { - req->write_size = iov_length (stub->args.writev.vector, - stub->args.writev.count); + req->write_size = iov_length (stub->args.vector, + stub->args.count); /* req->write_size can change as we collapse small writes. But the window needs to grow @@ -499,7 +499,7 @@ wb_enqueue_common (wb_inode_t *wb_inode, call_stub_t *stub, int tempted) req->op_ret = req->write_size; req->op_errno = 0; - if (stub->args.writev.fd->flags & O_APPEND) + if (stub->args.fd->flags & O_APPEND) req->ordering.append = 1; } @@ -507,28 +507,28 @@ wb_enqueue_common (wb_inode_t *wb_inode, call_stub_t *stub, int tempted) switch (stub->fop) { case GF_FOP_WRITE: - req->ordering.off = stub->args.writev.off; + req->ordering.off = stub->args.offset; req->ordering.size = req->write_size; - req->fd = fd_ref (stub->args.writev.fd); + req->fd = fd_ref (stub->args.fd); break; case GF_FOP_READ: - req->ordering.off = stub->args.readv.off; - req->ordering.size = stub->args.readv.size; + req->ordering.off = stub->args.offset; + req->ordering.size = stub->args.size; - req->fd = fd_ref (stub->args.readv.fd); + req->fd = fd_ref (stub->args.fd); break; case GF_FOP_TRUNCATE: - req->ordering.off = stub->args.truncate.off; + req->ordering.off = stub->args.offset; req->ordering.size = 0; /* till infinity */ break; case GF_FOP_FTRUNCATE: - req->ordering.off = stub->args.ftruncate.off; + req->ordering.off = stub->args.offset; req->ordering.size = 0; /* till infinity */ - req->fd = fd_ref (stub->args.ftruncate.fd); + req->fd = fd_ref (stub->args.fd); break; default: @@ -742,9 +742,9 @@ wb_fulfill_cbk (call_frame_t *frame, void *cookie, xlator_t *this, #define WB_IOV_LOAD(vec, cnt, req, head) do { \ - memcpy (&vec[cnt], req->stub->args.writev.vector, \ - (req->stub->args.writev.count * sizeof(vec[0]))); \ - cnt += req->stub->args.writev.count; \ + memcpy (&vec[cnt], req->stub->args.vector, \ + (req->stub->args.count * sizeof(vec[0]))); \ + cnt += req->stub->args.count; \ head->total_size += req->write_size; \ } while (0) @@ -770,8 +770,8 @@ wb_fulfill_head (wb_inode_t *wb_inode, wb_request_t *head) list_for_each_entry (req, &head->winds, winds) { WB_IOV_LOAD (vector, count, req, head); - iobref_merge (head->stub->args.writev.iobref, - req->stub->args.writev.iobref); + iobref_merge (head->stub->args.iobref, + req->stub->args.iobref); } if (wb_fd_err (head->fd, this, NULL)) { @@ -795,9 +795,9 @@ wb_fulfill_head (wb_inode_t *wb_inode, wb_request_t *head) STACK_WIND (frame, wb_fulfill_cbk, FIRST_CHILD (frame->this), FIRST_CHILD (frame->this)->fops->writev, head->fd, vector, count, - head->stub->args.writev.off, - head->stub->args.writev.flags, - head->stub->args.writev.iobref, NULL); + head->stub->args.offset, + head->stub->args.flags, + head->stub->args.iobref, NULL); return; err: @@ -816,7 +816,7 @@ err: if (head) \ wb_fulfill_head (wb_inode, head); \ head = req; \ - expected_offset = req->stub->args.writev.off + \ + expected_offset = req->stub->args.offset + \ req->write_size; \ curr_aggregate = 0; \ vector_count = 0; \ @@ -854,7 +854,7 @@ wb_fulfill (wb_inode_t *wb_inode, list_head_t *liabilities) continue; } - if (expected_offset != req->stub->args.writev.off) { + if (expected_offset != req->stub->args.offset) { NEXT_HEAD (head, req); continue; } @@ -864,7 +864,7 @@ wb_fulfill (wb_inode_t *wb_inode, list_head_t *liabilities) continue; } - if (vector_count + req->stub->args.writev.count > + if (vector_count + req->stub->args.count > MAX_VECTOR_COUNT) { NEXT_HEAD (head, req); continue; @@ -872,7 +872,7 @@ wb_fulfill (wb_inode_t *wb_inode, list_head_t *liabilities) list_add_tail (&req->winds, &head->winds); curr_aggregate += req->write_size; - vector_count += req->stub->args.writev.count; + vector_count += req->stub->args.count; } if (head) @@ -946,10 +946,10 @@ __wb_collapse_small_writes (wb_request_t *holder, wb_request_t *req) size_t req_len = 0; if (!holder->iobref) { - holder_len = iov_length (holder->stub->args.writev.vector, - holder->stub->args.writev.count); - req_len = iov_length (req->stub->args.writev.vector, - req->stub->args.writev.count); + holder_len = iov_length (holder->stub->args.vector, + holder->stub->args.count); + req_len = iov_length (req->stub->args.vector, + req->stub->args.count); required_size = max ((THIS->ctx->page_size), (holder_len + req_len)); @@ -975,25 +975,25 @@ __wb_collapse_small_writes (wb_request_t *holder, wb_request_t *req) goto out; } - iov_unload (iobuf->ptr, holder->stub->args.writev.vector, - holder->stub->args.writev.count); - holder->stub->args.writev.vector[0].iov_base = iobuf->ptr; - holder->stub->args.writev.count = 1; + iov_unload (iobuf->ptr, holder->stub->args.vector, + holder->stub->args.count); + holder->stub->args.vector[0].iov_base = iobuf->ptr; + holder->stub->args.count = 1; - iobref_unref (holder->stub->args.writev.iobref); - holder->stub->args.writev.iobref = iobref; + iobref_unref (holder->stub->args.iobref); + holder->stub->args.iobref = iobref; iobuf_unref (iobuf); holder->iobref = iobref_ref (iobref); } - ptr = holder->stub->args.writev.vector[0].iov_base + holder->write_size; + ptr = holder->stub->args.vector[0].iov_base + holder->write_size; - iov_unload (ptr, req->stub->args.writev.vector, - req->stub->args.writev.count); + iov_unload (ptr, req->stub->args.vector, + req->stub->args.count); - holder->stub->args.writev.vector[0].iov_len += req->write_size; + holder->stub->args.vector[0].iov_len += req->write_size; holder->write_size += req->write_size; holder->ordering.size += req->write_size; @@ -1043,10 +1043,10 @@ __wb_preprocess_winds (wb_inode_t *wb_inode) continue; } - offset_expected = holder->stub->args.writev.off + offset_expected = holder->stub->args.offset + holder->write_size; - if (req->stub->args.writev.off != offset_expected) { + if (req->stub->args.offset != offset_expected) { holder->ordering.go = 1; holder = req; continue; @@ -1839,7 +1839,7 @@ __wb_dump_requests (struct list_head *head, char *prefix) req->write_size); gf_proc_dump_write ("offset", "%"PRId64, - req->stub->args.writev.off); + req->stub->args.offset); flag = req->ordering.lied; gf_proc_dump_write ("lied", "%d", flag); |