aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/md/dm-raid1.c
diff options
context:
space:
mode:
authorHeinz Mauelshagen <hjm@redhat.com>2008-04-24 16:43:35 -0400
committerAlasdair G Kergon <agk@redhat.com>2008-04-25 08:26:46 -0400
commit416cd17b1982217bca3dc41b9f00b0b38fdaadad (patch)
treedcb73db9876f5b973ad26b47449083b98efad1b6 /drivers/md/dm-raid1.c
parenteb69aca5d3370b81450d68edeebc2bb9a3eb9689 (diff)
dm log: clean interface
Clean up the dm-log interface to prepare for publishing it in include/linux. Signed-off-by: Heinz Mauelshagen <hjm@redhat.com> Signed-off-by: Alasdair G Kergon <agk@redhat.com>
Diffstat (limited to 'drivers/md/dm-raid1.c')
-rw-r--r--drivers/md/dm-raid1.c36
1 files changed, 18 insertions, 18 deletions
diff --git a/drivers/md/dm-raid1.c b/drivers/md/dm-raid1.c
index 32c7c6d10939..5beeced4e522 100644
--- a/drivers/md/dm-raid1.c
+++ b/drivers/md/dm-raid1.c
@@ -74,7 +74,7 @@ struct region_hash {
74 unsigned region_shift; 74 unsigned region_shift;
75 75
76 /* holds persistent region state */ 76 /* holds persistent region state */
77 struct dirty_log *log; 77 struct dm_dirty_log *log;
78 78
79 /* hash table */ 79 /* hash table */
80 rwlock_t hash_lock; 80 rwlock_t hash_lock;
@@ -184,7 +184,7 @@ static void queue_bio(struct mirror_set *ms, struct bio *bio, int rw);
184#define MIN_REGIONS 64 184#define MIN_REGIONS 64
185#define MAX_RECOVERY 1 185#define MAX_RECOVERY 1
186static int rh_init(struct region_hash *rh, struct mirror_set *ms, 186static int rh_init(struct region_hash *rh, struct mirror_set *ms,
187 struct dirty_log *log, uint32_t region_size, 187 struct dm_dirty_log *log, uint32_t region_size,
188 region_t nr_regions) 188 region_t nr_regions)
189{ 189{
190 unsigned int nr_buckets, max_buckets; 190 unsigned int nr_buckets, max_buckets;
@@ -249,7 +249,7 @@ static void rh_exit(struct region_hash *rh)
249 } 249 }
250 250
251 if (rh->log) 251 if (rh->log)
252 dm_destroy_dirty_log(rh->log); 252 dm_dirty_log_destroy(rh->log);
253 if (rh->region_pool) 253 if (rh->region_pool)
254 mempool_destroy(rh->region_pool); 254 mempool_destroy(rh->region_pool);
255 vfree(rh->buckets); 255 vfree(rh->buckets);
@@ -831,7 +831,7 @@ static void do_recovery(struct mirror_set *ms)
831{ 831{
832 int r; 832 int r;
833 struct region *reg; 833 struct region *reg;
834 struct dirty_log *log = ms->rh.log; 834 struct dm_dirty_log *log = ms->rh.log;
835 835
836 /* 836 /*
837 * Start quiescing some regions. 837 * Start quiescing some regions.
@@ -1017,7 +1017,7 @@ static void __bio_mark_nosync(struct mirror_set *ms,
1017{ 1017{
1018 unsigned long flags; 1018 unsigned long flags;
1019 struct region_hash *rh = &ms->rh; 1019 struct region_hash *rh = &ms->rh;
1020 struct dirty_log *log = ms->rh.log; 1020 struct dm_dirty_log *log = ms->rh.log;
1021 struct region *reg; 1021 struct region *reg;
1022 region_t region = bio_to_region(rh, bio); 1022 region_t region = bio_to_region(rh, bio);
1023 int recovering = 0; 1023 int recovering = 0;
@@ -1301,7 +1301,7 @@ static void do_mirror(struct work_struct *work)
1301static struct mirror_set *alloc_context(unsigned int nr_mirrors, 1301static struct mirror_set *alloc_context(unsigned int nr_mirrors,
1302 uint32_t region_size, 1302 uint32_t region_size,
1303 struct dm_target *ti, 1303 struct dm_target *ti,
1304 struct dirty_log *dl) 1304 struct dm_dirty_log *dl)
1305{ 1305{
1306 size_t len; 1306 size_t len;
1307 struct mirror_set *ms = NULL; 1307 struct mirror_set *ms = NULL;
@@ -1401,12 +1401,12 @@ static int get_mirror(struct mirror_set *ms, struct dm_target *ti,
1401/* 1401/*
1402 * Create dirty log: log_type #log_params <log_params> 1402 * Create dirty log: log_type #log_params <log_params>
1403 */ 1403 */
1404static struct dirty_log *create_dirty_log(struct dm_target *ti, 1404static struct dm_dirty_log *create_dirty_log(struct dm_target *ti,
1405 unsigned int argc, char **argv, 1405 unsigned int argc, char **argv,
1406 unsigned int *args_used) 1406 unsigned int *args_used)
1407{ 1407{
1408 unsigned int param_count; 1408 unsigned int param_count;
1409 struct dirty_log *dl; 1409 struct dm_dirty_log *dl;
1410 1410
1411 if (argc < 2) { 1411 if (argc < 2) {
1412 ti->error = "Insufficient mirror log arguments"; 1412 ti->error = "Insufficient mirror log arguments";
@@ -1425,7 +1425,7 @@ static struct dirty_log *create_dirty_log(struct dm_target *ti,
1425 return NULL; 1425 return NULL;
1426 } 1426 }
1427 1427
1428 dl = dm_create_dirty_log(argv[0], ti, param_count, argv + 2); 1428 dl = dm_dirty_log_create(argv[0], ti, param_count, argv + 2);
1429 if (!dl) { 1429 if (!dl) {
1430 ti->error = "Error creating mirror dirty log"; 1430 ti->error = "Error creating mirror dirty log";
1431 return NULL; 1431 return NULL;
@@ -1433,7 +1433,7 @@ static struct dirty_log *create_dirty_log(struct dm_target *ti,
1433 1433
1434 if (!_check_region_size(ti, dl->type->get_region_size(dl))) { 1434 if (!_check_region_size(ti, dl->type->get_region_size(dl))) {
1435 ti->error = "Invalid region size"; 1435 ti->error = "Invalid region size";
1436 dm_destroy_dirty_log(dl); 1436 dm_dirty_log_destroy(dl);
1437 return NULL; 1437 return NULL;
1438 } 1438 }
1439 1439
@@ -1494,7 +1494,7 @@ static int mirror_ctr(struct dm_target *ti, unsigned int argc, char **argv)
1494 int r; 1494 int r;
1495 unsigned int nr_mirrors, m, args_used; 1495 unsigned int nr_mirrors, m, args_used;
1496 struct mirror_set *ms; 1496 struct mirror_set *ms;
1497 struct dirty_log *dl; 1497 struct dm_dirty_log *dl;
1498 1498
1499 dl = create_dirty_log(ti, argc, argv, &args_used); 1499 dl = create_dirty_log(ti, argc, argv, &args_used);
1500 if (!dl) 1500 if (!dl)
@@ -1506,7 +1506,7 @@ static int mirror_ctr(struct dm_target *ti, unsigned int argc, char **argv)
1506 if (!argc || sscanf(argv[0], "%u", &nr_mirrors) != 1 || 1506 if (!argc || sscanf(argv[0], "%u", &nr_mirrors) != 1 ||
1507 nr_mirrors < 2 || nr_mirrors > DM_KCOPYD_MAX_REGIONS + 1) { 1507 nr_mirrors < 2 || nr_mirrors > DM_KCOPYD_MAX_REGIONS + 1) {
1508 ti->error = "Invalid number of mirrors"; 1508 ti->error = "Invalid number of mirrors";
1509 dm_destroy_dirty_log(dl); 1509 dm_dirty_log_destroy(dl);
1510 return -EINVAL; 1510 return -EINVAL;
1511 } 1511 }
1512 1512
@@ -1514,13 +1514,13 @@ static int mirror_ctr(struct dm_target *ti, unsigned int argc, char **argv)
1514 1514
1515 if (argc < nr_mirrors * 2) { 1515 if (argc < nr_mirrors * 2) {
1516 ti->error = "Too few mirror arguments"; 1516 ti->error = "Too few mirror arguments";
1517 dm_destroy_dirty_log(dl); 1517 dm_dirty_log_destroy(dl);
1518 return -EINVAL; 1518 return -EINVAL;
1519 } 1519 }
1520 1520
1521 ms = alloc_context(nr_mirrors, dl->type->get_region_size(dl), ti, dl); 1521 ms = alloc_context(nr_mirrors, dl->type->get_region_size(dl), ti, dl);
1522 if (!ms) { 1522 if (!ms) {
1523 dm_destroy_dirty_log(dl); 1523 dm_dirty_log_destroy(dl);
1524 return -ENOMEM; 1524 return -ENOMEM;
1525 } 1525 }
1526 1526
@@ -1732,7 +1732,7 @@ out:
1732static void mirror_presuspend(struct dm_target *ti) 1732static void mirror_presuspend(struct dm_target *ti)
1733{ 1733{
1734 struct mirror_set *ms = (struct mirror_set *) ti->private; 1734 struct mirror_set *ms = (struct mirror_set *) ti->private;
1735 struct dirty_log *log = ms->rh.log; 1735 struct dm_dirty_log *log = ms->rh.log;
1736 1736
1737 atomic_set(&ms->suspend, 1); 1737 atomic_set(&ms->suspend, 1);
1738 1738
@@ -1761,7 +1761,7 @@ static void mirror_presuspend(struct dm_target *ti)
1761static void mirror_postsuspend(struct dm_target *ti) 1761static void mirror_postsuspend(struct dm_target *ti)
1762{ 1762{
1763 struct mirror_set *ms = ti->private; 1763 struct mirror_set *ms = ti->private;
1764 struct dirty_log *log = ms->rh.log; 1764 struct dm_dirty_log *log = ms->rh.log;
1765 1765
1766 if (log->type->postsuspend && log->type->postsuspend(log)) 1766 if (log->type->postsuspend && log->type->postsuspend(log))
1767 /* FIXME: need better error handling */ 1767 /* FIXME: need better error handling */
@@ -1771,7 +1771,7 @@ static void mirror_postsuspend(struct dm_target *ti)
1771static void mirror_resume(struct dm_target *ti) 1771static void mirror_resume(struct dm_target *ti)
1772{ 1772{
1773 struct mirror_set *ms = ti->private; 1773 struct mirror_set *ms = ti->private;
1774 struct dirty_log *log = ms->rh.log; 1774 struct dm_dirty_log *log = ms->rh.log;
1775 1775
1776 atomic_set(&ms->suspend, 0); 1776 atomic_set(&ms->suspend, 0);
1777 if (log->type->resume && log->type->resume(log)) 1777 if (log->type->resume && log->type->resume(log))
@@ -1809,7 +1809,7 @@ static int mirror_status(struct dm_target *ti, status_type_t type,
1809{ 1809{
1810 unsigned int m, sz = 0; 1810 unsigned int m, sz = 0;
1811 struct mirror_set *ms = (struct mirror_set *) ti->private; 1811 struct mirror_set *ms = (struct mirror_set *) ti->private;
1812 struct dirty_log *log = ms->rh.log; 1812 struct dm_dirty_log *log = ms->rh.log;
1813 char buffer[ms->nr_mirrors + 1]; 1813 char buffer[ms->nr_mirrors + 1];
1814 1814
1815 switch (type) { 1815 switch (type) {