From 4554d82bbe2ecec6c79b6a791522358c8855408d Mon Sep 17 00:00:00 2001 From: "Anand V. Avati" Date: Sat, 11 Apr 2009 01:12:10 +0530 Subject: update prototype of writev and readv_cbk to use IOBREF in parameter (step towards elmination of frame->root->{req,rsp}_refs Signed-off-by: Anand V. Avati --- libglusterfs/src/call-stub.c | 34 ++++++++++++++++++---------------- libglusterfs/src/call-stub.h | 10 ++++++---- libglusterfs/src/defaults.c | 12 ++++++++---- libglusterfs/src/defaults.h | 3 ++- libglusterfs/src/xlator.h | 7 +++++-- 5 files changed, 39 insertions(+), 27 deletions(-) diff --git a/libglusterfs/src/call-stub.c b/libglusterfs/src/call-stub.c index 8a090ba8..439fd571 100644 --- a/libglusterfs/src/call-stub.c +++ b/libglusterfs/src/call-stub.c @@ -1078,7 +1078,8 @@ fop_readv_cbk_stub (call_frame_t *frame, int32_t op_errno, struct iovec *vector, int32_t count, - struct stat *stbuf) + struct stat *stbuf, + struct iobref *iobref) { call_stub_t *stub = NULL; @@ -1095,8 +1096,7 @@ fop_readv_cbk_stub (call_frame_t *frame, stub->args.readv_cbk.vector = iov_dup (vector, count); stub->args.readv_cbk.count = count; stub->args.readv_cbk.stbuf = *stbuf; - stub->args.readv_cbk.rsp_refs = - dict_ref (frame->root->rsp_refs); + stub->args.readv_cbk.iobref = iobref_ref (iobref); } out: return stub; @@ -1109,7 +1109,8 @@ fop_writev_stub (call_frame_t *frame, fd_t *fd, struct iovec *vector, int32_t count, - off_t off) + off_t off, + struct iobref *iobref) { call_stub_t *stub = NULL; @@ -1125,9 +1126,7 @@ fop_writev_stub (call_frame_t *frame, stub->args.writev.vector = iov_dup (vector, count); stub->args.writev.count = count; stub->args.writev.off = off; - - if (frame->root->req_refs) - stub->args.writev.req_refs = dict_ref (frame->root->req_refs); + stub->args.writev.iobref = iobref_ref (iobref); out: return stub; } @@ -2406,7 +2405,8 @@ call_resume_wind (call_stub_t *stub) stub->args.writev.fd, stub->args.writev.vector, stub->args.writev.count, - stub->args.writev.off); + stub->args.writev.off, + stub->args.writev.iobref); break; } @@ -2978,7 +2978,8 @@ call_resume_unwind (call_stub_t *stub) stub->args.readv_cbk.op_errno, stub->args.readv_cbk.vector, stub->args.readv_cbk.count, - &stub->args.readv_cbk.stbuf); + &stub->args.readv_cbk.stbuf, + stub->args.readv_cbk.iobref); else stub->args.readv_cbk.fn (stub->frame, stub->frame->cookie, @@ -2987,7 +2988,8 @@ call_resume_unwind (call_stub_t *stub) stub->args.readv_cbk.op_errno, stub->args.readv_cbk.vector, stub->args.readv_cbk.count, - &stub->args.readv_cbk.stbuf); + &stub->args.readv_cbk.stbuf, + stub->args.readv_cbk.iobref); } break; @@ -3644,12 +3646,12 @@ call_stub_destroy_wind (call_stub_t *stub) case GF_FOP_WRITE: { - dict_t *refs = stub->args.writev.req_refs; + struct iobref *iobref = stub->args.writev.iobref; if (stub->args.writev.fd) fd_unref (stub->args.writev.fd); FREE (stub->args.writev.vector); - if (refs) - dict_unref (refs); + if (iobref) + iobref_unref (iobref); break; } @@ -3971,11 +3973,11 @@ call_stub_destroy_unwind (call_stub_t *stub) case GF_FOP_READ: { if (stub->args.readv_cbk.op_ret >= 0) { - dict_t *refs = stub->args.readv_cbk.rsp_refs; + struct iobref *iobref = stub->args.readv_cbk.iobref; FREE (stub->args.readv_cbk.vector); - if (refs) { - dict_unref (refs); + if (iobref) { + iobref_unref (iobref); } } } diff --git a/libglusterfs/src/call-stub.h b/libglusterfs/src/call-stub.h index a970897b..4a8db9c5 100644 --- a/libglusterfs/src/call-stub.h +++ b/libglusterfs/src/call-stub.h @@ -309,7 +309,7 @@ typedef struct { struct iovec *vector; int32_t count; struct stat stbuf; - dict_t *rsp_refs; + struct iobref *iobref; } readv_cbk; /* writev */ @@ -319,7 +319,7 @@ typedef struct { struct iovec *vector; int32_t count; off_t off; - dict_t *req_refs; + struct iobref *iobref; } writev; struct { fop_writev_cbk_t fn; @@ -905,7 +905,8 @@ fop_readv_cbk_stub (call_frame_t *frame, int32_t op_errno, struct iovec *vector, int32_t count, - struct stat *stbuf); + struct stat *stbuf, + struct iobref *iobref); call_stub_t * fop_writev_stub (call_frame_t *frame, @@ -913,7 +914,8 @@ fop_writev_stub (call_frame_t *frame, fd_t *fd, struct iovec *vector, int32_t count, - off_t off); + off_t off, + struct iobref *iobref); call_stub_t * fop_writev_cbk_stub (call_frame_t *frame, diff --git a/libglusterfs/src/defaults.c b/libglusterfs/src/defaults.c index 724f5a79..ca7c34b3 100644 --- a/libglusterfs/src/defaults.c +++ b/libglusterfs/src/defaults.c @@ -641,14 +641,16 @@ default_readv_cbk (call_frame_t *frame, int32_t op_errno, struct iovec *vector, int32_t count, - struct stat *stbuf) + struct stat *stbuf, + struct iobref *iobref) { STACK_UNWIND (frame, op_ret, op_errno, vector, count, - stbuf); + stbuf, + iobref); return 0; } @@ -691,7 +693,8 @@ default_writev (call_frame_t *frame, fd_t *fd, struct iovec *vector, int32_t count, - off_t off) + off_t off, + struct iobref *iobref) { STACK_WIND (frame, default_writev_cbk, @@ -700,7 +703,8 @@ default_writev (call_frame_t *frame, fd, vector, count, - off); + off, + iobref); return 0; } diff --git a/libglusterfs/src/defaults.h b/libglusterfs/src/defaults.h index 98e15c5b..a61bdff7 100644 --- a/libglusterfs/src/defaults.h +++ b/libglusterfs/src/defaults.h @@ -165,7 +165,8 @@ int32_t default_writev (call_frame_t *frame, fd_t *fd, struct iovec *vector, int32_t count, - off_t offset); + off_t offset, + struct iobref *iobref); int32_t default_flush (call_frame_t *frame, xlator_t *this, diff --git a/libglusterfs/src/xlator.h b/libglusterfs/src/xlator.h index fe50c814..654e334e 100644 --- a/libglusterfs/src/xlator.h +++ b/libglusterfs/src/xlator.h @@ -57,6 +57,7 @@ typedef int32_t (*event_notify_fn_t) (xlator_t *this, #include "list.h" #include "gf-dirent.h" #include "stack.h" +#include "iobuf.h" #include "inode.h" #include "fd.h" @@ -290,7 +291,8 @@ typedef int32_t (*fop_readv_cbk_t) (call_frame_t *frame, int32_t op_errno, struct iovec *vector, int32_t count, - struct stat *stbuf); + struct stat *stbuf, + struct iobref *iobref); typedef int32_t (*fop_writev_cbk_t) (call_frame_t *frame, void *cookie, @@ -559,7 +561,8 @@ typedef int32_t (*fop_writev_t) (call_frame_t *frame, fd_t *fd, struct iovec *vector, int32_t count, - off_t offset); + off_t offset, + struct iobref *iobref); typedef int32_t (*fop_flush_t) (call_frame_t *frame, xlator_t *this, -- cgit