- Log size of data to synchronize in human readable form (using %N).

- Log synchronization time (using %T).
- Log synchronization speed in human readable form (using %N).

MFC after:	2 weeks
This commit is contained in:
Pawel Jakub Dawidek 2011-03-07 10:41:12 +00:00
parent 1c151458c6
commit fa356f6cfe
Notes: svn2git 2020-12-20 02:59:44 +00:00
svn path=/head/; revision=219372

View File

@ -1667,6 +1667,7 @@ sync_thread(void *arg __unused)
struct hast_resource *res = arg; struct hast_resource *res = arg;
struct hio *hio; struct hio *hio;
struct g_gate_ctl_io *ggio; struct g_gate_ctl_io *ggio;
struct timeval tstart, tend, tdiff;
unsigned int ii, ncomp, ncomps; unsigned int ii, ncomp, ncomps;
off_t offset, length, synced; off_t offset, length, synced;
bool dorewind; bool dorewind;
@ -1680,8 +1681,10 @@ sync_thread(void *arg __unused)
for (;;) { for (;;) {
mtx_lock(&sync_lock); mtx_lock(&sync_lock);
if (offset >= 0 && !sync_inprogress) { if (offset >= 0 && !sync_inprogress) {
pjdlog_info("Synchronization interrupted. " gettimeofday(&tend, NULL);
"%jd bytes synchronized so far.", timersub(&tend, &tstart, &tdiff);
pjdlog_info("Synchronization interrupted after %#.0T. "
"%NB synchronized so far.", &tdiff,
(intmax_t)synced); (intmax_t)synced);
event_send(res, EVENT_SYNCINTR); event_send(res, EVENT_SYNCINTR);
} }
@ -1713,10 +1716,11 @@ sync_thread(void *arg __unused)
if (offset < 0) if (offset < 0)
pjdlog_info("Nodes are in sync."); pjdlog_info("Nodes are in sync.");
else { else {
pjdlog_info("Synchronization started. %ju bytes to go.", pjdlog_info("Synchronization started. %NB to go.",
(uintmax_t)(res->hr_extentsize * (intmax_t)(res->hr_extentsize *
activemap_ndirty(res->hr_amp))); activemap_ndirty(res->hr_amp)));
event_send(res, EVENT_SYNCSTART); event_send(res, EVENT_SYNCSTART);
gettimeofday(&tstart, NULL);
} }
} }
if (offset < 0) { if (offset < 0) {
@ -1730,9 +1734,17 @@ sync_thread(void *arg __unused)
rw_rlock(&hio_remote_lock[ncomp]); rw_rlock(&hio_remote_lock[ncomp]);
if (ISCONNECTED(res, ncomp)) { if (ISCONNECTED(res, ncomp)) {
if (synced > 0) { if (synced > 0) {
int64_t bps;
gettimeofday(&tend, NULL);
timersub(&tend, &tstart, &tdiff);
bps = (int64_t)((double)synced /
((double)tdiff.tv_sec +
(double)tdiff.tv_usec / 1000000));
pjdlog_info("Synchronization complete. " pjdlog_info("Synchronization complete. "
"%jd bytes synchronized.", "%NB synchronized in %#.0lT (%NB/sec).",
(intmax_t)synced); (intmax_t)synced, &tdiff,
(intmax_t)bps);
event_send(res, EVENT_SYNCDONE); event_send(res, EVENT_SYNCDONE);
} }
mtx_lock(&metadata_lock); mtx_lock(&metadata_lock);