From: Guangliang Zhao <gzhao@suse.com>
To: linux-kernel@vger.kernel.org, dm-devel@redhat.com
Cc: lucienchao@gmail.com
Subject: [PATCH 3/3 v3] dm raid1: add interface to get resync speed
Date: Mon, 7 Jan 2013 18:02:13 +0800 [thread overview]
Message-ID: <1357552933-26126-4-git-send-email-gzhao@suse.com> (raw)
In-Reply-To: <1357552933-26126-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 | 16 ++++++++++++++++
1 file changed, 16 insertions(+)
diff --git a/drivers/md/dm-raid1.c b/drivers/md/dm-raid1.c
index 3cdad37..62acfa3 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)
@@ -1451,6 +1465,8 @@ static int mirror_status(struct dm_target *ti, status_type_t type,
sz += log->type->status(log, type, result+sz, maxlen-sz);
+ DMEMIT(" %u", rlimit_to_speed(ms, &ms->ms_rlimit));
+
break;
case STATUSTYPE_TABLE:
--
1.7.10.4
next prev parent reply other threads:[~2013-01-07 10:03 UTC|newest]
Thread overview: 12+ messages / expand[flat|nested] mbox.gz Atom feed top
2013-01-07 10:02 [PATCH 0/3 v3] add resync speed control for dm-raid1 Guangliang Zhao
2013-01-07 10:02 ` [PATCH 1/3 v3] dm raid1: " Guangliang Zhao
2013-01-07 10:02 ` [PATCH 2/3 v3] dm raid1: add interface to set resync speed Guangliang Zhao
2013-01-07 10:02 ` Guangliang Zhao [this message]
2013-01-09 5:43 ` [dm-devel] [PATCH 0/3 v3] add resync speed control for dm-raid1 Mikulas Patocka
2013-01-16 8:21 ` Guangliang Zhao
2013-01-23 1:44 ` Mikulas Patocka
2013-01-23 4:20 ` NeilBrown
2013-02-06 0:24 ` Mikulas Patocka
2013-01-09 5:44 ` [PATCH 1/2] mirror throttling Mikulas Patocka
2013-01-09 5:44 ` [PATCH 2/2] " Mikulas Patocka
2013-02-15 0:53 ` Alasdair G Kergon
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=1357552933-26126-4-git-send-email-gzhao@suse.com \
--to=gzhao@suse.com \
--cc=dm-devel@redhat.com \
--cc=linux-kernel@vger.kernel.org \
--cc=lucienchao@gmail.com \
/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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox
all inboxes | Powered by JetHome®