aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--drivers/md/dm-exception-store.c28
-rw-r--r--drivers/md/dm-exception-store.h19
-rw-r--r--drivers/md/dm-snap.h2
3 files changed, 25 insertions, 24 deletions
diff --git a/drivers/md/dm-exception-store.c b/drivers/md/dm-exception-store.c
index ef152e600cb6..c5c9a2652315 100644
--- a/drivers/md/dm-exception-store.c
+++ b/drivers/md/dm-exception-store.c
@@ -462,19 +462,19 @@ static int read_exceptions(struct pstore *ps)
462 return 0; 462 return 0;
463} 463}
464 464
465static struct pstore *get_info(struct exception_store *store) 465static struct pstore *get_info(struct dm_exception_store *store)
466{ 466{
467 return (struct pstore *) store->context; 467 return (struct pstore *) store->context;
468} 468}
469 469
470static void persistent_fraction_full(struct exception_store *store, 470static void persistent_fraction_full(struct dm_exception_store *store,
471 sector_t *numerator, sector_t *denominator) 471 sector_t *numerator, sector_t *denominator)
472{ 472{
473 *numerator = get_info(store)->next_free * store->snap->chunk_size; 473 *numerator = get_info(store)->next_free * store->snap->chunk_size;
474 *denominator = get_dev_size(store->snap->cow->bdev); 474 *denominator = get_dev_size(store->snap->cow->bdev);
475} 475}
476 476
477static void persistent_destroy(struct exception_store *store) 477static void persistent_destroy(struct dm_exception_store *store)
478{ 478{
479 struct pstore *ps = get_info(store); 479 struct pstore *ps = get_info(store);
480 480
@@ -485,7 +485,7 @@ static void persistent_destroy(struct exception_store *store)
485 kfree(ps); 485 kfree(ps);
486} 486}
487 487
488static int persistent_read_metadata(struct exception_store *store) 488static int persistent_read_metadata(struct dm_exception_store *store)
489{ 489{
490 int r, uninitialized_var(new_snapshot); 490 int r, uninitialized_var(new_snapshot);
491 struct pstore *ps = get_info(store); 491 struct pstore *ps = get_info(store);
@@ -551,7 +551,7 @@ static int persistent_read_metadata(struct exception_store *store)
551 return 0; 551 return 0;
552} 552}
553 553
554static int persistent_prepare(struct exception_store *store, 554static int persistent_prepare(struct dm_exception_store *store,
555 struct dm_snap_exception *e) 555 struct dm_snap_exception *e)
556{ 556{
557 struct pstore *ps = get_info(store); 557 struct pstore *ps = get_info(store);
@@ -578,7 +578,7 @@ static int persistent_prepare(struct exception_store *store,
578 return 0; 578 return 0;
579} 579}
580 580
581static void persistent_commit(struct exception_store *store, 581static void persistent_commit(struct dm_exception_store *store,
582 struct dm_snap_exception *e, 582 struct dm_snap_exception *e,
583 void (*callback) (void *, int success), 583 void (*callback) (void *, int success),
584 void *callback_context) 584 void *callback_context)
@@ -640,7 +640,7 @@ static void persistent_commit(struct exception_store *store,
640 ps->callback_count = 0; 640 ps->callback_count = 0;
641} 641}
642 642
643static void persistent_drop(struct exception_store *store) 643static void persistent_drop(struct dm_exception_store *store)
644{ 644{
645 struct pstore *ps = get_info(store); 645 struct pstore *ps = get_info(store);
646 646
@@ -649,7 +649,7 @@ static void persistent_drop(struct exception_store *store)
649 DMWARN("write header failed"); 649 DMWARN("write header failed");
650} 650}
651 651
652int dm_create_persistent(struct exception_store *store) 652int dm_create_persistent(struct dm_exception_store *store)
653{ 653{
654 struct pstore *ps; 654 struct pstore *ps;
655 655
@@ -694,17 +694,17 @@ struct transient_c {
694 sector_t next_free; 694 sector_t next_free;
695}; 695};
696 696
697static void transient_destroy(struct exception_store *store) 697static void transient_destroy(struct dm_exception_store *store)
698{ 698{
699 kfree(store->context); 699 kfree(store->context);
700} 700}
701 701
702static int transient_read_metadata(struct exception_store *store) 702static int transient_read_metadata(struct dm_exception_store *store)
703{ 703{
704 return 0; 704 return 0;
705} 705}
706 706
707static int transient_prepare(struct exception_store *store, 707static int transient_prepare(struct dm_exception_store *store,
708 struct dm_snap_exception *e) 708 struct dm_snap_exception *e)
709{ 709{
710 struct transient_c *tc = (struct transient_c *) store->context; 710 struct transient_c *tc = (struct transient_c *) store->context;
@@ -719,7 +719,7 @@ static int transient_prepare(struct exception_store *store,
719 return 0; 719 return 0;
720} 720}
721 721
722static void transient_commit(struct exception_store *store, 722static void transient_commit(struct dm_exception_store *store,
723 struct dm_snap_exception *e, 723 struct dm_snap_exception *e,
724 void (*callback) (void *, int success), 724 void (*callback) (void *, int success),
725 void *callback_context) 725 void *callback_context)
@@ -728,14 +728,14 @@ static void transient_commit(struct exception_store *store,
728 callback(callback_context, 1); 728 callback(callback_context, 1);
729} 729}
730 730
731static void transient_fraction_full(struct exception_store *store, 731static void transient_fraction_full(struct dm_exception_store *store,
732 sector_t *numerator, sector_t *denominator) 732 sector_t *numerator, sector_t *denominator)
733{ 733{
734 *numerator = ((struct transient_c *) store->context)->next_free; 734 *numerator = ((struct transient_c *) store->context)->next_free;
735 *denominator = get_dev_size(store->snap->cow->bdev); 735 *denominator = get_dev_size(store->snap->cow->bdev);
736} 736}
737 737
738int dm_create_transient(struct exception_store *store) 738int dm_create_transient(struct dm_exception_store *store)
739{ 739{
740 struct transient_c *tc; 740 struct transient_c *tc;
741 741
diff --git a/drivers/md/dm-exception-store.h b/drivers/md/dm-exception-store.h
index d75f775562e5..25677df8dd59 100644
--- a/drivers/md/dm-exception-store.h
+++ b/drivers/md/dm-exception-store.h
@@ -36,28 +36,29 @@ struct dm_snap_exception {
36 * Abstraction to handle the meta/layout of exception stores (the 36 * Abstraction to handle the meta/layout of exception stores (the
37 * COW device). 37 * COW device).
38 */ 38 */
39struct exception_store { 39struct dm_exception_store {
40
40 /* 41 /*
41 * Destroys this object when you've finished with it. 42 * Destroys this object when you've finished with it.
42 */ 43 */
43 void (*destroy) (struct exception_store *store); 44 void (*destroy) (struct dm_exception_store *store);
44 45
45 /* 46 /*
46 * The target shouldn't read the COW device until this is 47 * The target shouldn't read the COW device until this is
47 * called. 48 * called.
48 */ 49 */
49 int (*read_metadata) (struct exception_store *store); 50 int (*read_metadata) (struct dm_exception_store *store);
50 51
51 /* 52 /*
52 * Find somewhere to store the next exception. 53 * Find somewhere to store the next exception.
53 */ 54 */
54 int (*prepare_exception) (struct exception_store *store, 55 int (*prepare_exception) (struct dm_exception_store *store,
55 struct dm_snap_exception *e); 56 struct dm_snap_exception *e);
56 57
57 /* 58 /*
58 * Update the metadata with this exception. 59 * Update the metadata with this exception.
59 */ 60 */
60 void (*commit_exception) (struct exception_store *store, 61 void (*commit_exception) (struct dm_exception_store *store,
61 struct dm_snap_exception *e, 62 struct dm_snap_exception *e,
62 void (*callback) (void *, int success), 63 void (*callback) (void *, int success),
63 void *callback_context); 64 void *callback_context);
@@ -65,12 +66,12 @@ struct exception_store {
65 /* 66 /*
66 * The snapshot is invalid, note this in the metadata. 67 * The snapshot is invalid, note this in the metadata.
67 */ 68 */
68 void (*drop_snapshot) (struct exception_store *store); 69 void (*drop_snapshot) (struct dm_exception_store *store);
69 70
70 /* 71 /*
71 * Return how full the snapshot is. 72 * Return how full the snapshot is.
72 */ 73 */
73 void (*fraction_full) (struct exception_store *store, 74 void (*fraction_full) (struct dm_exception_store *store,
74 sector_t *numerator, 75 sector_t *numerator,
75 sector_t *denominator); 76 sector_t *denominator);
76 77
@@ -124,8 +125,8 @@ static inline void dm_consecutive_chunk_count_inc(struct dm_snap_exception *e)
124/* 125/*
125 * Two exception store implementations. 126 * Two exception store implementations.
126 */ 127 */
127int dm_create_persistent(struct exception_store *store); 128int dm_create_persistent(struct dm_exception_store *store);
128 129
129int dm_create_transient(struct exception_store *store); 130int dm_create_transient(struct dm_exception_store *store);
130 131
131#endif /* _LINUX_DM_EXCEPTION_STORE */ 132#endif /* _LINUX_DM_EXCEPTION_STORE */
diff --git a/drivers/md/dm-snap.h b/drivers/md/dm-snap.h
index 6e4beaf89f6c..928123657024 100644
--- a/drivers/md/dm-snap.h
+++ b/drivers/md/dm-snap.h
@@ -61,7 +61,7 @@ struct dm_snapshot {
61 spinlock_t pe_lock; 61 spinlock_t pe_lock;
62 62
63 /* The on disk metadata handler */ 63 /* The on disk metadata handler */
64 struct exception_store store; 64 struct dm_exception_store store;
65 65
66 struct dm_kcopyd_client *kcopyd_client; 66 struct dm_kcopyd_client *kcopyd_client;
67 67