summaryrefslogtreecommitdiffstats
path: root/xlators/cluster/ec
diff options
context:
space:
mode:
authorPranith Kumar K <pkarampu@redhat.com>2015-03-24 12:09:52 +0530
committerVijay Bellur <vbellur@redhat.com>2015-04-06 22:35:07 -0700
commit6e7d9a4e77a764e86bcde4e704ec05a3c84f9c11 (patch)
tree1107ff62bac604d5b05df73281a00e6d1a22cb9a /xlators/cluster/ec
parent0e23ce3fbcf1f138105476cf3b86342268e259d9 (diff)
cluster/ec: Refactor inode-writev
All _cbk() functions in inode-write.c do same things, i.e. store op_ret/op_errno, stat structures if they are available and combine them. Moved this common operation into one function ec_inode_write_cbk() and made all the other _cbk() functions to use this instead. Change-Id: I2387b9f2d9598ced6299a26ea1900e9deb9fadc4 BUG: 1199767 Signed-off-by: Pranith Kumar K <pkarampu@redhat.com> Reviewed-on: http://review.gluster.org/9981 Tested-by: Gluster Build System <jenkins@build.gluster.com> Reviewed-by: Dan Lambright <dlambrig@redhat.com>
Diffstat (limited to 'xlators/cluster/ec')
-rw-r--r--xlators/cluster/ec/src/ec-combine.c54
-rw-r--r--xlators/cluster/ec/src/ec-combine.h3
-rw-r--r--xlators/cluster/ec/src/ec-dir-write.c38
-rw-r--r--xlators/cluster/ec/src/ec-inode-write.c528
4 files changed, 145 insertions, 478 deletions
diff --git a/xlators/cluster/ec/src/ec-combine.c b/xlators/cluster/ec/src/ec-combine.c
index 709da555627..de9a9951179 100644
--- a/xlators/cluster/ec/src/ec-combine.c
+++ b/xlators/cluster/ec/src/ec-combine.c
@@ -38,6 +38,60 @@ struct _ec_dict_combine
int32_t which;
};
+int32_t
+ec_combine_write (ec_fop_data_t *fop, ec_cbk_data_t *dst,
+ ec_cbk_data_t *src)
+{
+ int valid = 0;
+
+ if (!fop || !dst || !src)
+ return 0;
+
+ switch (fop->id) {
+ case GF_FOP_REMOVEXATTR:
+ case GF_FOP_FREMOVEXATTR:
+ case GF_FOP_SETXATTR:
+ case GF_FOP_FSETXATTR:
+ return 1;
+
+ case GF_FOP_SYMLINK:
+ case GF_FOP_LINK:
+ case GF_FOP_CREATE:
+ case GF_FOP_MKNOD:
+ case GF_FOP_MKDIR:
+ valid = 3;
+ break;
+ case GF_FOP_UNLINK:
+ case GF_FOP_RMDIR:
+ case GF_FOP_SETATTR:
+ case GF_FOP_FSETATTR:
+ case GF_FOP_TRUNCATE:
+ case GF_FOP_FTRUNCATE:
+ case GF_FOP_WRITE:
+ case GF_FOP_FALLOCATE:
+ case GF_FOP_DISCARD:
+ case GF_FOP_ZEROFILL:
+ valid = 2;
+ break;
+ case GF_FOP_RENAME:
+ valid = 5;
+ break;
+ default:
+ gf_log_callingfn (fop->xl->name, GF_LOG_WARNING, "Invalid fop "
+ "%d", fop->id);
+ return 0;
+ break;
+ }
+
+ if (!ec_iatt_combine(dst->iatt, src->iatt, valid)) {
+ gf_log(fop->xl->name, GF_LOG_NOTICE, "Mismatching iatt in "
+ "answers of '%s'", gf_fop_list[fop->id]);
+
+ return 0;
+ }
+ return 1;
+}
+
void ec_iatt_time_merge(uint32_t * dst_sec, uint32_t * dst_nsec,
uint32_t src_sec, uint32_t src_nsec)
{
diff --git a/xlators/cluster/ec/src/ec-combine.h b/xlators/cluster/ec/src/ec-combine.h
index 360844ccd71..cae2bb9274f 100644
--- a/xlators/cluster/ec/src/ec-combine.h
+++ b/xlators/cluster/ec/src/ec-combine.h
@@ -31,4 +31,7 @@ int32_t ec_dict_combine(ec_cbk_data_t * cbk, int32_t which);
void ec_combine(ec_cbk_data_t * cbk, ec_combine_f combine);
+int32_t
+ec_combine_write (ec_fop_data_t *fop, ec_cbk_data_t *dst,
+ ec_cbk_data_t *src);
#endif /* __EC_COMBINE_H__ */
diff --git a/xlators/cluster/ec/src/ec-dir-write.c b/xlators/cluster/ec/src/ec-dir-write.c
index 5aa0b400cd6..866f5120bf6 100644
--- a/xlators/cluster/ec/src/ec-dir-write.c
+++ b/xlators/cluster/ec/src/ec-dir-write.c
@@ -17,42 +17,6 @@
#include "ec-method.h"
#include "ec-fops.h"
-int32_t
-ec_combine_dirwrite (ec_fop_data_t *fop, ec_cbk_data_t *dst,
- ec_cbk_data_t *src)
-{
- int valid = 0;
- switch (fop->id) {
- case GF_FOP_SYMLINK:
- case GF_FOP_LINK:
- case GF_FOP_CREATE:
- case GF_FOP_MKNOD:
- case GF_FOP_MKDIR:
- valid = 3;
- break;
- case GF_FOP_UNLINK:
- case GF_FOP_RMDIR:
- valid = 2;
- break;
- case GF_FOP_RENAME:
- valid = 5;
- break;
- default:
- gf_log_callingfn (fop->xl->name, GF_LOG_WARNING, "Invalid fop "
- "%d", fop->id);
- return 0;
- break;
- }
-
- if (!ec_iatt_combine(dst->iatt, src->iatt, valid)) {
- gf_log(fop->xl->name, GF_LOG_NOTICE, "Mismatching iatt in "
- "answers of '%s'", gf_fop_list[fop->id]);
-
- return 0;
- }
- return 1;
-}
-
int
ec_dir_write_cbk (call_frame_t *frame, xlator_t *this,
void *cookie, int op_ret, int op_errno,
@@ -104,7 +68,7 @@ ec_dir_write_cbk (call_frame_t *frame, xlator_t *this,
out:
if (cbk)
- ec_combine (cbk, ec_combine_dirwrite);
+ ec_combine (cbk, ec_combine_write);
if (fop)
ec_complete (fop);
return 0;
diff --git a/xlators/cluster/ec/src/ec-inode-write.c b/xlators/cluster/ec/src/ec-inode-write.c
index ffca89c5f14..785579d12e8 100644
--- a/xlators/cluster/ec/src/ec-inode-write.c
+++ b/xlators/cluster/ec/src/ec-inode-write.c
@@ -17,52 +17,60 @@
#include "ec-method.h"
#include "ec-fops.h"
-/* FOP: removexattr */
-
-int32_t ec_removexattr_cbk(call_frame_t * frame, void * cookie,
- xlator_t * this, int32_t op_ret, int32_t op_errno,
- dict_t * xdata)
+int
+ec_inode_write_cbk (call_frame_t *frame, xlator_t *this, void *cookie,
+ int op_ret, int op_errno, struct iatt *prestat,
+ struct iatt *poststat, dict_t *xdata)
{
- ec_fop_data_t * fop = NULL;
- ec_cbk_data_t * cbk = NULL;
- int32_t idx = (int32_t)(uintptr_t)cookie;
+ ec_fop_data_t *fop = NULL;
+ ec_cbk_data_t *cbk = NULL;
+ int i = 0;
+ int idx = 0;
- VALIDATE_OR_GOTO(this, out);
- GF_VALIDATE_OR_GOTO(this->name, frame, out);
- GF_VALIDATE_OR_GOTO(this->name, frame->local, out);
- GF_VALIDATE_OR_GOTO(this->name, this->private, out);
+ VALIDATE_OR_GOTO (this, out);
+ GF_VALIDATE_OR_GOTO (this->name, frame, out);
+ GF_VALIDATE_OR_GOTO (this->name, frame->local, out);
+ GF_VALIDATE_OR_GOTO (this->name, this->private, out);
- fop = frame->local;
+ fop = frame->local;
+ idx = (int32_t)(uintptr_t) cookie;
- ec_trace("CBK", fop, "idx=%d, frame=%p, op_ret=%d, op_errno=%d", idx,
- frame, op_ret, op_errno);
+ ec_trace("CBK", fop, "idx=%d, frame=%p, op_ret=%d, op_errno=%d", idx,
+ frame, op_ret, op_errno);
- cbk = ec_cbk_data_allocate(frame, this, fop, GF_FOP_REMOVEXATTR, idx,
- op_ret, op_errno);
- if (cbk != NULL)
- {
- if (xdata != NULL)
- {
- cbk->xdata = dict_ref(xdata);
- if (cbk->xdata == NULL)
- {
- gf_log(this->name, GF_LOG_ERROR, "Failed to reference a "
- "dictionary.");
+ cbk = ec_cbk_data_allocate (frame, this, fop, fop->id, idx, op_ret,
+ op_errno);
+ if (!cbk)
+ goto out;
+ if (op_ret < 0)
goto out;
- }
- }
- ec_combine(cbk, NULL);
- }
+ if (xdata)
+ cbk->xdata = dict_ref (xdata);
+
+ if (prestat)
+ cbk->iatt[i++] = *prestat;
+
+ if (poststat)
+ cbk->iatt[i++] = *poststat;
out:
- if (fop != NULL)
- {
- ec_complete(fop);
- }
+ if (cbk)
+ ec_combine (cbk, ec_combine_write);
- return 0;
+ if (fop)
+ ec_complete (fop);
+ return 0;
+}
+/* FOP: removexattr */
+
+int32_t ec_removexattr_cbk (call_frame_t *frame, void *cookie,
+ xlator_t *this, int32_t op_ret, int32_t op_errno,
+ dict_t *xdata)
+{
+ return ec_inode_write_cbk (frame, this, cookie, op_ret, op_errno,
+ NULL, NULL, xdata);
}
void ec_wind_removexattr(ec_t * ec, ec_fop_data_t * fop, int32_t idx)
@@ -262,50 +270,12 @@ out:
/* FOP: fremovexattr */
-int32_t ec_fremovexattr_cbk(call_frame_t * frame, void * cookie,
- xlator_t * this, int32_t op_ret, int32_t op_errno,
- dict_t * xdata)
+int32_t ec_fremovexattr_cbk (call_frame_t *frame, void *cookie,
+ xlator_t *this, int32_t op_ret, int32_t op_errno,
+ dict_t *xdata)
{
- ec_fop_data_t * fop = NULL;
- ec_cbk_data_t * cbk = NULL;
- int32_t idx = (int32_t)(uintptr_t)cookie;
-
- VALIDATE_OR_GOTO(this, out);
- GF_VALIDATE_OR_GOTO(this->name, frame, out);
- GF_VALIDATE_OR_GOTO(this->name, frame->local, out);
- GF_VALIDATE_OR_GOTO(this->name, this->private, out);
-
- fop = frame->local;
-
- ec_trace("CBK", fop, "idx=%d, frame=%p, op_ret=%d, op_errno=%d", idx,
- frame, op_ret, op_errno);
-
- cbk = ec_cbk_data_allocate(frame, this, fop, GF_FOP_FREMOVEXATTR, idx,
- op_ret, op_errno);
- if (cbk != NULL)
- {
- if (xdata != NULL)
- {
- cbk->xdata = dict_ref(xdata);
- if (cbk->xdata == NULL)
- {
- gf_log(this->name, GF_LOG_ERROR, "Failed to reference a "
- "dictionary.");
-
- goto out;
- }
- }
-
- ec_combine(cbk, NULL);
- }
-
-out:
- if (fop != NULL)
- {
- ec_complete(fop);
- }
-
- return 0;
+ return ec_inode_write_cbk (frame, this, cookie, op_ret, op_errno,
+ NULL, NULL, xdata);
}
void ec_wind_fremovexattr(ec_t * ec, ec_fop_data_t * fop, int32_t idx)
@@ -388,76 +358,13 @@ out:
/* FOP: setattr */
-int32_t ec_combine_setattr(ec_fop_data_t * fop, ec_cbk_data_t * dst,
- ec_cbk_data_t * src)
-{
- if (!ec_iatt_combine(dst->iatt, src->iatt, 2))
- {
- gf_log(fop->xl->name, GF_LOG_NOTICE, "Mismatching iatt in "
- "answers of 'GF_FOP_SETATTR'");
-
- return 0;
- }
-
- return 1;
-}
-
-int32_t ec_setattr_cbk(call_frame_t * frame, void * cookie, xlator_t * this,
- int32_t op_ret, int32_t op_errno,
- struct iatt * preop_stbuf, struct iatt * postop_stbuf,
- dict_t * xdata)
+int32_t ec_setattr_cbk (call_frame_t *frame, void *cookie, xlator_t *this,
+ int32_t op_ret, int32_t op_errno,
+ struct iatt *prestat, struct iatt *poststat,
+ dict_t *xdata)
{
- ec_fop_data_t * fop = NULL;
- ec_cbk_data_t * cbk = NULL;
- int32_t idx = (int32_t)(uintptr_t)cookie;
-
- VALIDATE_OR_GOTO(this, out);
- GF_VALIDATE_OR_GOTO(this->name, frame, out);
- GF_VALIDATE_OR_GOTO(this->name, frame->local, out);
- GF_VALIDATE_OR_GOTO(this->name, this->private, out);
-
- fop = frame->local;
-
- ec_trace("CBK", fop, "idx=%d, frame=%p, op_ret=%d, op_errno=%d", idx,
- frame, op_ret, op_errno);
-
- cbk = ec_cbk_data_allocate(frame, this, fop, GF_FOP_SETATTR, idx, op_ret,
- op_errno);
- if (cbk != NULL)
- {
- if (op_ret >= 0)
- {
- if (preop_stbuf != NULL)
- {
- cbk->iatt[0] = *preop_stbuf;
- }
- if (postop_stbuf != NULL)
- {
- cbk->iatt[1] = *postop_stbuf;
- }
- }
- if (xdata != NULL)
- {
- cbk->xdata = dict_ref(xdata);
- if (cbk->xdata == NULL)
- {
- gf_log(this->name, GF_LOG_ERROR, "Failed to reference a "
- "dictionary.");
-
- goto out;
- }
- }
-
- ec_combine(cbk, ec_combine_setattr);
- }
-
-out:
- if (fop != NULL)
- {
- ec_complete(fop);
- }
-
- return 0;
+ return ec_inode_write_cbk (frame, this, cookie, op_ret, op_errno,
+ prestat, poststat, xdata);
}
void ec_wind_setattr(ec_t * ec, ec_fop_data_t * fop, int32_t idx)
@@ -672,62 +579,13 @@ out:
/* FOP: fsetattr */
-int32_t ec_fsetattr_cbk(call_frame_t * frame, void * cookie, xlator_t * this,
- int32_t op_ret, int32_t op_errno,
- struct iatt * preop_stbuf, struct iatt * postop_stbuf,
- dict_t * xdata)
+int32_t ec_fsetattr_cbk (call_frame_t *frame, void *cookie, xlator_t *this,
+ int32_t op_ret, int32_t op_errno,
+ struct iatt *prestat, struct iatt *poststat,
+ dict_t *xdata)
{
- ec_fop_data_t * fop = NULL;
- ec_cbk_data_t * cbk = NULL;
- int32_t idx = (int32_t)(uintptr_t)cookie;
-
- VALIDATE_OR_GOTO(this, out);
- GF_VALIDATE_OR_GOTO(this->name, frame, out);
- GF_VALIDATE_OR_GOTO(this->name, frame->local, out);
- GF_VALIDATE_OR_GOTO(this->name, this->private, out);
-
- fop = frame->local;
-
- ec_trace("CBK", fop, "idx=%d, frame=%p, op_ret=%d, op_errno=%d", idx,
- frame, op_ret, op_errno);
-
- cbk = ec_cbk_data_allocate(frame, this, fop, GF_FOP_FSETATTR, idx, op_ret,
- op_errno);
- if (cbk != NULL)
- {
- if (op_ret >= 0)
- {
- if (preop_stbuf != NULL)
- {
- cbk->iatt[0] = *preop_stbuf;
- }
- if (postop_stbuf != NULL)
- {
- cbk->iatt[1] = *postop_stbuf;
- }
- }
- if (xdata != NULL)
- {
- cbk->xdata = dict_ref(xdata);
- if (cbk->xdata == NULL)
- {
- gf_log(this->name, GF_LOG_ERROR, "Failed to reference a "
- "dictionary.");
-
- goto out;
- }
- }
-
- ec_combine(cbk, ec_combine_setattr);
- }
-
-out:
- if (fop != NULL)
- {
- ec_complete(fop);
- }
-
- return 0;
+ return ec_inode_write_cbk (frame, this, cookie, op_ret, op_errno,
+ prestat, poststat, xdata);
}
void ec_wind_fsetattr(ec_t * ec, ec_fop_data_t * fop, int32_t idx)
@@ -808,49 +666,11 @@ out:
/* FOP: setxattr */
-int32_t ec_setxattr_cbk(call_frame_t * frame, void * cookie, xlator_t * this,
- int32_t op_ret, int32_t op_errno, dict_t * xdata)
+int32_t ec_setxattr_cbk (call_frame_t *frame, void *cookie, xlator_t *this,
+ int32_t op_ret, int32_t op_errno, dict_t *xdata)
{
- ec_fop_data_t * fop = NULL;
- ec_cbk_data_t * cbk = NULL;
- int32_t idx = (int32_t)(uintptr_t)cookie;
-
- VALIDATE_OR_GOTO(this, out);
- GF_VALIDATE_OR_GOTO(this->name, frame, out);
- GF_VALIDATE_OR_GOTO(this->name, frame->local, out);
- GF_VALIDATE_OR_GOTO(this->name, this->private, out);
-
- fop = frame->local;
-
- ec_trace("CBK", fop, "idx=%d, frame=%p, op_ret=%d, op_errno=%d", idx,
- frame, op_ret, op_errno);
-
- cbk = ec_cbk_data_allocate(frame, this, fop, GF_FOP_SETXATTR, idx, op_ret,
- op_errno);
- if (cbk != NULL)
- {
- if (xdata != NULL)
- {
- cbk->xdata = dict_ref(xdata);
- if (cbk->xdata == NULL)
- {
- gf_log(this->name, GF_LOG_ERROR, "Failed to reference a "
- "dictionary.");
-
- goto out;
- }
- }
-
- ec_combine(cbk, NULL);
- }
-
-out:
- if (fop != NULL)
- {
- ec_complete(fop);
- }
-
- return 0;
+ return ec_inode_write_cbk (frame, this, cookie, op_ret, op_errno,
+ NULL, NULL, xdata);
}
void ec_wind_setxattr(ec_t * ec, ec_fop_data_t * fop, int32_t idx)
@@ -1268,75 +1088,12 @@ int32_t ec_truncate_clean(ec_fop_data_t * fop)
}
}
-int32_t ec_combine_truncate(ec_fop_data_t * fop, ec_cbk_data_t * dst,
- ec_cbk_data_t * src)
-{
- if (!ec_iatt_combine(dst->iatt, src->iatt, 2))
- {
- gf_log(fop->xl->name, GF_LOG_NOTICE, "Mismatching iatt in "
- "answers of 'GF_FOP_TRUNCATE'");
-
- return 0;
- }
-
- return 1;
-}
-
-int32_t ec_truncate_cbk(call_frame_t * frame, void * cookie, xlator_t * this,
- int32_t op_ret, int32_t op_errno, struct iatt * prebuf,
- struct iatt * postbuf, dict_t * xdata)
+int32_t ec_truncate_cbk (call_frame_t *frame, void *cookie, xlator_t *this,
+ int32_t op_ret, int32_t op_errno, struct iatt *prestat,
+ struct iatt *poststat, dict_t *xdata)
{
- ec_fop_data_t * fop = NULL;
- ec_cbk_data_t * cbk = NULL;
- int32_t idx = (int32_t)(uintptr_t)cookie;
-
- VALIDATE_OR_GOTO(this, out);
- GF_VALIDATE_OR_GOTO(this->name, frame, out);
- GF_VALIDATE_OR_GOTO(this->name, frame->local, out);
- GF_VALIDATE_OR_GOTO(this->name, this->private, out);
-
- fop = frame->local;
-
- ec_trace("CBK", fop, "idx=%d, frame=%p, op_ret=%d, op_errno=%d", idx,
- frame, op_ret, op_errno);
-
- cbk = ec_cbk_data_allocate(frame, this, fop, GF_FOP_TRUNCATE, idx, op_ret,
- op_errno);
- if (cbk != NULL)
- {
- if (op_ret >= 0)
- {
- if (prebuf != NULL)
- {
- cbk->iatt[0] = *prebuf;
- }
- if (postbuf != NULL)
- {
- cbk->iatt[1] = *postbuf;
- }
- }
- if (xdata != NULL)
- {
- cbk->xdata = dict_ref(xdata);
- if (cbk->xdata == NULL)
- {
- gf_log(this->name, GF_LOG_ERROR, "Failed to reference a "
- "dictionary.");
-
- goto out;
- }
- }
-
- ec_combine(cbk, ec_combine_truncate);
- }
-
-out:
- if (fop != NULL)
- {
- ec_complete(fop);
- }
-
- return 0;
+ return ec_inode_write_cbk (frame, this, cookie, op_ret, op_errno,
+ prestat, poststat, xdata);
}
void ec_wind_truncate(ec_t * ec, ec_fop_data_t * fop, int32_t idx)
@@ -1560,62 +1317,13 @@ out:
/* FOP: ftruncate */
-int32_t ec_ftruncate_cbk(call_frame_t * frame, void * cookie, xlator_t * this,
- int32_t op_ret, int32_t op_errno,
- struct iatt * prebuf, struct iatt * postbuf,
- dict_t * xdata)
+int32_t ec_ftruncate_cbk (call_frame_t *frame, void *cookie, xlator_t *this,
+ int32_t op_ret, int32_t op_errno,
+ struct iatt *prestat, struct iatt *poststat,
+ dict_t *xdata)
{
- ec_fop_data_t * fop = NULL;
- ec_cbk_data_t * cbk = NULL;
- int32_t idx = (int32_t)(uintptr_t)cookie;
-
- VALIDATE_OR_GOTO(this, out);
- GF_VALIDATE_OR_GOTO(this->name, frame, out);
- GF_VALIDATE_OR_GOTO(this->name, frame->local, out);
- GF_VALIDATE_OR_GOTO(this->name, this->private, out);
-
- fop = frame->local;
-
- ec_trace("CBK", fop, "idx=%d, frame=%p, op_ret=%d, op_errno=%d", idx,
- frame, op_ret, op_errno);
-
- cbk = ec_cbk_data_allocate(frame, this, fop, GF_FOP_FTRUNCATE, idx, op_ret,
- op_errno);
- if (cbk != NULL)
- {
- if (op_ret >= 0)
- {
- if (prebuf != NULL)
- {
- cbk->iatt[0] = *prebuf;
- }
- if (postbuf != NULL)
- {
- cbk->iatt[1] = *postbuf;
- }
- }
- if (xdata != NULL)
- {
- cbk->xdata = dict_ref(xdata);
- if (cbk->xdata == NULL)
- {
- gf_log(this->name, GF_LOG_ERROR, "Failed to reference a "
- "dictionary.");
-
- goto out;
- }
- }
-
- ec_combine(cbk, ec_combine_truncate);
- }
-
-out:
- if (fop != NULL)
- {
- ec_complete(fop);
- }
-
- return 0;
+ return ec_inode_write_cbk (frame, this, cookie, op_ret, op_errno,
+ prestat, poststat, xdata);
}
void ec_wind_ftruncate(ec_t * ec, ec_fop_data_t * fop, int32_t idx)
@@ -1865,82 +1573,20 @@ out:
ec_fop_set_error(fop, EIO);
}
-int32_t ec_combine_writev(ec_fop_data_t * fop, ec_cbk_data_t * dst,
- ec_cbk_data_t * src)
+int32_t ec_writev_cbk (call_frame_t *frame, void *cookie, xlator_t *this,
+ int32_t op_ret, int32_t op_errno, struct iatt *prestat,
+ struct iatt *poststat, dict_t *xdata)
{
- if (!ec_iatt_combine(dst->iatt, src->iatt, 2))
- {
- gf_log(fop->xl->name, GF_LOG_NOTICE, "Mismatching iatt in "
- "answers of 'GF_FOP_WRITE'");
-
- return 0;
- }
-
- return 1;
-}
-
-int32_t ec_writev_cbk(call_frame_t * frame, void * cookie, xlator_t * this,
- int32_t op_ret, int32_t op_errno, struct iatt * prebuf,
- struct iatt * postbuf, dict_t * xdata)
-{
- ec_fop_data_t * fop = NULL;
- ec_cbk_data_t * cbk = NULL;
- ec_t * ec = this->private;
- int32_t idx = (int32_t)(uintptr_t)cookie;
-
- VALIDATE_OR_GOTO(this, out);
- GF_VALIDATE_OR_GOTO(this->name, frame, out);
- GF_VALIDATE_OR_GOTO(this->name, frame->local, out);
- GF_VALIDATE_OR_GOTO(this->name, this->private, out);
-
- fop = frame->local;
-
- ec_trace("CBK", fop, "idx=%d, frame=%p, op_ret=%d, op_errno=%d", idx,
- frame, op_ret, op_errno);
-
- cbk = ec_cbk_data_allocate(frame, this, fop, GF_FOP_WRITE, idx, op_ret,
- op_errno);
- if (cbk != NULL)
- {
- if (op_ret >= 0)
- {
- if (prebuf != NULL)
- {
- cbk->iatt[0] = *prebuf;
- }
- if (postbuf != NULL)
- {
- cbk->iatt[1] = *postbuf;
- }
- }
- if (xdata != NULL)
- {
- cbk->xdata = dict_ref(xdata);
- if (cbk->xdata == NULL)
- {
- gf_log(this->name, GF_LOG_ERROR, "Failed to reference a "
- "dictionary.");
-
- goto out;
- }
- }
-
- if ((op_ret > 0) && ((op_ret % ec->fragment_size) != 0))
- {
- cbk->op_ret = -1;
- cbk->op_errno = EIO;
+ ec_t *ec = NULL;
+ if (this && this->private) {
+ ec = this->private;
+ if ((op_ret > 0) && ((op_ret % ec->fragment_size) != 0)) {
+ op_ret = -1;
+ op_errno = EIO;
+ }
}
-
- ec_combine(cbk, ec_combine_writev);
- }
-
-out:
- if (fop != NULL)
- {
- ec_complete(fop);
- }
-
- return 0;
+ return ec_inode_write_cbk (frame, this, cookie, op_ret, op_errno,
+ prestat, poststat, xdata);
}
void ec_wind_writev(ec_t * ec, ec_fop_data_t * fop, int32_t idx)