diff options
Diffstat (limited to 'drivers/md/dm-snap.c')
-rw-r--r-- | drivers/md/dm-snap.c | 22 |
1 files changed, 11 insertions, 11 deletions
diff --git a/drivers/md/dm-snap.c b/drivers/md/dm-snap.c index 4dc8a43c034b..1ba8a47d61b1 100644 --- a/drivers/md/dm-snap.c +++ b/drivers/md/dm-snap.c | |||
@@ -18,10 +18,10 @@ | |||
18 | #include <linux/slab.h> | 18 | #include <linux/slab.h> |
19 | #include <linux/vmalloc.h> | 19 | #include <linux/vmalloc.h> |
20 | #include <linux/log2.h> | 20 | #include <linux/log2.h> |
21 | #include <linux/dm-kcopyd.h> | ||
21 | 22 | ||
22 | #include "dm-snap.h" | 23 | #include "dm-snap.h" |
23 | #include "dm-bio-list.h" | 24 | #include "dm-bio-list.h" |
24 | #include "kcopyd.h" | ||
25 | 25 | ||
26 | #define DM_MSG_PREFIX "snapshots" | 26 | #define DM_MSG_PREFIX "snapshots" |
27 | 27 | ||
@@ -36,9 +36,9 @@ | |||
36 | #define SNAPSHOT_COPY_PRIORITY 2 | 36 | #define SNAPSHOT_COPY_PRIORITY 2 |
37 | 37 | ||
38 | /* | 38 | /* |
39 | * Each snapshot reserves this many pages for io | 39 | * Reserve 1MB for each snapshot initially (with minimum of 1 page). |
40 | */ | 40 | */ |
41 | #define SNAPSHOT_PAGES 256 | 41 | #define SNAPSHOT_PAGES (((1UL << 20) >> PAGE_SHIFT) ? : 1) |
42 | 42 | ||
43 | static struct workqueue_struct *ksnapd; | 43 | static struct workqueue_struct *ksnapd; |
44 | static void flush_queued_bios(struct work_struct *work); | 44 | static void flush_queued_bios(struct work_struct *work); |
@@ -536,7 +536,7 @@ static int snapshot_ctr(struct dm_target *ti, unsigned int argc, char **argv) | |||
536 | s->last_percent = 0; | 536 | s->last_percent = 0; |
537 | init_rwsem(&s->lock); | 537 | init_rwsem(&s->lock); |
538 | spin_lock_init(&s->pe_lock); | 538 | spin_lock_init(&s->pe_lock); |
539 | s->table = ti->table; | 539 | s->ti = ti; |
540 | 540 | ||
541 | /* Allocate hash table for COW data */ | 541 | /* Allocate hash table for COW data */ |
542 | if (init_hash_tables(s)) { | 542 | if (init_hash_tables(s)) { |
@@ -558,7 +558,7 @@ static int snapshot_ctr(struct dm_target *ti, unsigned int argc, char **argv) | |||
558 | goto bad4; | 558 | goto bad4; |
559 | } | 559 | } |
560 | 560 | ||
561 | r = kcopyd_client_create(SNAPSHOT_PAGES, &s->kcopyd_client); | 561 | r = dm_kcopyd_client_create(SNAPSHOT_PAGES, &s->kcopyd_client); |
562 | if (r) { | 562 | if (r) { |
563 | ti->error = "Could not create kcopyd client"; | 563 | ti->error = "Could not create kcopyd client"; |
564 | goto bad5; | 564 | goto bad5; |
@@ -591,7 +591,7 @@ static int snapshot_ctr(struct dm_target *ti, unsigned int argc, char **argv) | |||
591 | return 0; | 591 | return 0; |
592 | 592 | ||
593 | bad6: | 593 | bad6: |
594 | kcopyd_client_destroy(s->kcopyd_client); | 594 | dm_kcopyd_client_destroy(s->kcopyd_client); |
595 | 595 | ||
596 | bad5: | 596 | bad5: |
597 | s->store.destroy(&s->store); | 597 | s->store.destroy(&s->store); |
@@ -613,7 +613,7 @@ static int snapshot_ctr(struct dm_target *ti, unsigned int argc, char **argv) | |||
613 | 613 | ||
614 | static void __free_exceptions(struct dm_snapshot *s) | 614 | static void __free_exceptions(struct dm_snapshot *s) |
615 | { | 615 | { |
616 | kcopyd_client_destroy(s->kcopyd_client); | 616 | dm_kcopyd_client_destroy(s->kcopyd_client); |
617 | s->kcopyd_client = NULL; | 617 | s->kcopyd_client = NULL; |
618 | 618 | ||
619 | exit_exception_table(&s->pending, pending_cache); | 619 | exit_exception_table(&s->pending, pending_cache); |
@@ -699,7 +699,7 @@ static void __invalidate_snapshot(struct dm_snapshot *s, int err) | |||
699 | 699 | ||
700 | s->valid = 0; | 700 | s->valid = 0; |
701 | 701 | ||
702 | dm_table_event(s->table); | 702 | dm_table_event(s->ti->table); |
703 | } | 703 | } |
704 | 704 | ||
705 | static void get_pending_exception(struct dm_snap_pending_exception *pe) | 705 | static void get_pending_exception(struct dm_snap_pending_exception *pe) |
@@ -824,7 +824,7 @@ static void copy_callback(int read_err, unsigned long write_err, void *context) | |||
824 | static void start_copy(struct dm_snap_pending_exception *pe) | 824 | static void start_copy(struct dm_snap_pending_exception *pe) |
825 | { | 825 | { |
826 | struct dm_snapshot *s = pe->snap; | 826 | struct dm_snapshot *s = pe->snap; |
827 | struct io_region src, dest; | 827 | struct dm_io_region src, dest; |
828 | struct block_device *bdev = s->origin->bdev; | 828 | struct block_device *bdev = s->origin->bdev; |
829 | sector_t dev_size; | 829 | sector_t dev_size; |
830 | 830 | ||
@@ -839,7 +839,7 @@ static void start_copy(struct dm_snap_pending_exception *pe) | |||
839 | dest.count = src.count; | 839 | dest.count = src.count; |
840 | 840 | ||
841 | /* Hand over to kcopyd */ | 841 | /* Hand over to kcopyd */ |
842 | kcopyd_copy(s->kcopyd_client, | 842 | dm_kcopyd_copy(s->kcopyd_client, |
843 | &src, 1, &dest, 0, copy_callback, pe); | 843 | &src, 1, &dest, 0, copy_callback, pe); |
844 | } | 844 | } |
845 | 845 | ||
@@ -1060,7 +1060,7 @@ static int __origin_write(struct list_head *snapshots, struct bio *bio) | |||
1060 | goto next_snapshot; | 1060 | goto next_snapshot; |
1061 | 1061 | ||
1062 | /* Nothing to do if writing beyond end of snapshot */ | 1062 | /* Nothing to do if writing beyond end of snapshot */ |
1063 | if (bio->bi_sector >= dm_table_get_size(snap->table)) | 1063 | if (bio->bi_sector >= dm_table_get_size(snap->ti->table)) |
1064 | goto next_snapshot; | 1064 | goto next_snapshot; |
1065 | 1065 | ||
1066 | /* | 1066 | /* |