diff options
Diffstat (limited to 'xlators/cluster/ec/src/ec-inode-read.c')
-rw-r--r-- | xlators/cluster/ec/src/ec-inode-read.c | 181 |
1 files changed, 118 insertions, 63 deletions
diff --git a/xlators/cluster/ec/src/ec-inode-read.c b/xlators/cluster/ec/src/ec-inode-read.c index ef2170f8924..bca8ecf44ec 100644 --- a/xlators/cluster/ec/src/ec-inode-read.c +++ b/xlators/cluster/ec/src/ec-inode-read.c @@ -16,6 +16,7 @@ #include "ec-combine.h" #include "ec-method.h" #include "ec-fops.h" +#include "ec-messages.h" /* FOP: access */ @@ -84,8 +85,10 @@ int32_t ec_manager_access(ec_fop_data_t * fop, int32_t state) return EC_STATE_END; default: - gf_log(fop->xl->name, GF_LOG_ERROR, "Unhandled state %d for %s", - state, ec_fop_name(fop->id)); + gf_msg (fop->xl->name, GF_LOG_ERROR, 0, + EC_MSG_UNHANDLED_STATE, + "Unhandled state %d for %s", + state, ec_fop_name(fop->id)); return EC_STATE_END; } @@ -99,7 +102,7 @@ void ec_access(call_frame_t * frame, xlator_t * this, uintptr_t target, ec_fop_data_t * fop = NULL; int32_t error = EIO; - gf_log("ec", GF_LOG_TRACE, "EC(ACCESS) %p", frame); + gf_msg_trace ("ec", 0, "EC(ACCESS) %p", frame); VALIDATE_OR_GOTO(this, out); GF_VALIDATE_OR_GOTO(this->name, frame, out); @@ -119,7 +122,9 @@ void ec_access(call_frame_t * frame, xlator_t * this, uintptr_t target, { if (loc_copy(&fop->loc[0], loc) != 0) { - gf_log(this->name, GF_LOG_ERROR, "Failed to copy a location."); + gf_msg (this->name, GF_LOG_ERROR, 0, + EC_MSG_LOC_COPY_FAIL, + "Failed to copy a location."); goto out; } @@ -129,8 +134,10 @@ void ec_access(call_frame_t * frame, xlator_t * this, uintptr_t target, fop->xdata = dict_ref(xdata); if (fop->xdata == NULL) { - gf_log(this->name, GF_LOG_ERROR, "Failed to reference a " - "dictionary."); + gf_msg (this->name, GF_LOG_ERROR, 0, + EC_MSG_DICT_REF_FAIL, + "Failed to reference a " + "dictionary."); goto out; } @@ -156,7 +163,8 @@ int32_t ec_combine_getxattr(ec_fop_data_t * fop, ec_cbk_data_t * dst, { if (!ec_dict_compare(dst->dict, src->dict)) { - gf_log(fop->xl->name, GF_LOG_NOTICE, "Mismatching dictionary in " + gf_msg (fop->xl->name, GF_LOG_NOTICE, 0, + EC_MSG_DICT_MISMATCH, "Mismatching dictionary in " "answers of 'GF_FOP_GETXATTR'"); return 0; @@ -194,8 +202,10 @@ int32_t ec_getxattr_cbk(call_frame_t * frame, void * cookie, xlator_t * this, cbk->dict = dict_ref(dict); if (cbk->dict == NULL) { - gf_log(this->name, GF_LOG_ERROR, "Failed to reference a " - "dictionary."); + gf_msg (this->name, GF_LOG_ERROR, 0, + EC_MSG_DICT_REF_FAIL, + "Failed to reference a " + "dictionary."); goto out; } @@ -206,8 +216,10 @@ int32_t ec_getxattr_cbk(call_frame_t * frame, void * cookie, xlator_t * this, cbk->xdata = dict_ref(xdata); if (cbk->xdata == NULL) { - gf_log(this->name, GF_LOG_ERROR, "Failed to reference a " - "dictionary."); + gf_msg (this->name, GF_LOG_ERROR, 0, + EC_MSG_DICT_REF_FAIL, + "Failed to reference a " + "dictionary."); goto out; } @@ -357,8 +369,10 @@ int32_t ec_manager_getxattr(ec_fop_data_t * fop, int32_t state) return EC_STATE_END; default: - gf_log(fop->xl->name, GF_LOG_ERROR, "Unhandled state %d for %s", - state, ec_fop_name(fop->id)); + gf_msg (fop->xl->name, GF_LOG_ERROR, 0, + EC_MSG_UNHANDLED_STATE, + "Unhandled state %d for %s", + state, ec_fop_name(fop->id)); return EC_STATE_END; } @@ -426,7 +440,7 @@ ec_getxattr (call_frame_t *frame, xlator_t *this, uintptr_t target, ec_fop_data_t * fop = NULL; int32_t error = EIO; - gf_log("ec", GF_LOG_TRACE, "EC(GETXATTR) %p", frame); + gf_msg_trace ("ec", 0, "EC(GETXATTR) %p", frame); VALIDATE_OR_GOTO(this, out); GF_VALIDATE_OR_GOTO(this->name, frame, out); @@ -453,7 +467,9 @@ ec_getxattr (call_frame_t *frame, xlator_t *this, uintptr_t target, { if (loc_copy(&fop->loc[0], loc) != 0) { - gf_log(this->name, GF_LOG_ERROR, "Failed to copy a location."); + gf_msg (this->name, GF_LOG_ERROR, 0, + EC_MSG_LOC_COPY_FAIL, + "Failed to copy a location."); goto out; } @@ -463,7 +479,9 @@ ec_getxattr (call_frame_t *frame, xlator_t *this, uintptr_t target, fop->str[0] = gf_strdup(name); if (fop->str[0] == NULL) { - gf_log(this->name, GF_LOG_ERROR, "Failed to duplicate a string."); + gf_msg (this->name, GF_LOG_ERROR, ENOMEM, + EC_MSG_NO_MEMORY, + "Failed to duplicate a string."); goto out; } @@ -473,8 +491,10 @@ ec_getxattr (call_frame_t *frame, xlator_t *this, uintptr_t target, fop->xdata = dict_ref(xdata); if (fop->xdata == NULL) { - gf_log(this->name, GF_LOG_ERROR, "Failed to reference a " - "dictionary."); + gf_msg (this->name, GF_LOG_ERROR, 0, + EC_MSG_DICT_REF_FAIL, + "Failed to reference a " + "dictionary."); goto out; } @@ -521,8 +541,10 @@ int32_t ec_fgetxattr_cbk(call_frame_t * frame, void * cookie, xlator_t * this, cbk->dict = dict_ref(dict); if (cbk->dict == NULL) { - gf_log(this->name, GF_LOG_ERROR, "Failed to reference a " - "dictionary."); + gf_msg (this->name, GF_LOG_ERROR, 0, + EC_MSG_DICT_REF_FAIL, + "Failed to reference a " + "dictionary."); goto out; } @@ -533,8 +555,10 @@ int32_t ec_fgetxattr_cbk(call_frame_t * frame, void * cookie, xlator_t * this, cbk->xdata = dict_ref(xdata); if (cbk->xdata == NULL) { - gf_log(this->name, GF_LOG_ERROR, "Failed to reference a " - "dictionary."); + gf_msg (this->name, GF_LOG_ERROR, 0, + EC_MSG_DICT_REF_FAIL, + "Failed to reference a " + "dictionary."); goto out; } @@ -571,7 +595,7 @@ ec_fgetxattr (call_frame_t *frame, xlator_t *this, uintptr_t target, ec_fop_data_t * fop = NULL; int32_t error = EIO; - gf_log("ec", GF_LOG_TRACE, "EC(FGETXATTR) %p", frame); + gf_msg_trace ("ec", 0, "EC(FGETXATTR) %p", frame); VALIDATE_OR_GOTO(this, out); GF_VALIDATE_OR_GOTO(this->name, frame, out); @@ -593,8 +617,10 @@ ec_fgetxattr (call_frame_t *frame, xlator_t *this, uintptr_t target, fop->fd = fd_ref(fd); if (fop->fd == NULL) { - gf_log(this->name, GF_LOG_ERROR, "Failed to reference a " - "file descriptor."); + gf_msg (this->name, GF_LOG_ERROR, 0, + EC_MSG_FILE_DESC_REF_FAIL, + "Failed to reference a " + "file descriptor."); goto out; } @@ -604,7 +630,8 @@ ec_fgetxattr (call_frame_t *frame, xlator_t *this, uintptr_t target, fop->str[0] = gf_strdup(name); if (fop->str[0] == NULL) { - gf_log(this->name, GF_LOG_ERROR, "Failed to duplicate a string."); + gf_msg (this->name, GF_LOG_ERROR, ENOMEM, + EC_MSG_NO_MEMORY, "Failed to duplicate a string."); goto out; } @@ -614,7 +641,8 @@ ec_fgetxattr (call_frame_t *frame, xlator_t *this, uintptr_t target, fop->xdata = dict_ref(xdata); if (fop->xdata == NULL) { - gf_log(this->name, GF_LOG_ERROR, "Failed to reference a " + gf_msg (this->name, GF_LOG_ERROR, 0, + EC_MSG_DICT_REF_FAIL, "Failed to reference a " "dictionary."); goto out; @@ -638,7 +666,8 @@ int32_t ec_combine_open(ec_fop_data_t * fop, ec_cbk_data_t * dst, { if (dst->fd != src->fd) { - gf_log(fop->xl->name, GF_LOG_NOTICE, "Mismatching fd in answers " + gf_msg (fop->xl->name, GF_LOG_NOTICE, 0, + EC_MSG_FD_MISMATCH, "Mismatching fd in answers " "of 'GF_FOP_OPEN': %p <-> %p", dst->fd, src->fd); @@ -677,7 +706,8 @@ int32_t ec_open_cbk(call_frame_t * frame, void * cookie, xlator_t * this, cbk->fd = fd_ref(fd); if (cbk->fd == NULL) { - gf_log(this->name, GF_LOG_ERROR, "Failed to reference a " + gf_msg (this->name, GF_LOG_ERROR, 0, + EC_MSG_FILE_DESC_REF_FAIL, "Failed to reference a " "file descriptor."); goto out; @@ -689,7 +719,8 @@ int32_t ec_open_cbk(call_frame_t * frame, void * cookie, xlator_t * this, cbk->xdata = dict_ref(xdata); if (cbk->xdata == NULL) { - gf_log(this->name, GF_LOG_ERROR, "Failed to reference a " + gf_msg (this->name, GF_LOG_ERROR, 0, + EC_MSG_DICT_REF_FAIL, "Failed to reference a " "dictionary."); goto out; @@ -855,8 +886,9 @@ int32_t ec_manager_open(ec_fop_data_t * fop, int32_t state) return EC_STATE_END; default: - gf_log(fop->xl->name, GF_LOG_ERROR, "Unhandled state %d for %s", - state, ec_fop_name(fop->id)); + gf_msg (fop->xl->name, GF_LOG_ERROR, 0, + EC_MSG_UNHANDLED_STATE, "Unhandled state %d for %s", + state, ec_fop_name(fop->id)); return EC_STATE_END; } @@ -870,7 +902,7 @@ void ec_open(call_frame_t * frame, xlator_t * this, uintptr_t target, ec_fop_data_t * fop = NULL; int32_t error = EIO; - gf_log("ec", GF_LOG_TRACE, "EC(OPEN) %p", frame); + gf_msg_trace ("ec", 0, "EC(OPEN) %p", frame); VALIDATE_OR_GOTO(this, out); GF_VALIDATE_OR_GOTO(this->name, frame, out); @@ -890,7 +922,8 @@ void ec_open(call_frame_t * frame, xlator_t * this, uintptr_t target, { if (loc_copy(&fop->loc[0], loc) != 0) { - gf_log(this->name, GF_LOG_ERROR, "Failed to copy a location."); + gf_msg (this->name, GF_LOG_ERROR, 0, + EC_MSG_LOC_COPY_FAIL, "Failed to copy a location."); goto out; } @@ -900,7 +933,8 @@ void ec_open(call_frame_t * frame, xlator_t * this, uintptr_t target, fop->fd = fd_ref(fd); if (fop->fd == NULL) { - gf_log(this->name, GF_LOG_ERROR, "Failed to reference a " + gf_msg (this->name, GF_LOG_ERROR, 0, + EC_MSG_FILE_DESC_REF_FAIL, "Failed to reference a " "file descriptor."); goto out; @@ -911,7 +945,8 @@ void ec_open(call_frame_t * frame, xlator_t * this, uintptr_t target, fop->xdata = dict_ref(xdata); if (fop->xdata == NULL) { - gf_log(this->name, GF_LOG_ERROR, "Failed to reference a " + gf_msg (this->name, GF_LOG_ERROR, 0, + EC_MSG_DICT_REF_FAIL, "Failed to reference a " "dictionary."); goto out; @@ -937,7 +972,8 @@ int32_t ec_combine_readlink(ec_fop_data_t * fop, ec_cbk_data_t * dst, ec_cbk_data_t * src) { if (!ec_iatt_combine(fop, dst->iatt, src->iatt, 1)) { - gf_log(fop->xl->name, GF_LOG_NOTICE, "Mismatching iatt in " + gf_msg (fop->xl->name, GF_LOG_NOTICE, 0, + EC_MSG_IATT_MISMATCH, "Mismatching iatt in " "answers of 'GF_FOP_READLINK'"); return 0; @@ -1017,8 +1053,9 @@ int32_t ec_manager_readlink(ec_fop_data_t * fop, int32_t state) return EC_STATE_END; default: - gf_log(fop->xl->name, GF_LOG_ERROR, "Unhandled state %d for %s", - state, ec_fop_name(fop->id)); + gf_msg (fop->xl->name, GF_LOG_ERROR, 0, + EC_MSG_UNHANDLED_STATE, "Unhandled state %d for %s", + state, ec_fop_name(fop->id)); return EC_STATE_END; } @@ -1032,7 +1069,7 @@ void ec_readlink(call_frame_t * frame, xlator_t * this, uintptr_t target, ec_fop_data_t * fop = NULL; int32_t error = EIO; - gf_log("ec", GF_LOG_TRACE, "EC(READLINK) %p", frame); + gf_msg_trace ("ec", 0, "EC(READLINK) %p", frame); VALIDATE_OR_GOTO(this, out); GF_VALIDATE_OR_GOTO(this->name, frame, out); @@ -1052,7 +1089,8 @@ void ec_readlink(call_frame_t * frame, xlator_t * this, uintptr_t target, { if (loc_copy(&fop->loc[0], loc) != 0) { - gf_log(this->name, GF_LOG_ERROR, "Failed to copy a location."); + gf_msg (this->name, GF_LOG_ERROR, 0, + EC_MSG_LOC_COPY_FAIL, "Failed to copy a location."); goto out; } @@ -1062,7 +1100,8 @@ void ec_readlink(call_frame_t * frame, xlator_t * this, uintptr_t target, fop->xdata = dict_ref(xdata); if (fop->xdata == NULL) { - gf_log(this->name, GF_LOG_ERROR, "Failed to reference a " + gf_msg (this->name, GF_LOG_ERROR, 0, + EC_MSG_DICT_REF_FAIL, "Failed to reference a " "dictionary."); goto out; @@ -1203,14 +1242,16 @@ int32_t ec_combine_readv(ec_fop_data_t * fop, ec_cbk_data_t * dst, { if (!ec_vector_compare(dst->vector, dst->int32, src->vector, src->int32)) { - gf_log(fop->xl->name, GF_LOG_NOTICE, "Mismatching vector in " + gf_msg (fop->xl->name, GF_LOG_NOTICE, 0, + EC_MSG_VECTOR_MISMATCH, "Mismatching vector in " "answers of 'GF_FOP_READ'"); return 0; } if (!ec_iatt_combine(fop, dst->iatt, src->iatt, 1)) { - gf_log(fop->xl->name, GF_LOG_NOTICE, "Mismatching iatt in " + gf_msg (fop->xl->name, GF_LOG_NOTICE, 0, + EC_MSG_IATT_MISMATCH, "Mismatching iatt in " "answers of 'GF_FOP_READ'"); return 0; @@ -1252,7 +1293,8 @@ int32_t ec_readv_cbk(call_frame_t * frame, void * cookie, xlator_t * this, cbk->vector = iov_dup(vector, count); if (cbk->vector == NULL) { - gf_log(this->name, GF_LOG_ERROR, "Failed to duplicate a " + gf_msg (this->name, GF_LOG_ERROR, ENOMEM, + EC_MSG_NO_MEMORY, "Failed to duplicate a " "vector list."); goto out; @@ -1268,7 +1310,8 @@ int32_t ec_readv_cbk(call_frame_t * frame, void * cookie, xlator_t * this, cbk->buffers = iobref_ref(iobref); if (cbk->buffers == NULL) { - gf_log(this->name, GF_LOG_ERROR, "Failed to reference a " + gf_msg (this->name, GF_LOG_ERROR, 0, + EC_MSG_BUF_REF_FAIL, "Failed to reference a " "buffer."); goto out; @@ -1280,7 +1323,8 @@ int32_t ec_readv_cbk(call_frame_t * frame, void * cookie, xlator_t * this, cbk->xdata = dict_ref(xdata); if (cbk->xdata == NULL) { - gf_log(this->name, GF_LOG_ERROR, "Failed to reference a " + gf_msg (this->name, GF_LOG_ERROR, 0, + EC_MSG_DICT_REF_FAIL, "Failed to reference a " "dictionary."); goto out; @@ -1415,8 +1459,9 @@ int32_t ec_manager_readv(ec_fop_data_t * fop, int32_t state) return EC_STATE_END; default: - gf_log(fop->xl->name, GF_LOG_ERROR, "Unhandled state %d for %s", - state, ec_fop_name(fop->id)); + gf_msg (fop->xl->name, GF_LOG_ERROR, 0, + EC_MSG_UNHANDLED_STATE, "Unhandled state %d for %s", + state, ec_fop_name(fop->id)); return EC_STATE_END; } @@ -1430,7 +1475,7 @@ void ec_readv(call_frame_t * frame, xlator_t * this, uintptr_t target, ec_fop_data_t * fop = NULL; int32_t error = EIO; - gf_log("ec", GF_LOG_TRACE, "EC(READ) %p", frame); + gf_msg_trace ("ec", 0, "EC(READ) %p", frame); VALIDATE_OR_GOTO(this, out); GF_VALIDATE_OR_GOTO(this->name, frame, out); @@ -1455,7 +1500,8 @@ void ec_readv(call_frame_t * frame, xlator_t * this, uintptr_t target, fop->fd = fd_ref(fd); if (fop->fd == NULL) { - gf_log(this->name, GF_LOG_ERROR, "Failed to reference a " + gf_msg (this->name, GF_LOG_ERROR, 0, + EC_MSG_FILE_DESC_REF_FAIL, "Failed to reference a " "file descriptor."); goto out; @@ -1466,7 +1512,8 @@ void ec_readv(call_frame_t * frame, xlator_t * this, uintptr_t target, fop->xdata = dict_ref(xdata); if (fop->xdata == NULL) { - gf_log(this->name, GF_LOG_ERROR, "Failed to reference a " + gf_msg (this->name, GF_LOG_ERROR, 0, + EC_MSG_DICT_REF_FAIL, "Failed to reference a " "dictionary."); goto out; @@ -1492,7 +1539,8 @@ int32_t ec_combine_stat(ec_fop_data_t * fop, ec_cbk_data_t * dst, ec_cbk_data_t * src) { if (!ec_iatt_combine(fop, dst->iatt, src->iatt, 1)) { - gf_log(fop->xl->name, GF_LOG_NOTICE, "Mismatching iatt in " + gf_msg (fop->xl->name, GF_LOG_NOTICE, 0, + EC_MSG_IATT_MISMATCH, "Mismatching iatt in " "answers of 'GF_FOP_STAT'"); return 0; @@ -1535,7 +1583,8 @@ int32_t ec_stat_cbk(call_frame_t * frame, void * cookie, xlator_t * this, cbk->xdata = dict_ref(xdata); if (cbk->xdata == NULL) { - gf_log(this->name, GF_LOG_ERROR, "Failed to reference a " + gf_msg (this->name, GF_LOG_ERROR, 0, + EC_MSG_DICT_REF_FAIL, "Failed to reference a " "dictionary."); goto out; @@ -1679,8 +1728,9 @@ int32_t ec_manager_stat(ec_fop_data_t * fop, int32_t state) return EC_STATE_END; default: - gf_log(fop->xl->name, GF_LOG_ERROR, "Unhandled state %d for %s", - state, ec_fop_name(fop->id)); + gf_msg (fop->xl->name, GF_LOG_ERROR, 0, + EC_MSG_UNHANDLED_STATE, "Unhandled state %d for %s", + state, ec_fop_name(fop->id)); return EC_STATE_END; } @@ -1694,7 +1744,7 @@ void ec_stat(call_frame_t * frame, xlator_t * this, uintptr_t target, ec_fop_data_t * fop = NULL; int32_t error = EIO; - gf_log("ec", GF_LOG_TRACE, "EC(STAT) %p", frame); + gf_msg_trace ("ec", 0, "EC(STAT) %p", frame); VALIDATE_OR_GOTO(this, out); GF_VALIDATE_OR_GOTO(this->name, frame, out); @@ -1712,7 +1762,8 @@ void ec_stat(call_frame_t * frame, xlator_t * this, uintptr_t target, { if (loc_copy(&fop->loc[0], loc) != 0) { - gf_log(this->name, GF_LOG_ERROR, "Failed to copy a location."); + gf_msg (this->name, GF_LOG_ERROR, 0, + EC_MSG_LOC_COPY_FAIL, "Failed to copy a location."); goto out; } @@ -1722,7 +1773,8 @@ void ec_stat(call_frame_t * frame, xlator_t * this, uintptr_t target, fop->xdata = dict_ref(xdata); if (fop->xdata == NULL) { - gf_log(this->name, GF_LOG_ERROR, "Failed to reference a " + gf_msg (this->name, GF_LOG_ERROR, 0, + EC_MSG_DICT_REF_FAIL, "Failed to reference a " "dictionary."); goto out; @@ -1778,7 +1830,8 @@ int32_t ec_fstat_cbk(call_frame_t * frame, void * cookie, xlator_t * this, cbk->xdata = dict_ref(xdata); if (cbk->xdata == NULL) { - gf_log(this->name, GF_LOG_ERROR, "Failed to reference a " + gf_msg (this->name, GF_LOG_ERROR, 0, + EC_MSG_DICT_REF_FAIL, "Failed to reference a " "dictionary."); goto out; @@ -1814,7 +1867,7 @@ void ec_fstat(call_frame_t * frame, xlator_t * this, uintptr_t target, ec_fop_data_t * fop = NULL; int32_t error = EIO; - gf_log("ec", GF_LOG_TRACE, "EC(FSTAT) %p", frame); + gf_msg_trace ("ec", 0, "EC(FSTAT) %p", frame); VALIDATE_OR_GOTO(this, out); GF_VALIDATE_OR_GOTO(this->name, frame, out); @@ -1835,7 +1888,8 @@ void ec_fstat(call_frame_t * frame, xlator_t * this, uintptr_t target, fop->fd = fd_ref(fd); if (fop->fd == NULL) { - gf_log(this->name, GF_LOG_ERROR, "Failed to reference a " + gf_msg (this->name, GF_LOG_ERROR, 0, + EC_MSG_FILE_DESC_REF_FAIL, "Failed to reference a " "file descriptor."); goto out; @@ -1846,7 +1900,8 @@ void ec_fstat(call_frame_t * frame, xlator_t * this, uintptr_t target, fop->xdata = dict_ref(xdata); if (fop->xdata == NULL) { - gf_log(this->name, GF_LOG_ERROR, "Failed to reference a " + gf_msg (this->name, GF_LOG_ERROR, 0, + EC_MSG_DICT_REF_FAIL, "Failed to reference a " "dictionary."); goto out; |