From: NeilBrown <neilb@suse.de>
To: Heinz Mauelshagen <heinzm@redhat.com>,
Alasdair G Kergon <agk@redhat.com>
Cc: linux-raid@vger.kernel.org, dm-devel@redhat.com
Subject: [PATCH 24/24] dm-raid456: switch to use dm_dirty_log for tracking dirty regions.
Date: Tue, 01 Jun 2010 19:56:20 +1000 [thread overview]
Message-ID: <20100601095620.565.21480.stgit@notabene.brown> (raw)
In-Reply-To: <20100601094414.565.3638.stgit@notabene.brown>
Rather than faking a 'core' dirty log, we can now use the dm_dirty_log
mechanism directly and thus potentially benefit from a permanent dirty
log.
Signed-off-by: NeilBrown <neilb@suse.de>
---
drivers/md/dm-raid456.c | 46 +++++++++++++++++++++++++++++++++++++---------
drivers/md/md.h | 2 +-
2 files changed, 38 insertions(+), 10 deletions(-)
diff --git a/drivers/md/dm-raid456.c b/drivers/md/dm-raid456.c
index 3fda954..3dcbc4a 100644
--- a/drivers/md/dm-raid456.c
+++ b/drivers/md/dm-raid456.c
@@ -7,6 +7,8 @@
#include "md.h"
#include "raid5.h"
#include "dm.h"
+#include "bitmap.h"
+#include <linux/dm-dirty-log.h>
struct raid_dev {
struct dm_dev *dev;
@@ -183,7 +185,8 @@ static int raid_ctr(struct dm_target *ti, unsigned argc, char **argv)
{
char *err = NULL;
int errnum = -EINVAL;
- unsigned long cnt;
+ unsigned long cnt, log_cnt;
+ char **log_argv;
struct raid_type *rt;
unsigned long chunk_size;
int recovery = 1;
@@ -192,16 +195,18 @@ static int raid_ctr(struct dm_target *ti, unsigned argc, char **argv)
sector_t sectors_per_dev, chunks;
struct raid_set *rs = NULL;
int in_sync, i;
+ struct dm_dirty_log *log = NULL;
- /* log type - core XXX [no]sync */
+ /* log type - type arg-count args */
err = "Cannot parse log type";
if (argc < 2 ||
- strcmp(argv[0], "core") != 0 ||
strict_strtoul(argv[1], 10, &cnt) < 0 ||
cnt + 2 > argc)
goto err;
- if (cnt >= 2 && strcmp(argv[3], "sync") == 0)
- recovery = 0;
+
+ log_cnt = cnt;
+ log_argv = argv;
+
argc -= cnt+2;
argv += cnt+2;
@@ -276,6 +281,11 @@ static int raid_ctr(struct dm_target *ti, unsigned argc, char **argv)
if (sector_div(chunks, chunk_size))
goto err;
+ log = dm_dirty_log_create(log_argv[0], ti, sectors_per_dev,
+ NULL, log_cnt, log_argv+2);
+ err = "Error creating dirty log";
+ if (!log)
+ goto err;
/* Now the devices: three words each */
rs = context_alloc(rt, chunk_size, recovery,
@@ -318,6 +328,11 @@ static int raid_ctr(struct dm_target *ti, unsigned argc, char **argv)
ti->split_io = rs->md.chunk_sectors;
ti->private = rs;
+ rs->md.bitmap_info.log = log;
+ rs->md.bitmap_info.daemon_sleep = 10 * HZ;
+ rs->md.bitmap_info.chunksize = log->type->get_region_size(log) * 512;
+ rs->md.bitmap_info.external = 1;
+
mutex_lock(&rs->md.reconfig_mutex);
err = "Fail to run raid array";
errnum = md_run(&rs->md);
@@ -332,6 +347,8 @@ static int raid_ctr(struct dm_target *ti, unsigned argc, char **argv)
return 0;
err:
+ if (log)
+ dm_dirty_log_destroy(log);
if (rs)
context_free(rs);
ti->error = err;
@@ -343,6 +360,7 @@ static void raid_dtr(struct dm_target *ti)
struct raid_set *rs = ti->private;
list_del_init(&rs->callbacks.list);
+ dm_dirty_log_destroy(rs->md.bitmap_info.log);
md_stop(&rs->md);
context_free(rs);
}
@@ -362,6 +380,7 @@ static int raid_status(struct dm_target *ti, status_type_t type,
{
struct raid_set *rs = ti->private;
struct raid5_private_data *conf = rs->md.private;
+ struct dm_dirty_log *log = conf->mddev->bitmap_info.log;
int sz = 0;
int rbcnt;
int i;
@@ -394,14 +413,14 @@ static int raid_status(struct dm_target *ti, status_type_t type,
DMEMIT("%llu/%llu ",
(unsigned long long) sync,
(unsigned long long) rs->md.resync_max_sectors);
- DMEMIT("1 core");
+
+ sz += log->type->status(log, type, result + sz, maxlen - sz);
break;
case STATUSTYPE_TABLE:
/* The string you would use to construct this array */
- /* Pretend to use a core log with a region size of 1 sector */
- DMEMIT("core 2 %u %ssync ", 1,
- rs->md.recovery_cp == MaxSector ? "" : "no");
+ sz += log->type->status(log, type, result + sz, maxlen - sz);
+
DMEMIT("%s ", rs->raid_type->name);
DMEMIT("1 %u ", rs->md.chunk_sectors);
@@ -469,19 +488,28 @@ static void raid_io_hints(struct dm_target *ti,
static void raid_presuspend(struct dm_target *ti)
{
struct raid_set *rs = ti->private;
+ struct dm_dirty_log *log = rs->md.bitmap_info.log;
+
md_stop_writes(&rs->md);
+ log->type->presuspend(log);
}
static void raid_postsuspend(struct dm_target *ti)
{
struct raid_set *rs = ti->private;
+ struct dm_dirty_log *log = rs->md.bitmap_info.log;
+
mddev_suspend(&rs->md);
+ log->type->postsuspend(log);
}
static void raid_resume(struct dm_target *ti)
{
struct raid_set *rs = ti->private;
+ struct dm_dirty_log *log = rs->md.bitmap_info.log;
+ log->type->resume(log);
+ bitmap_load(&rs->md);
mddev_resume(&rs->md);
}
diff --git a/drivers/md/md.h b/drivers/md/md.h
index e97466f..e53b355 100644
--- a/drivers/md/md.h
+++ b/drivers/md/md.h
@@ -321,7 +321,7 @@ struct mddev_s
struct mutex mutex;
unsigned long chunksize;
- unsigned long daemon_sleep; /* how many seconds between updates? */
+ unsigned long daemon_sleep; /* how many jiffies between updates? */
unsigned long max_write_behind; /* write-behind mode */
int external;
} bitmap_info;
next prev parent reply other threads:[~2010-06-01 9:56 UTC|newest]
Thread overview: 36+ messages / expand[flat|nested] mbox.gz Atom feed top
2010-06-01 9:56 [PATCH 00/24] dm-raid456 support using md/raid5.c, now with dirty-log NeilBrown
2010-06-01 9:56 ` [PATCH 03/24] md/raid5: ensure we create a unique name for kmem_cache when mddev has no gendisk NeilBrown
2010-06-01 9:56 ` [PATCH 02/24] md/raid5: factor out code for changing size of stripe cache NeilBrown
2010-06-01 9:56 ` [PATCH 01/24] md: reduce dependence on sysfs NeilBrown
2010-06-01 9:56 ` [PATCH 11/24] md/raid5: add simple plugging infrastructure NeilBrown
2010-06-01 9:56 ` [PATCH 05/24] md: split out md_rdev_init NeilBrown
2010-06-01 9:56 ` [PATCH 07/24] md/dm: create dm-raid456 module using md/raid5 NeilBrown
2010-06-01 9:56 ` [PATCH 12/24] md/plug: optionally use plugger to unplug an array during resync/recovery NeilBrown
2010-06-01 9:56 ` [PATCH 04/24] md: be more careful setting MD_CHANGE_CLEAN NeilBrown
2010-06-01 9:56 ` [PATCH 13/24] dm-raid456: support unplug NeilBrown
2010-06-01 9:56 ` [PATCH 08/24] dm-raid456: add support for raising events to userspace NeilBrown
2010-06-01 9:56 ` [PATCH 10/24] dm-raid456: add congestion checking NeilBrown
2010-06-01 9:56 ` [PATCH 06/24] md: export various start/stop interfaces NeilBrown
2010-06-01 9:56 ` [PATCH 09/24] raid5: Don't set read-ahead when there is no queue NeilBrown
2010-06-01 9:56 ` [PATCH 14/24] dm-raid456: add support for setting IO hints NeilBrown
2010-06-01 9:56 ` [PATCH 15/24] dm-raid456: add suspend/resume method NeilBrown
2010-06-01 9:56 ` [PATCH 20/24] md/bitmap: optimise scanning of empty bitmaps NeilBrown
2010-06-01 9:56 ` NeilBrown [this message]
2010-06-01 9:56 ` [PATCH 19/24] md/bitmap: clean up plugging calls NeilBrown
2010-06-01 9:56 ` [PATCH 23/24] md/bitmap: separate out loading a bitmap from initialising the structures NeilBrown
2010-06-01 9:56 ` [PATCH 21/24] dm-dirty-log: allow log size to be different from target size NeilBrown
2010-06-02 14:57 ` Heinz Mauelshagen
2010-06-03 0:10 ` [dm-devel] " Neil Brown
2010-06-03 0:53 ` Heinz Mauelshagen
2010-06-01 9:56 ` [PATCH 17/24] md/bitmap: white space clean up and similar NeilBrown
2010-06-01 9:56 ` [PATCH 18/24] md/bitmap: reduce dependence on sysfs NeilBrown
2010-06-01 9:56 ` [PATCH 16/24] dm-raid456: add message handler NeilBrown
2010-06-01 9:56 ` [PATCH 22/24] md/bitmap: prepare for storing write-intent-bitmap via dm-dirty-log NeilBrown
2010-06-15 13:23 ` [PATCH 00/24] dm-raid456 support using md/raid5.c, now with dirty-log Heinz Mauelshagen
2010-06-15 23:45 ` Neil Brown
2010-06-16 11:26 ` Heinz Mauelshagen
2010-06-17 5:41 ` Neil Brown
2010-06-17 10:47 ` Heinz Mauelshagen
2010-06-18 3:52 ` Neil Brown
2010-06-18 10:42 ` Heinz Mauelshagen
2010-06-21 23:09 ` Neil Brown
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=20100601095620.565.21480.stgit@notabene.brown \
--to=neilb@suse.de \
--cc=agk@redhat.com \
--cc=dm-devel@redhat.com \
--cc=heinzm@redhat.com \
--cc=linux-raid@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.