Commit 416cd17b1982217bca3dc41b9f00b0b38fdaadad
Committed by
Alasdair G Kergon
1 parent
eb69aca5d3
Exists in
master
and in
7 other branches
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>
Showing 5 changed files with 114 additions and 103 deletions Side-by-side Diff
drivers/md/dm-log.c
... | ... | @@ -12,13 +12,14 @@ |
12 | 12 | |
13 | 13 | #include "dm-log.h" |
14 | 14 | #include "dm-io.h" |
15 | +#include "dm.h" | |
15 | 16 | |
16 | 17 | #define DM_MSG_PREFIX "dirty region log" |
17 | 18 | |
18 | 19 | static LIST_HEAD(_log_types); |
19 | 20 | static DEFINE_SPINLOCK(_lock); |
20 | 21 | |
21 | -int dm_register_dirty_log_type(struct dirty_log_type *type) | |
22 | +int dm_dirty_log_type_register(struct dm_dirty_log_type *type) | |
22 | 23 | { |
23 | 24 | spin_lock(&_lock); |
24 | 25 | type->use_count = 0; |
25 | 26 | |
... | ... | @@ -27,8 +28,9 @@ |
27 | 28 | |
28 | 29 | return 0; |
29 | 30 | } |
31 | +EXPORT_SYMBOL(dm_dirty_log_type_register); | |
30 | 32 | |
31 | -int dm_unregister_dirty_log_type(struct dirty_log_type *type) | |
33 | +int dm_dirty_log_type_unregister(struct dm_dirty_log_type *type) | |
32 | 34 | { |
33 | 35 | spin_lock(&_lock); |
34 | 36 | |
35 | 37 | |
36 | 38 | |
... | ... | @@ -41,10 +43,11 @@ |
41 | 43 | |
42 | 44 | return 0; |
43 | 45 | } |
46 | +EXPORT_SYMBOL(dm_dirty_log_type_unregister); | |
44 | 47 | |
45 | -static struct dirty_log_type *_get_type(const char *type_name) | |
48 | +static struct dm_dirty_log_type *_get_type(const char *type_name) | |
46 | 49 | { |
47 | - struct dirty_log_type *type; | |
50 | + struct dm_dirty_log_type *type; | |
48 | 51 | |
49 | 52 | spin_lock(&_lock); |
50 | 53 | list_for_each_entry (type, &_log_types, list) |
51 | 54 | |
... | ... | @@ -79,10 +82,10 @@ |
79 | 82 | * |
80 | 83 | * Returns: dirty_log_type* on success, NULL on failure |
81 | 84 | */ |
82 | -static struct dirty_log_type *get_type(const char *type_name) | |
85 | +static struct dm_dirty_log_type *get_type(const char *type_name) | |
83 | 86 | { |
84 | 87 | char *p, *type_name_dup; |
85 | - struct dirty_log_type *type; | |
88 | + struct dm_dirty_log_type *type; | |
86 | 89 | |
87 | 90 | type = _get_type(type_name); |
88 | 91 | if (type) |
... | ... | @@ -111,7 +114,7 @@ |
111 | 114 | return type; |
112 | 115 | } |
113 | 116 | |
114 | -static void put_type(struct dirty_log_type *type) | |
117 | +static void put_type(struct dm_dirty_log_type *type) | |
115 | 118 | { |
116 | 119 | spin_lock(&_lock); |
117 | 120 | if (!--type->use_count) |
118 | 121 | |
... | ... | @@ -119,11 +122,12 @@ |
119 | 122 | spin_unlock(&_lock); |
120 | 123 | } |
121 | 124 | |
122 | -struct dirty_log *dm_create_dirty_log(const char *type_name, struct dm_target *ti, | |
123 | - unsigned int argc, char **argv) | |
125 | +struct dm_dirty_log *dm_dirty_log_create(const char *type_name, | |
126 | + struct dm_target *ti, | |
127 | + unsigned int argc, char **argv) | |
124 | 128 | { |
125 | - struct dirty_log_type *type; | |
126 | - struct dirty_log *log; | |
129 | + struct dm_dirty_log_type *type; | |
130 | + struct dm_dirty_log *log; | |
127 | 131 | |
128 | 132 | log = kmalloc(sizeof(*log), GFP_KERNEL); |
129 | 133 | if (!log) |
130 | 134 | |
131 | 135 | |
... | ... | @@ -144,13 +148,15 @@ |
144 | 148 | |
145 | 149 | return log; |
146 | 150 | } |
151 | +EXPORT_SYMBOL(dm_dirty_log_create); | |
147 | 152 | |
148 | -void dm_destroy_dirty_log(struct dirty_log *log) | |
153 | +void dm_dirty_log_destroy(struct dm_dirty_log *log) | |
149 | 154 | { |
150 | 155 | log->type->dtr(log); |
151 | 156 | put_type(log->type); |
152 | 157 | kfree(log); |
153 | 158 | } |
159 | +EXPORT_SYMBOL(dm_dirty_log_destroy); | |
154 | 160 | |
155 | 161 | /*----------------------------------------------------------------- |
156 | 162 | * Persistent and core logs share a lot of their implementation. |
... | ... | @@ -216,7 +222,7 @@ |
216 | 222 | * The touched member needs to be updated every time we access |
217 | 223 | * one of the bitsets. |
218 | 224 | */ |
219 | -static inline int log_test_bit(uint32_t *bs, unsigned bit) | |
225 | +static inline int log_test_bit(uint32_t *bs, unsigned bit) | |
220 | 226 | { |
221 | 227 | return ext2_test_bit(bit, (unsigned long *) bs) ? 1 : 0; |
222 | 228 | } |
... | ... | @@ -303,7 +309,7 @@ |
303 | 309 | * argv contains region_size followed optionally by [no]sync |
304 | 310 | *--------------------------------------------------------------*/ |
305 | 311 | #define BYTE_SHIFT 3 |
306 | -static int create_log_context(struct dirty_log *log, struct dm_target *ti, | |
312 | +static int create_log_context(struct dm_dirty_log *log, struct dm_target *ti, | |
307 | 313 | unsigned int argc, char **argv, |
308 | 314 | struct dm_dev *dev) |
309 | 315 | { |
... | ... | @@ -435,7 +441,7 @@ |
435 | 441 | return 0; |
436 | 442 | } |
437 | 443 | |
438 | -static int core_ctr(struct dirty_log *log, struct dm_target *ti, | |
444 | +static int core_ctr(struct dm_dirty_log *log, struct dm_target *ti, | |
439 | 445 | unsigned int argc, char **argv) |
440 | 446 | { |
441 | 447 | return create_log_context(log, ti, argc, argv, NULL); |
... | ... | @@ -448,7 +454,7 @@ |
448 | 454 | kfree(lc); |
449 | 455 | } |
450 | 456 | |
451 | -static void core_dtr(struct dirty_log *log) | |
457 | +static void core_dtr(struct dm_dirty_log *log) | |
452 | 458 | { |
453 | 459 | struct log_c *lc = (struct log_c *) log->context; |
454 | 460 | |
... | ... | @@ -461,7 +467,7 @@ |
461 | 467 | * |
462 | 468 | * argv contains log_device region_size followed optionally by [no]sync |
463 | 469 | *--------------------------------------------------------------*/ |
464 | -static int disk_ctr(struct dirty_log *log, struct dm_target *ti, | |
470 | +static int disk_ctr(struct dm_dirty_log *log, struct dm_target *ti, | |
465 | 471 | unsigned int argc, char **argv) |
466 | 472 | { |
467 | 473 | int r; |
... | ... | @@ -486,7 +492,7 @@ |
486 | 492 | return 0; |
487 | 493 | } |
488 | 494 | |
489 | -static void disk_dtr(struct dirty_log *log) | |
495 | +static void disk_dtr(struct dm_dirty_log *log) | |
490 | 496 | { |
491 | 497 | struct log_c *lc = (struct log_c *) log->context; |
492 | 498 | |
... | ... | @@ -515,7 +521,7 @@ |
515 | 521 | dm_table_event(lc->ti->table); |
516 | 522 | } |
517 | 523 | |
518 | -static int disk_resume(struct dirty_log *log) | |
524 | +static int disk_resume(struct dm_dirty_log *log) | |
519 | 525 | { |
520 | 526 | int r; |
521 | 527 | unsigned i; |
522 | 528 | |
523 | 529 | |
524 | 530 | |
525 | 531 | |
526 | 532 | |
... | ... | @@ -571,38 +577,38 @@ |
571 | 577 | return r; |
572 | 578 | } |
573 | 579 | |
574 | -static uint32_t core_get_region_size(struct dirty_log *log) | |
580 | +static uint32_t core_get_region_size(struct dm_dirty_log *log) | |
575 | 581 | { |
576 | 582 | struct log_c *lc = (struct log_c *) log->context; |
577 | 583 | return lc->region_size; |
578 | 584 | } |
579 | 585 | |
580 | -static int core_resume(struct dirty_log *log) | |
586 | +static int core_resume(struct dm_dirty_log *log) | |
581 | 587 | { |
582 | 588 | struct log_c *lc = (struct log_c *) log->context; |
583 | 589 | lc->sync_search = 0; |
584 | 590 | return 0; |
585 | 591 | } |
586 | 592 | |
587 | -static int core_is_clean(struct dirty_log *log, region_t region) | |
593 | +static int core_is_clean(struct dm_dirty_log *log, region_t region) | |
588 | 594 | { |
589 | 595 | struct log_c *lc = (struct log_c *) log->context; |
590 | 596 | return log_test_bit(lc->clean_bits, region); |
591 | 597 | } |
592 | 598 | |
593 | -static int core_in_sync(struct dirty_log *log, region_t region, int block) | |
599 | +static int core_in_sync(struct dm_dirty_log *log, region_t region, int block) | |
594 | 600 | { |
595 | 601 | struct log_c *lc = (struct log_c *) log->context; |
596 | 602 | return log_test_bit(lc->sync_bits, region); |
597 | 603 | } |
598 | 604 | |
599 | -static int core_flush(struct dirty_log *log) | |
605 | +static int core_flush(struct dm_dirty_log *log) | |
600 | 606 | { |
601 | 607 | /* no op */ |
602 | 608 | return 0; |
603 | 609 | } |
604 | 610 | |
605 | -static int disk_flush(struct dirty_log *log) | |
611 | +static int disk_flush(struct dm_dirty_log *log) | |
606 | 612 | { |
607 | 613 | int r; |
608 | 614 | struct log_c *lc = (struct log_c *) log->context; |
609 | 615 | |
610 | 616 | |
... | ... | @@ -620,19 +626,19 @@ |
620 | 626 | return r; |
621 | 627 | } |
622 | 628 | |
623 | -static void core_mark_region(struct dirty_log *log, region_t region) | |
629 | +static void core_mark_region(struct dm_dirty_log *log, region_t region) | |
624 | 630 | { |
625 | 631 | struct log_c *lc = (struct log_c *) log->context; |
626 | 632 | log_clear_bit(lc, lc->clean_bits, region); |
627 | 633 | } |
628 | 634 | |
629 | -static void core_clear_region(struct dirty_log *log, region_t region) | |
635 | +static void core_clear_region(struct dm_dirty_log *log, region_t region) | |
630 | 636 | { |
631 | 637 | struct log_c *lc = (struct log_c *) log->context; |
632 | 638 | log_set_bit(lc, lc->clean_bits, region); |
633 | 639 | } |
634 | 640 | |
635 | -static int core_get_resync_work(struct dirty_log *log, region_t *region) | |
641 | +static int core_get_resync_work(struct dm_dirty_log *log, region_t *region) | |
636 | 642 | { |
637 | 643 | struct log_c *lc = (struct log_c *) log->context; |
638 | 644 | |
... | ... | @@ -655,7 +661,7 @@ |
655 | 661 | return 1; |
656 | 662 | } |
657 | 663 | |
658 | -static void core_set_region_sync(struct dirty_log *log, region_t region, | |
664 | +static void core_set_region_sync(struct dm_dirty_log *log, region_t region, | |
659 | 665 | int in_sync) |
660 | 666 | { |
661 | 667 | struct log_c *lc = (struct log_c *) log->context; |
... | ... | @@ -670,7 +676,7 @@ |
670 | 676 | } |
671 | 677 | } |
672 | 678 | |
673 | -static region_t core_get_sync_count(struct dirty_log *log) | |
679 | +static region_t core_get_sync_count(struct dm_dirty_log *log) | |
674 | 680 | { |
675 | 681 | struct log_c *lc = (struct log_c *) log->context; |
676 | 682 | |
... | ... | @@ -681,7 +687,7 @@ |
681 | 687 | if (lc->sync != DEFAULTSYNC) \ |
682 | 688 | DMEMIT("%ssync ", lc->sync == NOSYNC ? "no" : "") |
683 | 689 | |
684 | -static int core_status(struct dirty_log *log, status_type_t status, | |
690 | +static int core_status(struct dm_dirty_log *log, status_type_t status, | |
685 | 691 | char *result, unsigned int maxlen) |
686 | 692 | { |
687 | 693 | int sz = 0; |
... | ... | @@ -701,7 +707,7 @@ |
701 | 707 | return sz; |
702 | 708 | } |
703 | 709 | |
704 | -static int disk_status(struct dirty_log *log, status_type_t status, | |
710 | +static int disk_status(struct dm_dirty_log *log, status_type_t status, | |
705 | 711 | char *result, unsigned int maxlen) |
706 | 712 | { |
707 | 713 | int sz = 0; |
... | ... | @@ -723,7 +729,7 @@ |
723 | 729 | return sz; |
724 | 730 | } |
725 | 731 | |
726 | -static struct dirty_log_type _core_type = { | |
732 | +static struct dm_dirty_log_type _core_type = { | |
727 | 733 | .name = "core", |
728 | 734 | .module = THIS_MODULE, |
729 | 735 | .ctr = core_ctr, |
... | ... | @@ -741,7 +747,7 @@ |
741 | 747 | .status = core_status, |
742 | 748 | }; |
743 | 749 | |
744 | -static struct dirty_log_type _disk_type = { | |
750 | +static struct dm_dirty_log_type _disk_type = { | |
745 | 751 | .name = "disk", |
746 | 752 | .module = THIS_MODULE, |
747 | 753 | .ctr = disk_ctr, |
748 | 754 | |
749 | 755 | |
... | ... | @@ -764,14 +770,14 @@ |
764 | 770 | { |
765 | 771 | int r; |
766 | 772 | |
767 | - r = dm_register_dirty_log_type(&_core_type); | |
773 | + r = dm_dirty_log_type_register(&_core_type); | |
768 | 774 | if (r) |
769 | 775 | DMWARN("couldn't register core log"); |
770 | 776 | |
771 | - r = dm_register_dirty_log_type(&_disk_type); | |
777 | + r = dm_dirty_log_type_register(&_disk_type); | |
772 | 778 | if (r) { |
773 | 779 | DMWARN("couldn't register disk type"); |
774 | - dm_unregister_dirty_log_type(&_core_type); | |
780 | + dm_dirty_log_type_unregister(&_core_type); | |
775 | 781 | } |
776 | 782 | |
777 | 783 | return r; |
778 | 784 | |
... | ... | @@ -779,14 +785,9 @@ |
779 | 785 | |
780 | 786 | void __exit dm_dirty_log_exit(void) |
781 | 787 | { |
782 | - dm_unregister_dirty_log_type(&_disk_type); | |
783 | - dm_unregister_dirty_log_type(&_core_type); | |
788 | + dm_dirty_log_type_unregister(&_disk_type); | |
789 | + dm_dirty_log_type_unregister(&_core_type); | |
784 | 790 | } |
785 | - | |
786 | -EXPORT_SYMBOL(dm_register_dirty_log_type); | |
787 | -EXPORT_SYMBOL(dm_unregister_dirty_log_type); | |
788 | -EXPORT_SYMBOL(dm_create_dirty_log); | |
789 | -EXPORT_SYMBOL(dm_destroy_dirty_log); | |
790 | 791 | |
791 | 792 | module_init(dm_dirty_log_init); |
792 | 793 | module_exit(dm_dirty_log_exit); |
drivers/md/dm-log.h
1 | 1 | /* |
2 | 2 | * Copyright (C) 2003 Sistina Software |
3 | + * Copyright (C) 2004-2008 Red Hat, Inc. All rights reserved. | |
3 | 4 | * |
5 | + * Device-Mapper dirty region log. | |
6 | + * | |
4 | 7 | * This file is released under the LGPL. |
5 | 8 | */ |
6 | 9 | |
7 | -#ifndef DM_DIRTY_LOG | |
8 | -#define DM_DIRTY_LOG | |
10 | +#ifndef _LINUX_DM_DIRTY_LOG | |
11 | +#define _LINUX_DM_DIRTY_LOG | |
9 | 12 | |
10 | -#include "dm.h" | |
13 | +#ifdef __KERNEL__ | |
11 | 14 | |
15 | +#include <linux/types.h> | |
16 | +#include <linux/device-mapper.h> | |
17 | + | |
12 | 18 | typedef sector_t region_t; |
13 | 19 | |
14 | -struct dirty_log_type; | |
20 | +struct dm_dirty_log_type; | |
15 | 21 | |
16 | -struct dirty_log { | |
17 | - struct dirty_log_type *type; | |
22 | +struct dm_dirty_log { | |
23 | + struct dm_dirty_log_type *type; | |
18 | 24 | void *context; |
19 | 25 | }; |
20 | 26 | |
21 | -struct dirty_log_type { | |
27 | +struct dm_dirty_log_type { | |
22 | 28 | struct list_head list; |
23 | 29 | const char *name; |
24 | 30 | struct module *module; |
25 | - unsigned int use_count; | |
31 | + unsigned use_count; | |
26 | 32 | |
27 | - int (*ctr)(struct dirty_log *log, struct dm_target *ti, | |
28 | - unsigned int argc, char **argv); | |
29 | - void (*dtr)(struct dirty_log *log); | |
33 | + int (*ctr)(struct dm_dirty_log *log, struct dm_target *ti, | |
34 | + unsigned argc, char **argv); | |
35 | + void (*dtr)(struct dm_dirty_log *log); | |
30 | 36 | |
31 | 37 | /* |
32 | 38 | * There are times when we don't want the log to touch |
33 | 39 | * the disk. |
34 | 40 | */ |
35 | - int (*presuspend)(struct dirty_log *log); | |
36 | - int (*postsuspend)(struct dirty_log *log); | |
37 | - int (*resume)(struct dirty_log *log); | |
41 | + int (*presuspend)(struct dm_dirty_log *log); | |
42 | + int (*postsuspend)(struct dm_dirty_log *log); | |
43 | + int (*resume)(struct dm_dirty_log *log); | |
38 | 44 | |
39 | 45 | /* |
40 | 46 | * Retrieves the smallest size of region that the log can |
41 | 47 | * deal with. |
42 | 48 | */ |
43 | - uint32_t (*get_region_size)(struct dirty_log *log); | |
49 | + uint32_t (*get_region_size)(struct dm_dirty_log *log); | |
44 | 50 | |
45 | - /* | |
51 | + /* | |
46 | 52 | * A predicate to say whether a region is clean or not. |
47 | 53 | * May block. |
48 | 54 | */ |
49 | - int (*is_clean)(struct dirty_log *log, region_t region); | |
55 | + int (*is_clean)(struct dm_dirty_log *log, region_t region); | |
50 | 56 | |
51 | 57 | /* |
52 | 58 | * Returns: 0, 1, -EWOULDBLOCK, < 0 |
53 | 59 | |
... | ... | @@ -59,13 +65,14 @@ |
59 | 65 | * passed to a daemon to deal with, since a daemon is |
60 | 66 | * allowed to block. |
61 | 67 | */ |
62 | - int (*in_sync)(struct dirty_log *log, region_t region, int can_block); | |
68 | + int (*in_sync)(struct dm_dirty_log *log, region_t region, | |
69 | + int can_block); | |
63 | 70 | |
64 | 71 | /* |
65 | 72 | * Flush the current log state (eg, to disk). This |
66 | 73 | * function may block. |
67 | 74 | */ |
68 | - int (*flush)(struct dirty_log *log); | |
75 | + int (*flush)(struct dm_dirty_log *log); | |
69 | 76 | |
70 | 77 | /* |
71 | 78 | * Mark an area as clean or dirty. These functions may |
... | ... | @@ -73,8 +80,8 @@ |
73 | 80 | * be extremely rare (eg, allocating another chunk of |
74 | 81 | * memory for some reason). |
75 | 82 | */ |
76 | - void (*mark_region)(struct dirty_log *log, region_t region); | |
77 | - void (*clear_region)(struct dirty_log *log, region_t region); | |
83 | + void (*mark_region)(struct dm_dirty_log *log, region_t region); | |
84 | + void (*clear_region)(struct dm_dirty_log *log, region_t region); | |
78 | 85 | |
79 | 86 | /* |
80 | 87 | * Returns: <0 (error), 0 (no region), 1 (region) |
81 | 88 | |
82 | 89 | |
83 | 90 | |
84 | 91 | |
85 | 92 | |
86 | 93 | |
87 | 94 | |
88 | 95 | |
... | ... | @@ -88,45 +95,40 @@ |
88 | 95 | * tells you if an area is synchronised, the other |
89 | 96 | * assigns recovery work. |
90 | 97 | */ |
91 | - int (*get_resync_work)(struct dirty_log *log, region_t *region); | |
98 | + int (*get_resync_work)(struct dm_dirty_log *log, region_t *region); | |
92 | 99 | |
93 | 100 | /* |
94 | 101 | * This notifies the log that the resync status of a region |
95 | 102 | * has changed. It also clears the region from the recovering |
96 | 103 | * list (if present). |
97 | 104 | */ |
98 | - void (*set_region_sync)(struct dirty_log *log, | |
105 | + void (*set_region_sync)(struct dm_dirty_log *log, | |
99 | 106 | region_t region, int in_sync); |
100 | 107 | |
101 | - /* | |
108 | + /* | |
102 | 109 | * Returns the number of regions that are in sync. |
103 | - */ | |
104 | - region_t (*get_sync_count)(struct dirty_log *log); | |
110 | + */ | |
111 | + region_t (*get_sync_count)(struct dm_dirty_log *log); | |
105 | 112 | |
106 | 113 | /* |
107 | 114 | * Support function for mirror status requests. |
108 | 115 | */ |
109 | - int (*status)(struct dirty_log *log, status_type_t status_type, | |
110 | - char *result, unsigned int maxlen); | |
116 | + int (*status)(struct dm_dirty_log *log, status_type_t status_type, | |
117 | + char *result, unsigned maxlen); | |
111 | 118 | }; |
112 | 119 | |
113 | -int dm_register_dirty_log_type(struct dirty_log_type *type); | |
114 | -int dm_unregister_dirty_log_type(struct dirty_log_type *type); | |
120 | +int dm_dirty_log_type_register(struct dm_dirty_log_type *type); | |
121 | +int dm_dirty_log_type_unregister(struct dm_dirty_log_type *type); | |
115 | 122 | |
116 | - | |
117 | 123 | /* |
118 | 124 | * Make sure you use these two functions, rather than calling |
119 | 125 | * type->constructor/destructor() directly. |
120 | 126 | */ |
121 | -struct dirty_log *dm_create_dirty_log(const char *type_name, struct dm_target *ti, | |
122 | - unsigned int argc, char **argv); | |
123 | -void dm_destroy_dirty_log(struct dirty_log *log); | |
127 | +struct dm_dirty_log *dm_dirty_log_create(const char *type_name, | |
128 | + struct dm_target *ti, | |
129 | + unsigned argc, char **argv); | |
130 | +void dm_dirty_log_destroy(struct dm_dirty_log *log); | |
124 | 131 | |
125 | -/* | |
126 | - * init/exit functions. | |
127 | - */ | |
128 | -int dm_dirty_log_init(void); | |
129 | -void dm_dirty_log_exit(void); | |
130 | - | |
131 | -#endif | |
132 | +#endif /* __KERNEL__ */ | |
133 | +#endif /* _LINUX_DM_DIRTY_LOG_H */ |
drivers/md/dm-raid1.c
... | ... | @@ -74,7 +74,7 @@ |
74 | 74 | unsigned region_shift; |
75 | 75 | |
76 | 76 | /* holds persistent region state */ |
77 | - struct dirty_log *log; | |
77 | + struct dm_dirty_log *log; | |
78 | 78 | |
79 | 79 | /* hash table */ |
80 | 80 | rwlock_t hash_lock; |
... | ... | @@ -184,7 +184,7 @@ |
184 | 184 | #define MIN_REGIONS 64 |
185 | 185 | #define MAX_RECOVERY 1 |
186 | 186 | static 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 | 188 | region_t nr_regions) |
189 | 189 | { |
190 | 190 | unsigned int nr_buckets, max_buckets; |
... | ... | @@ -249,7 +249,7 @@ |
249 | 249 | } |
250 | 250 | |
251 | 251 | if (rh->log) |
252 | - dm_destroy_dirty_log(rh->log); | |
252 | + dm_dirty_log_destroy(rh->log); | |
253 | 253 | if (rh->region_pool) |
254 | 254 | mempool_destroy(rh->region_pool); |
255 | 255 | vfree(rh->buckets); |
... | ... | @@ -831,7 +831,7 @@ |
831 | 831 | { |
832 | 832 | int r; |
833 | 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 | 837 | * Start quiescing some regions. |
... | ... | @@ -1017,7 +1017,7 @@ |
1017 | 1017 | { |
1018 | 1018 | unsigned long flags; |
1019 | 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 | 1021 | struct region *reg; |
1022 | 1022 | region_t region = bio_to_region(rh, bio); |
1023 | 1023 | int recovering = 0; |
... | ... | @@ -1301,7 +1301,7 @@ |
1301 | 1301 | static struct mirror_set *alloc_context(unsigned int nr_mirrors, |
1302 | 1302 | uint32_t region_size, |
1303 | 1303 | struct dm_target *ti, |
1304 | - struct dirty_log *dl) | |
1304 | + struct dm_dirty_log *dl) | |
1305 | 1305 | { |
1306 | 1306 | size_t len; |
1307 | 1307 | struct mirror_set *ms = NULL; |
1308 | 1308 | |
... | ... | @@ -1401,12 +1401,12 @@ |
1401 | 1401 | /* |
1402 | 1402 | * Create dirty log: log_type #log_params <log_params> |
1403 | 1403 | */ |
1404 | -static struct dirty_log *create_dirty_log(struct dm_target *ti, | |
1404 | +static struct dm_dirty_log *create_dirty_log(struct dm_target *ti, | |
1405 | 1405 | unsigned int argc, char **argv, |
1406 | 1406 | unsigned int *args_used) |
1407 | 1407 | { |
1408 | 1408 | unsigned int param_count; |
1409 | - struct dirty_log *dl; | |
1409 | + struct dm_dirty_log *dl; | |
1410 | 1410 | |
1411 | 1411 | if (argc < 2) { |
1412 | 1412 | ti->error = "Insufficient mirror log arguments"; |
... | ... | @@ -1425,7 +1425,7 @@ |
1425 | 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 | 1429 | if (!dl) { |
1430 | 1430 | ti->error = "Error creating mirror dirty log"; |
1431 | 1431 | return NULL; |
... | ... | @@ -1433,7 +1433,7 @@ |
1433 | 1433 | |
1434 | 1434 | if (!_check_region_size(ti, dl->type->get_region_size(dl))) { |
1435 | 1435 | ti->error = "Invalid region size"; |
1436 | - dm_destroy_dirty_log(dl); | |
1436 | + dm_dirty_log_destroy(dl); | |
1437 | 1437 | return NULL; |
1438 | 1438 | } |
1439 | 1439 | |
... | ... | @@ -1494,7 +1494,7 @@ |
1494 | 1494 | int r; |
1495 | 1495 | unsigned int nr_mirrors, m, args_used; |
1496 | 1496 | struct mirror_set *ms; |
1497 | - struct dirty_log *dl; | |
1497 | + struct dm_dirty_log *dl; | |
1498 | 1498 | |
1499 | 1499 | dl = create_dirty_log(ti, argc, argv, &args_used); |
1500 | 1500 | if (!dl) |
... | ... | @@ -1506,7 +1506,7 @@ |
1506 | 1506 | if (!argc || sscanf(argv[0], "%u", &nr_mirrors) != 1 || |
1507 | 1507 | nr_mirrors < 2 || nr_mirrors > DM_KCOPYD_MAX_REGIONS + 1) { |
1508 | 1508 | ti->error = "Invalid number of mirrors"; |
1509 | - dm_destroy_dirty_log(dl); | |
1509 | + dm_dirty_log_destroy(dl); | |
1510 | 1510 | return -EINVAL; |
1511 | 1511 | } |
1512 | 1512 | |
1513 | 1513 | |
... | ... | @@ -1514,13 +1514,13 @@ |
1514 | 1514 | |
1515 | 1515 | if (argc < nr_mirrors * 2) { |
1516 | 1516 | ti->error = "Too few mirror arguments"; |
1517 | - dm_destroy_dirty_log(dl); | |
1517 | + dm_dirty_log_destroy(dl); | |
1518 | 1518 | return -EINVAL; |
1519 | 1519 | } |
1520 | 1520 | |
1521 | 1521 | ms = alloc_context(nr_mirrors, dl->type->get_region_size(dl), ti, dl); |
1522 | 1522 | if (!ms) { |
1523 | - dm_destroy_dirty_log(dl); | |
1523 | + dm_dirty_log_destroy(dl); | |
1524 | 1524 | return -ENOMEM; |
1525 | 1525 | } |
1526 | 1526 | |
... | ... | @@ -1732,7 +1732,7 @@ |
1732 | 1732 | static void mirror_presuspend(struct dm_target *ti) |
1733 | 1733 | { |
1734 | 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 | 1737 | atomic_set(&ms->suspend, 1); |
1738 | 1738 | |
... | ... | @@ -1761,7 +1761,7 @@ |
1761 | 1761 | static void mirror_postsuspend(struct dm_target *ti) |
1762 | 1762 | { |
1763 | 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 | 1766 | if (log->type->postsuspend && log->type->postsuspend(log)) |
1767 | 1767 | /* FIXME: need better error handling */ |
... | ... | @@ -1771,7 +1771,7 @@ |
1771 | 1771 | static void mirror_resume(struct dm_target *ti) |
1772 | 1772 | { |
1773 | 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 | 1776 | atomic_set(&ms->suspend, 0); |
1777 | 1777 | if (log->type->resume && log->type->resume(log)) |
... | ... | @@ -1809,7 +1809,7 @@ |
1809 | 1809 | { |
1810 | 1810 | unsigned int m, sz = 0; |
1811 | 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 | 1813 | char buffer[ms->nr_mirrors + 1]; |
1814 | 1814 | |
1815 | 1815 | switch (type) { |
drivers/md/dm.h