From 6e7d9a4e77a764e86bcde4e704ec05a3c84f9c11 Mon Sep 17 00:00:00 2001 From: Pranith Kumar K Date: Tue, 24 Mar 2015 12:09:52 +0530 Subject: 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 Reviewed-on: http://review.gluster.org/9981 Tested-by: Gluster Build System Reviewed-by: Dan Lambright --- xlators/cluster/ec/src/ec-dir-write.c | 38 +---------------------------------- 1 file changed, 1 insertion(+), 37 deletions(-) (limited to 'xlators/cluster/ec/src/ec-dir-write.c') 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; -- cgit