From: Guangliang Zhao <gzhao@suse.com>
To: linux-kernel@vger.kernel.org, dm-devel@redhat.com
Subject: [PATCH 3/3] dm raid1: add interface to get resync speed
Date: Thu, 22 Nov 2012 14:27:53 +0800 [thread overview]
Message-ID: <1353565673-4233-4-git-send-email-gzhao@suse.com> (raw)
In-Reply-To: <1353565673-4233-1-git-send-email-gzhao@suse.com>
Add ioctl to get resync speed, userspace tool
is dmsetup status:
dmsetup status $device
e.g.
dmsetup status /dev/dm-2
Signed-off-by: Guangliang Zhao <gzhao@suse.com>
---
drivers/md/dm-raid1.c | 19 +++++++++++++++++--
1 file changed, 17 insertions(+), 2 deletions(-)
diff --git a/drivers/md/dm-raid1.c b/drivers/md/dm-raid1.c
index 1da25eb..b7bd93a 100644
--- a/drivers/md/dm-raid1.c
+++ b/drivers/md/dm-raid1.c
@@ -1427,6 +1427,20 @@ static char device_status_char(struct mirror *m)
(test_bit(DM_RAID1_READ_ERROR, &(m->error_type))) ? 'R' : 'U';
}
+/*
+ * get speed from ratelimit_state
+ */
+static unsigned int rlimit_to_speed(struct mirror_set *ms,
+ struct ratelimit_state *rl)
+{
+ sector_t region_size = dm_rh_get_region_size(ms->rh);
+ unsigned int time, burst;
+
+ time = rl->interval / HZ;
+ burst = (rl->burst * region_size) >> 1;
+
+ return burst / time;
+}
static int mirror_status(struct dm_target *ti, status_type_t type,
char *result, unsigned int maxlen)
@@ -1445,9 +1459,10 @@ static int mirror_status(struct dm_target *ti, status_type_t type,
}
buffer[m] = '\0';
- DMEMIT("%llu/%llu 1 %s ",
+ DMEMIT("%llu/%llu 1 %u 1 %s ",
(unsigned long long)log->type->get_sync_count(log),
- (unsigned long long)ms->nr_regions, buffer);
+ (unsigned long long)ms->nr_regions,
+ rlimit_to_speed(ms, &ms->ms_rlimit), buffer);
sz += log->type->status(log, type, result+sz, maxlen-sz);
--
1.7.10.4
next prev parent reply other threads:[~2012-11-22 6:27 UTC|newest]
Thread overview: 10+ messages / expand[flat|nested] mbox.gz Atom feed top
2012-11-22 6:27 [PATCH 0/3] add resync speed control for dm-raid1 Guangliang Zhao
2012-11-22 6:27 ` [PATCH 1/3] dm raid1: " Guangliang Zhao
2012-11-22 6:27 ` [PATCH 2/3] dm raid1: add interface to set resync speed Guangliang Zhao
2012-11-30 11:39 ` [dm-devel] " Lars Marowsky-Bree
2012-12-03 9:12 ` Guangliang Zhao
2012-11-22 6:27 ` Guangliang Zhao [this message]
2012-12-10 2:21 ` [dm-devel] [PATCH 0/3] add resync speed control for dm-raid1 NeilBrown
2012-12-10 12:27 ` Guangliang Zhao
2012-12-11 8:56 ` Lars Marowsky-Bree
2012-12-11 8:56 ` [dm-devel] " Lars Marowsky-Bree
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=1353565673-4233-4-git-send-email-gzhao@suse.com \
--to=gzhao@suse.com \
--cc=dm-devel@redhat.com \
--cc=linux-kernel@vger.kernel.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.