Commit d1a7c503 authored by NeilBrown's avatar NeilBrown

md: don't display meaningless values in sysfs files resync_start and sync_speed

When no resync if happening, both of these files currently have
meaningless values (is slightly different ways).
Change them to "none" in that case.
Signed-off-by: default avatarNeilBrown <neilb@suse.de>
parent 88ce4930
...@@ -2888,6 +2888,8 @@ __ATTR(chunk_size, S_IRUGO|S_IWUSR, chunk_size_show, chunk_size_store); ...@@ -2888,6 +2888,8 @@ __ATTR(chunk_size, S_IRUGO|S_IWUSR, chunk_size_show, chunk_size_store);
static ssize_t static ssize_t
resync_start_show(mddev_t *mddev, char *page) resync_start_show(mddev_t *mddev, char *page)
{ {
if (mddev->recovery_cp == MaxSector)
return sprintf(page, "none\n");
return sprintf(page, "%llu\n", (unsigned long long)mddev->recovery_cp); return sprintf(page, "%llu\n", (unsigned long long)mddev->recovery_cp);
} }
...@@ -3469,6 +3471,8 @@ static ssize_t ...@@ -3469,6 +3471,8 @@ static ssize_t
sync_speed_show(mddev_t *mddev, char *page) sync_speed_show(mddev_t *mddev, char *page)
{ {
unsigned long resync, dt, db; unsigned long resync, dt, db;
if (mddev->curr_resync == 0)
return sprintf(page, "none\n");
resync = mddev->curr_mark_cnt - atomic_read(&mddev->recovery_active); resync = mddev->curr_mark_cnt - atomic_read(&mddev->recovery_active);
dt = (jiffies - mddev->resync_mark) / HZ; dt = (jiffies - mddev->resync_mark) / HZ;
if (!dt) dt++; if (!dt) dt++;
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment