diff options
author | Aravinda VK <avishwan@redhat.com> | 2017-10-12 11:31:34 +0530 |
---|---|---|
committer | Amar Tumballi <amarts@redhat.com> | 2017-11-15 14:17:58 +0000 |
commit | f65ad580cf81b4853fa496b628f3dfd9d7b66ee9 (patch) | |
tree | a4b939c1b360986c32dba1268938f8641988289b /xlators | |
parent | 53e28cc98c4cda61dc0d1f8ce8dcf3d77dcacb15 (diff) |
features/changelog: Structured logging support
Structured logging infra is available in logging library with
issue #240. Log messages with dynamic content are identified and
converted to structured logging format(`gf_msg` to `gf_smsg` and
`gf_log` to `gf_slog`)
BUG: 1501054
Change-Id: I5fccc354730c07cb9ae444d0b959d1d72bd9be49
Signed-off-by: Aravinda VK <avishwan@redhat.com>
Diffstat (limited to 'xlators')
-rw-r--r-- | xlators/features/changelog/src/changelog-ev-handle.c | 18 | ||||
-rw-r--r-- | xlators/features/changelog/src/changelog-helpers.c | 220 | ||||
-rw-r--r-- | xlators/features/changelog/src/changelog-helpers.h | 12 | ||||
-rw-r--r-- | xlators/features/changelog/src/changelog.c | 148 |
4 files changed, 230 insertions, 168 deletions
diff --git a/xlators/features/changelog/src/changelog-ev-handle.c b/xlators/features/changelog/src/changelog-ev-handle.c index 38e127b7eb5..a7f485b019f 100644 --- a/xlators/features/changelog/src/changelog-ev-handle.c +++ b/xlators/features/changelog/src/changelog-ev-handle.c @@ -209,10 +209,11 @@ changelog_ev_connector (void *data) crpc->sock, changelog_rpc_notify); if (!crpc->rpc) { - gf_msg (this->name, GF_LOG_ERROR, 0, - CHANGELOG_MSG_RPC_CONNECT_ERROR, - "failed to connect back.. <%s>", - crpc->sock); + gf_smsg (this->name, GF_LOG_ERROR, 0, + CHANGELOG_MSG_RPC_CONNECT_ERROR, + "failed to connect back", + "path=%s", crpc->sock, + NULL); crpc->cleanup (crpc); goto mutex_unlock; } @@ -351,10 +352,11 @@ changelog_ev_dispatch (void *data) &opaque, sequencer, c_clnt); if (ret != RBUF_CONSUMABLE) { if (ret != RBUF_EMPTY) - gf_msg (this->name, GF_LOG_WARNING, 0, - CHANGELOG_MSG_BUFFER_STARVATION_ERROR, - "Failed to get buffer for RPC dispatch " - "[rbuf retval: %d]", ret); + gf_smsg (this->name, GF_LOG_WARNING, 0, + CHANGELOG_MSG_BUFFER_STARVATION_ERROR, + "Failed to get buffer for RPC dispatch", + "rbuf_retval=%d", ret, + NULL); continue; } diff --git a/xlators/features/changelog/src/changelog-helpers.c b/xlators/features/changelog/src/changelog-helpers.c index 2a17fab6bad..306287ecd11 100644 --- a/xlators/features/changelog/src/changelog-helpers.c +++ b/xlators/features/changelog/src/changelog-helpers.c @@ -307,17 +307,19 @@ htime_update (xlator_t *this, if (sys_fsetxattr (priv->htime_fd, HTIME_KEY, x_value, strlen (x_value), XATTR_REPLACE)) { - gf_msg (this->name, GF_LOG_ERROR, errno, - CHANGELOG_MSG_HTIME_ERROR, - "Htime xattr updation failed with XATTR_REPLACE " - "Changelog: %s", changelog_path); + gf_smsg (this->name, GF_LOG_ERROR, errno, + CHANGELOG_MSG_HTIME_ERROR, + "Htime xattr updation failed with XATTR_REPLACE", + "changelog=%s", changelog_path, + NULL); if (sys_fsetxattr (priv->htime_fd, HTIME_KEY, x_value, strlen (x_value), 0)) { - gf_msg (this->name, GF_LOG_ERROR, errno, - CHANGELOG_MSG_HTIME_ERROR, - "Htime xattr updation failed " - "Changelog: %s", changelog_path); + gf_smsg (this->name, GF_LOG_ERROR, errno, + CHANGELOG_MSG_HTIME_ERROR, + "Htime xattr updation failed", + "changelog=%s", changelog_path, + NULL); ret = -1; goto out; } @@ -449,10 +451,11 @@ changelog_rollover_changelog (xlator_t *this, if (cl_empty_flag == 1) { ret = sys_unlink (ofile); if (ret) { - gf_msg (this->name, GF_LOG_ERROR, errno, - CHANGELOG_MSG_UNLINK_OP_FAILED, - "error unlinking(empty cl) %s)", - ofile); + gf_smsg (this->name, GF_LOG_ERROR, errno, + CHANGELOG_MSG_UNLINK_OP_FAILED, + "error unlinking empty changelog", + "path=%s", ofile, + NULL); ret = 0; /* Error in unlinking empty changelog should not break further changelog operation, so reset return value to 0*/ @@ -465,10 +468,12 @@ changelog_rollover_changelog (xlator_t *this, goto out; } if (ret) { - gf_msg (this->name, GF_LOG_ERROR, errno, - CHANGELOG_MSG_RENAME_ERROR, - "error renaming %s -> %s", - ofile, nfile); + gf_smsg (this->name, GF_LOG_ERROR, errno, + CHANGELOG_MSG_RENAME_ERROR, + "error renaming", + "from=%s", ofile, + "to=%s", nfile, + NULL); } } @@ -513,10 +518,12 @@ changelog_rollover_changelog (xlator_t *this, "Fail snapshot because of " "previous errors"); } else { - gf_msg (this->name, GF_LOG_INFO, 0, - CHANGELOG_MSG_BNOTIFY_INFO, "Explicit " - "rollover changelog: %s signaling " - "bnotify", nfile); + gf_smsg (this->name, GF_LOG_INFO, 0, + CHANGELOG_MSG_BNOTIFY_INFO, "Explicit " + "rollover changelog signaling " + "bnotify", + "changelog=%s", nfile, + NULL); } priv->bn.bnotify = _gf_false; pthread_cond_signal (&priv->bn.bnotify_cond); @@ -628,9 +635,10 @@ htime_open (xlator_t *this, /* Open htime directory to get HTIME_CURRENT */ ht_dir_fd = open (ht_dir_path, O_RDONLY); if (ht_dir_fd == -1) { - gf_msg (this->name, GF_LOG_ERROR, errno, - CHANGELOG_MSG_OPEN_FAILED, "open failed: %s", - ht_dir_path); + gf_smsg (this->name, GF_LOG_ERROR, errno, + CHANGELOG_MSG_OPEN_FAILED, "open failed", + "path=%s", ht_dir_path, + NULL); ret = -1; goto out; } @@ -661,8 +669,9 @@ htime_open (xlator_t *this, " HTIME_CURRENT."); } - gf_msg (this->name, GF_LOG_INFO, 0, CHANGELOG_MSG_HTIME_INFO, - "HTIME_CURRENT: %s", ht_file_bname); + gf_smsg (this->name, GF_LOG_INFO, 0, CHANGELOG_MSG_HTIME_INFO, + "HTIME_CURRENT", + "path=%s", ht_file_bname, NULL); (void) snprintf (ht_file_path, PATH_MAX, "%s/%s", ht_dir_path, ht_file_bname); @@ -671,10 +680,11 @@ htime_open (xlator_t *this, ht_file_fd = open (ht_file_path, flags, S_IRUSR | S_IWUSR | S_IRGRP | S_IROTH); if (ht_file_fd < 0) { - gf_msg (this->name, GF_LOG_ERROR, errno, - CHANGELOG_MSG_OPEN_FAILED, - "unable to open htime file: %s", - ht_file_path); + gf_smsg (this->name, GF_LOG_ERROR, errno, + CHANGELOG_MSG_OPEN_FAILED, + "unable to open htime file", + "path=%s", ht_file_path, + NULL); ret = -1; goto out; } @@ -684,10 +694,11 @@ htime_open (xlator_t *this, ret = sys_fstat (ht_file_fd, &stat_buf); if (ret < 0) { - gf_msg (this->name, GF_LOG_ERROR, errno, - CHANGELOG_MSG_HTIME_ERROR, - "unable to stat htime file: %s", - ht_file_path); + gf_smsg (this->name, GF_LOG_ERROR, errno, + CHANGELOG_MSG_HTIME_ERROR, + "unable to stat htime file", + "path=%s", ht_file_path, + NULL); ret = -1; goto out; } @@ -695,10 +706,11 @@ htime_open (xlator_t *this, /* Initialize rollover-number in priv to current number */ size = sys_fgetxattr (ht_file_fd, HTIME_KEY, x_value, sizeof (x_value)); if (size < 0) { - gf_msg (this->name, GF_LOG_ERROR, errno, - CHANGELOG_MSG_FGETXATTR_FAILED, "error extracting max" - " timstamp from htime file %s", - ht_file_path); + gf_smsg (this->name, GF_LOG_ERROR, errno, + CHANGELOG_MSG_FGETXATTR_FAILED, "error extracting max" + " timstamp from htime file", + "path=%s", ht_file_path, + NULL); ret = -1; goto out; } @@ -709,17 +721,22 @@ htime_open (xlator_t *this, record_len = strlen(priv->changelog_dir) + 22; total1 = stat_buf.st_size/record_len; if (total != total1) { - gf_msg (this->name, GF_LOG_INFO, 0, - CHANGELOG_MSG_TOTAL_LOG_INFO, - "Mismatch of changelog count. " - "INIT CASE: XATTR TOTAL: %lu, SIZE TOTAL: %lu", - total, total1); - } - - gf_msg (this->name, GF_LOG_INFO, 0, - CHANGELOG_MSG_TOTAL_LOG_INFO, - "INIT CASE: MIN: %lu, MAX: %lu," - " TOTAL CHANGELOGS: %lu", min_ts, max_ts, total); + gf_smsg (this->name, GF_LOG_INFO, 0, + CHANGELOG_MSG_TOTAL_LOG_INFO, + "Mismatch of changelog count. " + "INIT CASE", + "xattr_total=%lu", total, + "size_total=%lu", total1, + NULL); + } + + gf_smsg (this->name, GF_LOG_INFO, 0, + CHANGELOG_MSG_TOTAL_LOG_INFO, + "INIT CASE", + "min=%lu", min_ts, + "max=%lu", max_ts, + "total_changelogs=%lu", total, + NULL); if (total < total1) priv->rollover_count = total1 + 1; @@ -747,9 +764,11 @@ htime_create (xlator_t *this, char ht_file_bname[NAME_MAX + 1] = {0,}; int flags = 0; - gf_msg (this->name, GF_LOG_INFO, 0, - CHANGELOG_MSG_HTIME_INFO, "Changelog enable: Creating new " - "HTIME.%lu file", ts); + gf_smsg (this->name, GF_LOG_INFO, 0, + CHANGELOG_MSG_HTIME_INFO, "Changelog enable: Creating new " + "HTIME file", + "name=%lu", ts, + NULL); CHANGELOG_FILL_HTIME_DIR(priv->changelog_dir, ht_dir_path); @@ -761,10 +780,11 @@ htime_create (xlator_t *this, ht_file_fd = open (ht_file_path, flags, S_IRUSR | S_IWUSR | S_IRGRP | S_IROTH); if (ht_file_fd < 0) { - gf_msg (this->name, GF_LOG_ERROR, errno, - CHANGELOG_MSG_OPEN_FAILED, - "unable to create htime file: %s", - ht_file_path); + gf_smsg (this->name, GF_LOG_ERROR, errno, + CHANGELOG_MSG_OPEN_FAILED, + "unable to create htime file", + "path=%s", ht_file_path, + NULL); ret = -1; goto out; } @@ -789,9 +809,10 @@ htime_create (xlator_t *this, /* Set xattr HTIME_CURRENT on htime directory to htime filename */ ht_dir_fd = open (ht_dir_path, O_RDONLY); if (ht_dir_fd == -1) { - gf_msg (this->name, GF_LOG_ERROR, errno, - CHANGELOG_MSG_OPEN_FAILED, "open of %s failed", - ht_dir_path); + gf_smsg (this->name, GF_LOG_ERROR, errno, + CHANGELOG_MSG_OPEN_FAILED, "open failed", + "path=%s", ht_dir_path, + NULL); ret = -1; goto out; } @@ -856,9 +877,10 @@ changelog_snap_open (xlator_t *this, fd = open (c_snap_path, flags, S_IRUSR | S_IWUSR | S_IRGRP | S_IROTH); if (fd < 0) { - gf_msg (this->name, GF_LOG_ERROR, errno, - CHANGELOG_MSG_OPEN_FAILED, "unable to open %s file ", - c_snap_path); + gf_smsg (this->name, GF_LOG_ERROR, errno, + CHANGELOG_MSG_OPEN_FAILED, "unable to open file", + "path=%s", c_snap_path, + NULL); ret = -1; goto out; } @@ -944,11 +966,13 @@ changelog_open_journal (xlator_t *this, fd = open (changelog_path, flags, S_IRUSR | S_IWUSR | S_IRGRP | S_IROTH); if (fd < 0) { - gf_msg (this->name, GF_LOG_ERROR, errno, - CHANGELOG_MSG_OPEN_FAILED, - "unable to open/create changelog file %s." - " change-logging will be" - " inactive", changelog_path); + gf_smsg (this->name, GF_LOG_ERROR, errno, + CHANGELOG_MSG_OPEN_FAILED, + "unable to open/create changelog file." + " change-logging will be" + " inactive", + "path=%s", changelog_path, + NULL); goto out; } @@ -1209,9 +1233,10 @@ changelog_drain_black_fops (xlator_t *this, changelog_priv_t *priv) &priv->dm.drain_black_mutex); ret = pthread_mutex_lock (&priv->dm.drain_black_mutex); if (ret) - gf_msg (this->name, GF_LOG_ERROR, errno, - CHANGELOG_MSG_PTHREAD_ERROR, "pthread error:" - " Error:%d", ret); + gf_smsg (this->name, GF_LOG_ERROR, errno, + CHANGELOG_MSG_PTHREAD_ERROR, "pthread error", + "error=%d", ret, + NULL); while (priv->dm.black_fop_cnt > 0) { gf_msg_debug (this->name, 0, "Condtional wait on black fops: %ld", @@ -1220,17 +1245,19 @@ changelog_drain_black_fops (xlator_t *this, changelog_priv_t *priv) ret = pthread_cond_wait (&priv->dm.drain_black_cond, &priv->dm.drain_black_mutex); if (ret) - gf_msg (this->name, GF_LOG_ERROR, errno, - CHANGELOG_MSG_PTHREAD_COND_WAIT_FAILED, - "pthread cond wait failed: Error:%d", - ret); + gf_smsg (this->name, GF_LOG_ERROR, errno, + CHANGELOG_MSG_PTHREAD_COND_WAIT_FAILED, + "pthread cond wait failed", + "error=%d", ret, + NULL); } priv->dm.drain_wait_black = _gf_false; ret = pthread_mutex_unlock (&priv->dm.drain_black_mutex); if (ret) - gf_msg (this->name, GF_LOG_ERROR, errno, - CHANGELOG_MSG_PTHREAD_ERROR, "pthread error:" - " Error:%d", ret); + gf_smsg (this->name, GF_LOG_ERROR, errno, + CHANGELOG_MSG_PTHREAD_ERROR, "pthread error", + "error=%d", ret, + NULL); pthread_cleanup_pop (0); gf_msg_debug (this->name, 0, "Woke up: Conditional wait on black fops"); @@ -1250,9 +1277,10 @@ changelog_drain_white_fops (xlator_t *this, changelog_priv_t *priv) &priv->dm.drain_white_mutex); ret = pthread_mutex_lock (&priv->dm.drain_white_mutex); if (ret) - gf_msg (this->name, GF_LOG_ERROR, errno, - CHANGELOG_MSG_PTHREAD_ERROR, "pthread error:" - " Error:%d", ret); + gf_smsg (this->name, GF_LOG_ERROR, errno, + CHANGELOG_MSG_PTHREAD_ERROR, "pthread error", + "error=%d", ret, + NULL); while (priv->dm.white_fop_cnt > 0) { gf_msg_debug (this->name, 0, "Condtional wait on white fops : %ld", @@ -1261,17 +1289,19 @@ changelog_drain_white_fops (xlator_t *this, changelog_priv_t *priv) ret = pthread_cond_wait (&priv->dm.drain_white_cond, &priv->dm.drain_white_mutex); if (ret) - gf_msg (this->name, GF_LOG_ERROR, errno, - CHANGELOG_MSG_PTHREAD_COND_WAIT_FAILED, - "pthread cond wait failed: Error:%d", - ret); + gf_smsg (this->name, GF_LOG_ERROR, errno, + CHANGELOG_MSG_PTHREAD_COND_WAIT_FAILED, + "pthread cond wait failed", + "error=%d", ret, + NULL); } priv->dm.drain_wait_white = _gf_false; ret = pthread_mutex_unlock (&priv->dm.drain_white_mutex); if (ret) - gf_msg (this->name, GF_LOG_ERROR, errno, - CHANGELOG_MSG_PTHREAD_ERROR, "pthread error:" - " Error:%d", ret); + gf_smsg (this->name, GF_LOG_ERROR, errno, + CHANGELOG_MSG_PTHREAD_ERROR, "pthread error", + "error=%d", ret, + NULL); pthread_cleanup_pop (0); gf_msg_debug (this->name, 0, "Woke up: Conditional wait on white fops"); @@ -1858,9 +1888,11 @@ changelog_fill_entry_buf (call_frame_t *frame, xlator_t *this, parent = inode_parent (loc->inode, 0, 0); if (!parent) { - gf_msg (this->name, GF_LOG_ERROR, errno, - CHANGELOG_MSG_INODE_NOT_FOUND, "Parent inode not found" - " for gfid: %s", uuid_utoa (loc->inode->gfid)); + gf_smsg (this->name, GF_LOG_ERROR, errno, + CHANGELOG_MSG_INODE_NOT_FOUND, + "Parent inode not found", + "gfid=%s", uuid_utoa (loc->inode->gfid), + NULL); goto err; } @@ -1975,10 +2007,12 @@ resolve_pargfid_to_path (xlator_t *this, const uuid_t pgfid, len = sys_readlink (dir_handle, linkname, PATH_MAX); if (len < 0) { - gf_msg (this->name, GF_LOG_ERROR, errno, - CHANGELOG_MSG_READLINK_OP_FAILED, - "could not read the " - "link from the gfid handle %s", dir_handle); + gf_smsg (this->name, GF_LOG_ERROR, errno, + CHANGELOG_MSG_READLINK_OP_FAILED, + "could not read the " + "link from the gfid handle", + "handle=%s", dir_handle, + NULL); ret = -1; goto out; } diff --git a/xlators/features/changelog/src/changelog-helpers.h b/xlators/features/changelog/src/changelog-helpers.h index 4fdba244aa1..39a792891dd 100644 --- a/xlators/features/changelog/src/changelog-helpers.h +++ b/xlators/features/changelog/src/changelog-helpers.h @@ -656,9 +656,9 @@ resolve_pargfid_to_path (xlator_t *this, const uuid_t gfid, char **path, /* Log pthread error and goto label */ #define CHANGELOG_PTHREAD_ERROR_HANDLE_0(ret, label) do { \ if (ret) { \ - gf_msg (this->name, GF_LOG_ERROR, \ - 0, CHANGELOG_MSG_PTHREAD_ERROR, \ - "pthread error: Error: %d", ret); \ + gf_smsg (this->name, GF_LOG_ERROR, \ + 0, CHANGELOG_MSG_PTHREAD_ERROR, \ + "pthread error", "error=%d", ret, NULL); \ ret = -1; \ goto label; \ } \ @@ -667,9 +667,9 @@ resolve_pargfid_to_path (xlator_t *this, const uuid_t gfid, char **path, /* Log pthread error, set flag and goto label */ #define CHANGELOG_PTHREAD_ERROR_HANDLE_1(ret, label, flag) do { \ if (ret) { \ - gf_msg (this->name, GF_LOG_ERROR, 0, \ - CHANGELOG_MSG_PTHREAD_ERROR, \ - "pthread error: Error: %d", ret); \ + gf_smsg (this->name, GF_LOG_ERROR, 0, \ + CHANGELOG_MSG_PTHREAD_ERROR, \ + "pthread error", "error=%d", ret, NULL); \ ret = -1; \ flag = _gf_true; \ goto label; \ diff --git a/xlators/features/changelog/src/changelog.c b/xlators/features/changelog/src/changelog.c index 8b22a049dc9..3b8389f1da1 100644 --- a/xlators/features/changelog/src/changelog.c +++ b/xlators/features/changelog/src/changelog.c @@ -152,10 +152,11 @@ changelog_rmdir (call_frame_t *frame, xlator_t *this, goto out; } if (barrier_enabled && !stub) { - gf_msg (this->name, GF_LOG_ERROR, ENOMEM, - CHANGELOG_MSG_NO_MEMORY, - "Failed to barrier FOPs, disabling changelog barrier " - "FOP: rmdir"); + gf_smsg (this->name, GF_LOG_ERROR, ENOMEM, + CHANGELOG_MSG_NO_MEMORY, + "Failed to barrier FOPs, disabling changelog barrier", + "fop=rmdir", + NULL); chlog_barrier_dequeue_all (this, &queue); } @@ -309,10 +310,11 @@ changelog_unlink (call_frame_t *frame, xlator_t *this, goto out; } if (barrier_enabled && !stub) { - gf_msg (this->name, GF_LOG_ERROR, ENOMEM, - CHANGELOG_MSG_NO_MEMORY, - "Failed to barrier FOPs, disabling changelog barrier " - "FOP: unlink"); + gf_smsg (this->name, GF_LOG_ERROR, ENOMEM, + CHANGELOG_MSG_NO_MEMORY, + "Failed to barrier FOPs, disabling changelog barrier", + "fop=unlink", + NULL); chlog_barrier_dequeue_all (this, &queue); } @@ -435,10 +437,11 @@ changelog_rename (call_frame_t *frame, xlator_t *this, goto out; } if (barrier_enabled && !stub) { - gf_msg (this->name, GF_LOG_ERROR, ENOMEM, - CHANGELOG_MSG_NO_MEMORY, - "Failed to barrier FOPs, disabling changelog barrier " - "FOP: rename"); + gf_smsg (this->name, GF_LOG_ERROR, ENOMEM, + CHANGELOG_MSG_NO_MEMORY, + "Failed to barrier FOPs, disabling changelog barrier", + "fop=rename", + NULL); chlog_barrier_dequeue_all (this, &queue); } /* changelog barrier */ @@ -553,10 +556,11 @@ changelog_link (call_frame_t *frame, } if (barrier_enabled && !stub) { - gf_msg (this->name, GF_LOG_ERROR, 0, - CHANGELOG_MSG_NO_MEMORY, - "Failed to barrier FOPs, disabling changelog barrier " - "FOP: link"); + gf_smsg (this->name, GF_LOG_ERROR, 0, + CHANGELOG_MSG_NO_MEMORY, + "Failed to barrier FOPs, disabling changelog barrier", + "fop=link", + NULL); chlog_barrier_dequeue_all (this, &queue); } wind: @@ -688,10 +692,11 @@ changelog_mkdir (call_frame_t *frame, xlator_t *this, } if (barrier_enabled && !stub) { - gf_msg (this->name, GF_LOG_ERROR, ENOMEM, - CHANGELOG_MSG_NO_MEMORY, - "Failed to barrier FOPs, disabling changelog barrier " - "FOP: mkdir"); + gf_smsg (this->name, GF_LOG_ERROR, ENOMEM, + CHANGELOG_MSG_NO_MEMORY, + "Failed to barrier FOPs, disabling changelog barrier", + "fop=mkdir", + NULL); chlog_barrier_dequeue_all (this, &queue); } @@ -818,10 +823,11 @@ changelog_symlink (call_frame_t *frame, xlator_t *this, } if (barrier_enabled && !stub) { - gf_msg (this->name, GF_LOG_ERROR, ENOMEM, - CHANGELOG_MSG_NO_MEMORY, - "Failed to barrier FOPs, disabling changelog barrier " - "FOP: symlink"); + gf_smsg (this->name, GF_LOG_ERROR, ENOMEM, + CHANGELOG_MSG_NO_MEMORY, + "Failed to barrier FOPs, disabling changelog barrier", + "fop=symlink", + NULL); chlog_barrier_dequeue_all (this, &queue); } @@ -972,10 +978,11 @@ changelog_mknod (call_frame_t *frame, } if (barrier_enabled && !stub) { - gf_msg (this->name, GF_LOG_ERROR, ENOMEM, - CHANGELOG_MSG_NO_MEMORY, - "Failed to barrier FOPs, disabling changelog barrier " - "FOP: mknod"); + gf_smsg (this->name, GF_LOG_ERROR, ENOMEM, + CHANGELOG_MSG_NO_MEMORY, + "Failed to barrier FOPs, disabling changelog barrier", + "fop=mknod", + NULL); chlog_barrier_dequeue_all (this, &queue); } @@ -1133,10 +1140,11 @@ changelog_create (call_frame_t *frame, xlator_t *this, } if (barrier_enabled && !stub) { - gf_msg (this->name, GF_LOG_ERROR, ENOMEM, - CHANGELOG_MSG_NO_MEMORY, - "Failed to barrier FOPs, disabling changelog barrier " - "FOP: create"); + gf_smsg (this->name, GF_LOG_ERROR, ENOMEM, + CHANGELOG_MSG_NO_MEMORY, + "Failed to barrier FOPs, disabling changelog barrier", + "fop=create", + NULL); chlog_barrier_dequeue_all (this, &queue); } @@ -1454,11 +1462,13 @@ changelog_handle_virtual_xattr (call_frame_t *frame, xlator_t *this, if (valid) { ret = changelog_fill_entry_buf (frame, this, loc, &local); if (ret) { - gf_msg (this->name, GF_LOG_INFO, 0, - CHANGELOG_MSG_ENTRY_BUF_INFO, - "Entry cannot be" - " captured for gfid: %s. Capturing DATA" - " entry.", uuid_utoa (loc->inode->gfid)); + gf_smsg (this->name, GF_LOG_INFO, 0, + CHANGELOG_MSG_ENTRY_BUF_INFO, + "Entry cannot be" + " captured for gfid, Capturing DATA" + " entry.", + "gfid=%s", uuid_utoa (loc->inode->gfid), + NULL); goto unwind; } changelog_update (this, priv, local, CHANGELOG_TYPE_ENTRY); @@ -2410,18 +2420,22 @@ changelog_barrier_pthread_init (xlator_t *this, changelog_priv_t *priv) int ret = 0; if ((ret = pthread_mutex_init(&priv->bn.bnotify_mutex, NULL)) != 0) { - gf_msg (this->name, GF_LOG_ERROR, errno, - CHANGELOG_MSG_PTHREAD_MUTEX_INIT_FAILED, - "bnotify pthread_mutex_init failed (%d)", ret); + gf_smsg (this->name, GF_LOG_ERROR, errno, + CHANGELOG_MSG_PTHREAD_MUTEX_INIT_FAILED, + "bnotify pthread_mutex_init failed", + "ret=%d", ret, + NULL); ret = -1; goto out; } bn_mutex_init = _gf_true; if ((ret = pthread_cond_init(&priv->bn.bnotify_cond, NULL)) != 0) { - gf_msg (this->name, GF_LOG_ERROR, errno, - CHANGELOG_MSG_PTHREAD_COND_INIT_FAILED, - "bnotify pthread_cond_init failed (%d)", ret); + gf_smsg (this->name, GF_LOG_ERROR, errno, + CHANGELOG_MSG_PTHREAD_COND_INIT_FAILED, + "bnotify pthread_cond_init failed", + "ret=%d", ret, + NULL); ret = -1; goto out; } @@ -2429,18 +2443,22 @@ changelog_barrier_pthread_init (xlator_t *this, changelog_priv_t *priv) if ((ret = pthread_mutex_init(&priv->dm.drain_black_mutex, NULL)) != 0) { - gf_msg (this->name, GF_LOG_ERROR, errno, - CHANGELOG_MSG_PTHREAD_MUTEX_INIT_FAILED, - "drain_black pthread_mutex_init failed (%d)", ret); + gf_smsg (this->name, GF_LOG_ERROR, errno, + CHANGELOG_MSG_PTHREAD_MUTEX_INIT_FAILED, + "drain_black pthread_mutex_init failed", + "ret=%d", ret, + NULL); ret = -1; goto out; } dm_mutex_black_init = _gf_true; if ((ret = pthread_cond_init(&priv->dm.drain_black_cond, NULL)) != 0) { - gf_msg (this->name, GF_LOG_ERROR, errno, - CHANGELOG_MSG_PTHREAD_COND_INIT_FAILED, - "drain_black pthread_cond_init failed (%d)", ret); + gf_smsg (this->name, GF_LOG_ERROR, errno, + CHANGELOG_MSG_PTHREAD_COND_INIT_FAILED, + "drain_black pthread_cond_init failed", + "ret=%d", ret, + NULL); ret = -1; goto out; } @@ -2448,36 +2466,44 @@ changelog_barrier_pthread_init (xlator_t *this, changelog_priv_t *priv) if ((ret = pthread_mutex_init(&priv->dm.drain_white_mutex, NULL)) != 0) { - gf_msg (this->name, GF_LOG_ERROR, errno, - CHANGELOG_MSG_PTHREAD_MUTEX_INIT_FAILED, - "drain_white pthread_mutex_init failed (%d)", ret); + gf_smsg (this->name, GF_LOG_ERROR, errno, + CHANGELOG_MSG_PTHREAD_MUTEX_INIT_FAILED, + "drain_white pthread_mutex_init failed", + "ret=%d", ret, + NULL); ret = -1; goto out; } dm_mutex_white_init = _gf_true; if ((ret = pthread_cond_init(&priv->dm.drain_white_cond, NULL)) != 0) { - gf_msg (this->name, GF_LOG_ERROR, errno, - CHANGELOG_MSG_PTHREAD_COND_INIT_FAILED, - "drain_white pthread_cond_init failed (%d)", ret); + gf_smsg (this->name, GF_LOG_ERROR, errno, + CHANGELOG_MSG_PTHREAD_COND_INIT_FAILED, + "drain_white pthread_cond_init failed", + "ret=%d", ret, + NULL); ret = -1; goto out; } dm_cond_white_init = _gf_true; if ((pthread_mutex_init(&priv->cr.lock, NULL)) != 0) { - gf_msg (this->name, GF_LOG_ERROR, errno, - CHANGELOG_MSG_PTHREAD_MUTEX_INIT_FAILED, - "changelog_rollover lock init failed (%d)", ret); + gf_smsg (this->name, GF_LOG_ERROR, errno, + CHANGELOG_MSG_PTHREAD_MUTEX_INIT_FAILED, + "changelog_rollover lock init failed", + "ret=%d", ret, + NULL); ret = -1; goto out; } cr_mutex_init = _gf_true; if ((pthread_cond_init(&priv->cr.cond, NULL)) != 0) { - gf_msg (this->name, GF_LOG_ERROR, errno, - CHANGELOG_MSG_PTHREAD_COND_INIT_FAILED, - "changelog_rollover cond init failed (%d)", ret); + gf_smsg (this->name, GF_LOG_ERROR, errno, + CHANGELOG_MSG_PTHREAD_COND_INIT_FAILED, + "changelog_rollover cond init failed", + "ret=%d", ret, + NULL); ret = -1; goto out; } |