diff options
Diffstat (limited to 'xlators/cluster/dht/src/dht-helper.c')
| -rw-r--r-- | xlators/cluster/dht/src/dht-helper.c | 68 |
1 files changed, 38 insertions, 30 deletions
diff --git a/xlators/cluster/dht/src/dht-helper.c b/xlators/cluster/dht/src/dht-helper.c index d7f2058e47f..8cd8617e1ee 100644 --- a/xlators/cluster/dht/src/dht-helper.c +++ b/xlators/cluster/dht/src/dht-helper.c @@ -276,7 +276,8 @@ dht_log_lk_array (char *name, gf_loglevel_t log_level, dht_lock_t **lk_array, for (i = 0; i < count; i++) { lk_buf = dht_lock_asprintf (lk_array[i]); - gf_log (name, log_level, "%d. %s", i, lk_buf); + gf_msg (name, log_level, 0, DHT_MSG_LK_ARRAY_INFO, + "%d. %s", i, lk_buf); GF_FREE (lk_buf); } @@ -988,10 +989,10 @@ dht_migration_complete_check_task (void *data) ret = syncop_lookup (this, &tmp_loc, &stbuf, 0, 0, 0); if (ret) { - gf_log (this->name, GF_LOG_ERROR, - "%s: failed to lookup the file on %s (%s)", - tmp_loc.path ? tmp_loc.path : uuid_utoa (tmp_loc.gfid), - this->name, strerror (-ret)); + gf_msg (this->name, GF_LOG_ERROR, -ret, + DHT_MSG_FILE_LOOKUP_FAILED, + "%s: failed to lookup the file on %s", + tmp_loc.path, this->name); local->op_errno = -ret; ret = -1; goto out; @@ -1060,7 +1061,8 @@ dht_migration_complete_check_task (void *data) ~(O_CREAT | O_EXCL | O_TRUNC)), iter_fd, NULL, NULL); if (ret < 0) { - gf_log (this->name, GF_LOG_ERROR, "failed to open " + gf_msg (this->name, GF_LOG_ERROR, -ret, + DHT_MSG_OPEN_FD_ON_DST_FAILED, "failed to open " "the fd (%p, flags=0%o) on file %s @ %s", iter_fd, iter_fd->flags, path, dst_node->name); open_failed = 1; @@ -1168,16 +1170,18 @@ dht_rebalance_inprogress_task (void *data) } if (ret < 0) { - gf_log (this->name, GF_LOG_ERROR, - "%s: failed to get the 'linkto' xattr %s", - local->loc.path, strerror (-ret)); + gf_msg (this->name, GF_LOG_ERROR, -ret, + DHT_MSG_GET_XATTR_FAILED, + "%s: failed to get the 'linkto' xattr", + local->loc.path); ret = -1; goto out; } dst_node = dht_linkfile_subvol (this, NULL, NULL, dict); if (!dst_node) { - gf_log (this->name, GF_LOG_ERROR, + gf_msg (this->name, GF_LOG_ERROR, 0, + DHT_MSG_SUBVOL_NOT_FOUND, "%s: failed to get the 'linkto' xattr from dict", local->loc.path); ret = -1; @@ -1192,15 +1196,14 @@ dht_rebalance_inprogress_task (void *data) tmp_loc.inode = inode_ref (inode); gf_uuid_copy (tmp_loc.gfid, inode->gfid); } - - /* lookup on dst */ - ret = syncop_lookup (dst_node, &tmp_loc, &stbuf, NULL, - NULL, NULL); + /* lookup on dst */ + ret = syncop_lookup (dst_node, &local->loc, &stbuf, NULL, + NULL, NULL); if (ret) { - gf_log (this->name, GF_LOG_ERROR, - "%s: failed to lookup the file on %s", - tmp_loc.path ? tmp_loc.path : uuid_utoa (tmp_loc.gfid), - dst_node->name); + gf_msg (this->name, GF_LOG_ERROR, -ret, + DHT_MSG_FILE_LOOKUP_ON_DST_FAILED, + "%s: failed to lookup the file on %s", + local->loc.path, dst_node->name); ret = -1; goto out; } @@ -1241,7 +1244,9 @@ dht_rebalance_inprogress_task (void *data) ~(O_CREAT | O_EXCL | O_TRUNC)), iter_fd, NULL, NULL); if (ret < 0) { - gf_log (this->name, GF_LOG_ERROR, "failed to send open " + gf_msg (this->name, GF_LOG_ERROR, -ret, + DHT_MSG_OPEN_FD_ON_DST_FAILED, + "failed to send open " "the fd (%p, flags=0%o) on file %s @ %s", iter_fd, iter_fd->flags, path, dst_node->name); ret = -1; @@ -1259,7 +1264,8 @@ dht_rebalance_inprogress_task (void *data) done: ret = dht_inode_ctx_set_mig_info (this, inode, src_node, dst_node); if (ret) { - gf_log (this->name, GF_LOG_ERROR, + gf_msg (this->name, GF_LOG_ERROR, 0, + DHT_MSG_SET_INODE_CTX_FAILED, "%s: failed to set inode-ctx target file at %s", local->loc.path, dst_node->name); goto out; @@ -1516,10 +1522,11 @@ dht_unlock_inodelk_cbk (call_frame_t *frame, void *cookie, xlator_t *this, uuid_utoa_r (local->lock.locks[lk_index]->loc.gfid, gfid); - gf_log (this->name, GF_LOG_WARNING, - "unlocking failed on %s:%s (%s)", + gf_msg (this->name, GF_LOG_WARNING, op_errno, + DHT_MSG_UNLOCKING_FAILED, + "unlocking failed on %s:%s", local->lock.locks[lk_index]->xl->name, - gfid, strerror (op_errno)); + gfid); } else { local->lock.locks[lk_index]->locked = 0; } @@ -1569,7 +1576,8 @@ dht_unlock_inodelk (call_frame_t *frame, dht_lock_t **lk_array, int lk_count, lock_frame = dht_lock_frame (frame); if (lock_frame == NULL) { - gf_log (frame->this->name, GF_LOG_WARNING, + gf_msg (frame->this->name, GF_LOG_WARNING, 0, + DHT_MSG_UNLOCKING_FAILED, "cannot allocate a frame, not unlocking following " "locks:"); @@ -1580,7 +1588,8 @@ dht_unlock_inodelk (call_frame_t *frame, dht_lock_t **lk_array, int lk_count, ret = dht_local_lock_init (lock_frame, lk_array, lk_count, inodelk_cbk); if (ret < 0) { - gf_log (frame->this->name, GF_LOG_WARNING, + gf_msg (frame->this->name, GF_LOG_WARNING, 0, + DHT_MSG_UNLOCKING_FAILED, "storing locks in local failed, not unlocking " "following locks:"); @@ -1644,11 +1653,10 @@ dht_nonblocking_inodelk_cbk (call_frame_t *frame, void *cookie, xlator_t *this, uuid_utoa_r (local->lock.locks[lk_index]->loc.inode->gfid, gfid); - gf_log (this->name, GF_LOG_DEBUG, - "inodelk failed on gfid: %s " - "subvolume: %s (%s)", gfid, - local->lock.locks[lk_index]->xl->name, - strerror (op_errno)); + gf_msg_debug (this->name, op_errno, + "inodelk failed on gfid: %s " + "subvolume: %s", gfid, + local->lock.locks[lk_index]->xl->name); } goto out; |
