diff options
| author | Venky Shankar <vshankar@redhat.com> | 2015-06-25 12:07:24 +0530 | 
|---|---|---|
| committer | Raghavendra Bhat <raghavendra@redhat.com> | 2015-07-09 03:31:34 -0700 | 
| commit | 911b4a37a67b6759ddce55e1b3dbcd0641805f76 (patch) | |
| tree | 7dedfa6f4e0f9e7b1cd9f7042ff857821cdb67a8 /xlators/features/bit-rot | |
| parent | a90b7c5d640bc7bf1bd648c69127fd1953e27421 (diff) | |
features/bitrot: convert pending gf_log() to gf_msg()
    Backport of http://review.gluster.org/11396
Change-Id: Idfd245327b485459ccbda503510b8ca0127bb66c
BUG: 1226666
Signed-off-by: Venky Shankar <vshankar@redhat.com>
Reviewed-on: http://review.gluster.org/11542
Tested-by: NetBSD Build System <jenkins@build.gluster.org>
Tested-by: Gluster Build System <jenkins@build.gluster.com>
Reviewed-by: Raghavendra Bhat <raghavendra@redhat.com>
Diffstat (limited to 'xlators/features/bit-rot')
| -rw-r--r-- | xlators/features/bit-rot/src/bitd/bit-rot-bitd-messages.h | 27 | ||||
| -rw-r--r-- | xlators/features/bit-rot/src/bitd/bit-rot-scrub.c | 32 | ||||
| -rw-r--r-- | xlators/features/bit-rot/src/bitd/bit-rot-ssm.c | 12 | ||||
| -rw-r--r-- | xlators/features/bit-rot/src/bitd/bit-rot.c | 32 | 
4 files changed, 73 insertions, 30 deletions
diff --git a/xlators/features/bit-rot/src/bitd/bit-rot-bitd-messages.h b/xlators/features/bit-rot/src/bitd/bit-rot-bitd-messages.h index af3a74fc752..b4746bb5ecb 100644 --- a/xlators/features/bit-rot/src/bitd/bit-rot-bitd-messages.h +++ b/xlators/features/bit-rot/src/bitd/bit-rot-bitd-messages.h @@ -387,5 +387,32 @@   *   */  /*------------*/ +#define BRB_MSG_SCRUB_THREAD_CLEANUP       (GLFS_BITROT_BITD_BASE + 49) +/*! + * @messageid + * @diagnosis + * @recommendedaction + * + */ +/*------------*/ +#define BRB_MSG_SCRUBBER_CLEANED           (GLFS_BITROT_BITD_BASE + 50) +/*! + * @messageid + * @diagnosis + * @recommendedaction + * + */ +/*------------*/ +#define BRB_MSG_GENERIC_SSM_INFO           (GLFS_BITROT_BITD_BASE + 51) + +/*! + * @messageid + * @diagnosis + * @recommendedaction + * + */ +/*------------*/ +#define BRB_MSG_ZERO_TIMEOUT_BUG           (GLFS_BITROT_BITD_BASE + 52) +  #define glfs_msg_end_x GLFS_MSGID_END, "Invalid: End of messages"  #endif /* !_BITROT_BITD_MESSAGES_H_ */ diff --git a/xlators/features/bit-rot/src/bitd/bit-rot-scrub.c b/xlators/features/bit-rot/src/bitd/bit-rot-scrub.c index af31a3cb775..3a038cef2bc 100644 --- a/xlators/features/bit-rot/src/bitd/bit-rot-scrub.c +++ b/xlators/features/bit-rot/src/bitd/bit-rot-scrub.c @@ -542,11 +542,12 @@ br_fsscan_deactivate (xlator_t *this, br_child_t *child)          ret = gf_tw_del_timer (priv->timer_wheel, fsscan->timer);          if (ret == 0) {                  nstate = BR_SCRUB_STATE_STALLED; -                gf_log (this->name, GF_LOG_INFO, "Brick [%s] is under active " -                        "scrubbing. Pausing scrub..", child->brick_path); +                gf_msg (this->name, GF_LOG_INFO, 0, BRB_MSG_SCRUB_INFO, +                        "Brick [%s] is under active scrubbing. Pausing scrub..", +                        child->brick_path);          } else {                  nstate = BR_SCRUB_STATE_PAUSED; -                gf_log (this->name, GF_LOG_INFO, +                gf_msg (this->name, GF_LOG_INFO, 0, BRB_MSG_SCRUB_INFO,                          "Scrubber paused [Brick: %s]", child->brick_path);          } @@ -617,8 +618,9 @@ br_fsscanner_exit_control (xlator_t *this, br_child_t *child)                  if (fsscan->state == BR_SCRUB_STATE_ACTIVE) {                          (void) br_fsscan_activate (this, child);                  } else { -                        gf_log (this->name, GF_LOG_INFO, "Brick [%s] waiting " -                                "to get rescheduled..", child->brick_path); +                        gf_msg (this->name, GF_LOG_INFO, 0, BRB_MSG_SCRUB_INFO, +                                "Brick [%s] waiting to get rescheduled..", +                                child->brick_path);                  }          }          UNLOCK (&child->lock); @@ -757,7 +759,8 @@ br_fsscan_schedule (xlator_t *this, br_child_t *child)          timo = br_fsscan_calculate_timeout (fsscan->boot,                                              fsscan->boot, fsscrub->frequency);          if (timo == 0) { -                gf_log (this->name, GF_LOG_ERROR, "BUG: Zero schedule timeout"); +                gf_msg (this->name, GF_LOG_ERROR, 0, BRB_MSG_ZERO_TIMEOUT_BUG, +                        "BUG: Zero schedule timeout");                  goto error_return;          } @@ -805,7 +808,8 @@ br_fsscan_activate (xlator_t *this, br_child_t *child)          timo = br_fsscan_calculate_timeout (fsscan->boot,                                              now.tv_sec, fsscrub->frequency);          if (timo == 0) { -                gf_log (this->name, GF_LOG_ERROR, "BUG: Zero schedule timeout"); +                gf_msg (this->name, GF_LOG_ERROR, 0, BRB_MSG_ZERO_TIMEOUT_BUG, +                        "BUG: Zero schedule timeout");                  return -1;          } @@ -815,8 +819,8 @@ br_fsscan_activate (xlator_t *this, br_child_t *child)          (void) gf_tw_mod_timer (priv->timer_wheel, fsscan->timer, timo);          _br_child_set_scrub_state (child, BR_SCRUB_STATE_PENDING); -        gf_log (this->name, GF_LOG_INFO, "Scrubbing for %s rescheduled to run " -                "at %s", child->brick_path, timestr); +        gf_msg (this->name, GF_LOG_INFO, 0, BRB_MSG_SCRUB_INFO, "Scrubbing for " +                "%s rescheduled to run at %s", child->brick_path, timestr);          return 0;  } @@ -840,7 +844,8 @@ br_fsscan_reschedule (xlator_t *this, br_child_t *child)          timo = br_fsscan_calculate_timeout (fsscan->boot,                                              now.tv_sec, fsscrub->frequency);          if (timo == 0) { -                gf_log (this->name, GF_LOG_ERROR, "BUG: Zero schedule timeout"); +                gf_msg (this->name, GF_LOG_ERROR, 0, BRB_MSG_ZERO_TIMEOUT_BUG, +                        "BUG: Zero schedule timeout");                  return -1;          } @@ -850,13 +855,14 @@ br_fsscan_reschedule (xlator_t *this, br_child_t *child)          fsscan->over = _gf_false;          ret = gf_tw_mod_timer_pending (priv->timer_wheel, fsscan->timer, timo);          if (ret == 0) -                gf_log (this->name, GF_LOG_INFO, +                gf_msg (this->name, GF_LOG_INFO, 0, BRB_MSG_SCRUB_INFO,                          "Scrubber for %s is currently running and would be "                          "rescheduled after completion", child->brick_path);          else {                  _br_child_set_scrub_state (child, BR_SCRUB_STATE_PENDING); -                gf_log (this->name, GF_LOG_INFO, "Scrubbing for %s rescheduled " -                        "to run at %s", child->brick_path, timestr); +                gf_msg (this->name, GF_LOG_INFO, 0, BRB_MSG_SCRUB_INFO, +                        "Scrubbing for %s rescheduled to run at %s", +                        child->brick_path, timestr);          }          return 0; diff --git a/xlators/features/bit-rot/src/bitd/bit-rot-ssm.c b/xlators/features/bit-rot/src/bitd/bit-rot-ssm.c index c95e5551c0d..fcffc04feda 100644 --- a/xlators/features/bit-rot/src/bitd/bit-rot-ssm.c +++ b/xlators/features/bit-rot/src/bitd/bit-rot-ssm.c @@ -10,6 +10,7 @@  #include "bit-rot-ssm.h"  #include "bit-rot-scrub.h" +#include "bit-rot-bitd-messages.h"  int br_scrub_ssm_noop (xlator_t *this, br_child_t *child)  { @@ -19,7 +20,7 @@ int br_scrub_ssm_noop (xlator_t *this, br_child_t *child)  int  br_scrub_ssm_state_pause (xlator_t *this, br_child_t *child)  { -        gf_log (this->name, GF_LOG_INFO, +        gf_msg (this->name, GF_LOG_INFO, 0, BRB_MSG_GENERIC_SSM_INFO,                  "Scrubber paused [Brick: %s]", child->brick_path);          _br_child_set_scrub_state (child, BR_SCRUB_STATE_PAUSED);          return 0; @@ -28,7 +29,7 @@ br_scrub_ssm_state_pause (xlator_t *this, br_child_t *child)  int  br_scrub_ssm_state_ipause (xlator_t *this, br_child_t *child)  { -        gf_log (this->name, GF_LOG_INFO, +        gf_msg (this->name, GF_LOG_INFO, 0, BRB_MSG_GENERIC_SSM_INFO,                  "Scrubber paused [Brick: %s]", child->brick_path);          _br_child_set_scrub_state (child, BR_SCRUB_STATE_IPAUSED);          return 0; @@ -42,7 +43,7 @@ br_scrub_ssm_state_active (xlator_t *this, br_child_t *child)          if (fsscan->over) {                  (void) br_fsscan_activate (this, child);          } else { -                gf_log (this->name, GF_LOG_INFO, +                gf_msg (this->name, GF_LOG_INFO, 0, BRB_MSG_GENERIC_SSM_INFO,                          "Scrubbing resumed [Brick %s]", child->brick_path);                  _br_child_set_scrub_state (child, BR_SCRUB_STATE_ACTIVE);          } @@ -53,8 +54,9 @@ br_scrub_ssm_state_active (xlator_t *this, br_child_t *child)  int  br_scrub_ssm_state_stall (xlator_t *this, br_child_t *child)  { -        gf_log (this->name, GF_LOG_INFO, "Brick [%s] is under active " -                "scrubbing. Pausing scrub..", child->brick_path); +        gf_msg (this->name, GF_LOG_INFO, 0, BRB_MSG_GENERIC_SSM_INFO, +                "Brick [%s] is under active scrubbing. Pausing scrub..", +                child->brick_path);          _br_child_set_scrub_state (child, BR_SCRUB_STATE_STALLED);          return 0;  } diff --git a/xlators/features/bit-rot/src/bitd/bit-rot.c b/xlators/features/bit-rot/src/bitd/bit-rot.c index 551ac9396e9..7aaafcd2852 100644 --- a/xlators/features/bit-rot/src/bitd/bit-rot.c +++ b/xlators/features/bit-rot/src/bitd/bit-rot.c @@ -1264,7 +1264,8 @@ br_child_enaction (xlator_t *this, br_child_t *child, br_stub_init_t *stub)                  if (!ret) {                          child->witnessed = 1;                          _br_set_child_state (child, BR_CHILD_STATE_CONNECTED); -                        gf_log (this->name, GF_LOG_INFO, +                        gf_msg (this->name, GF_LOG_INFO, +                                0, BRB_MSG_CONNECTED_TO_BRICK,                                  "Connected to brick %s..", child->brick_path);                  }          } @@ -1389,7 +1390,8 @@ br_cleanup_scrubber (xlator_t *this, br_child_t *child)           */          ret = gf_thread_cleanup_xint (child->thread);          if (ret) -                gf_log (this->name, GF_LOG_ERROR, +                gf_msg (this->name, GF_LOG_INFO, +                        0, BRB_MSG_SCRUB_THREAD_CLEANUP,                          "Error cleaning up scanner thread");          /** @@ -1407,7 +1409,8 @@ br_cleanup_scrubber (xlator_t *this, br_child_t *child)           */          _br_child_set_scrub_state (child, BR_SCRUB_STATE_INACTIVE); -        gf_log (this->name, GF_LOG_INFO, +        gf_msg (this->name, GF_LOG_INFO, +                0, BRB_MSG_SCRUBBER_CLEANED,                  "Cleaned up scrubber for brick [%s]", child->brick_path);          return 0; @@ -1522,8 +1525,9 @@ _br_qchild_event (xlator_t *this, br_child_t *child, br_child_handler *call)          childev = GF_CALLOC (1, sizeof (*childev), gf_br_mt_br_child_event_t);          if (!childev) { -                gf_log (this->name, GF_LOG_ERROR, "Event unhandled for " -                        "child.. [Brick: %s]", child->xl->name); +                gf_msg (this->name, GF_LOG_ERROR, ENOMEM, BRB_MSG_NO_MEMORY, +                        "Event unhandled for child.. [Brick: %s]", +                        child->xl->name);                  return;          } @@ -1805,7 +1809,8 @@ br_init_children (xlator_t *this, br_private_t *priv)                  child->timer_pool = mem_pool_new                                      (struct gf_tw_timer_list,  4096);                  if (!child->timer_pool) { -                        gf_log (this->name, GF_LOG_ERROR, +                        gf_msg (this->name, GF_LOG_ERROR, +                                ENOMEM, BRB_MSG_NO_MEMORY,                                  "failed to allocate mem-pool for timer");                          errno = ENOMEM;                          goto freechild; @@ -1832,13 +1837,14 @@ init (xlator_t *this)  	br_private_t *priv = NULL;  	if (!this->children) { -		gf_log (this->name, GF_LOG_ERROR, "FATAL: no children"); +                gf_msg (this->name, GF_LOG_ERROR, 0, BRB_MSG_NO_CHILD, +                        "FATAL: no children");  		goto out;  	}          priv = GF_CALLOC (1, sizeof (*priv), gf_br_mt_br_private_t);          if (!priv) { -                gf_log (this->name, GF_LOG_ERROR, +                gf_msg (this->name, GF_LOG_ERROR, ENOMEM, BRB_MSG_NO_MEMORY,                          "failed to allocate memory (->priv)");                  goto out;          } @@ -1930,9 +1936,10 @@ br_reconfigure_child (xlator_t *this, br_child_t *child)          ret = br_scrub_state_machine (this, child);          if (ret) { -                gf_log (this->name, GF_LOG_ERROR, -                        "Could not reschedule scrubber for brick: %s. " -                        "Scubbing will continue according to old frequency.", +                gf_msg (this->name, GF_LOG_ERROR, 0, +                        BRB_MSG_RESCHEDULE_SCRUBBER_FAILED, +                        "Could not reschedule scrubber for brick: %s. Scubbing " +                        "will continue according to old frequency.",                          child->brick_path);          }  } @@ -1963,7 +1970,8 @@ br_reconfigure_scrubber (xlator_t *this, dict_t *options)                  LOCK (&child->lock);                  {                          if (_br_child_failed_conn (child)) { -                                gf_log (this->name, GF_LOG_INFO, +                                gf_msg (this->name, GF_LOG_INFO, +                                        0, BRB_MSG_BRICK_INFO,                                          "Scrubber for brick [%s] failed "                                          "initialization, rescheduling is "                                          "skipped", child->brick_path);  | 
