diff options
Diffstat (limited to 'drivers/md/dm-snap-transient.c')
-rw-r--r-- | drivers/md/dm-snap-transient.c | 24 |
1 files changed, 13 insertions, 11 deletions
diff --git a/drivers/md/dm-snap-transient.c b/drivers/md/dm-snap-transient.c index cde5aa558e6d..a0898a66a2f8 100644 --- a/drivers/md/dm-snap-transient.c +++ b/drivers/md/dm-snap-transient.c | |||
@@ -36,10 +36,10 @@ static int transient_read_metadata(struct dm_exception_store *store, | |||
36 | } | 36 | } |
37 | 37 | ||
38 | static int transient_prepare_exception(struct dm_exception_store *store, | 38 | static int transient_prepare_exception(struct dm_exception_store *store, |
39 | struct dm_snap_exception *e) | 39 | struct dm_exception *e) |
40 | { | 40 | { |
41 | struct transient_c *tc = store->context; | 41 | struct transient_c *tc = store->context; |
42 | sector_t size = get_dev_size(store->cow->bdev); | 42 | sector_t size = get_dev_size(dm_snap_cow(store->snap)->bdev); |
43 | 43 | ||
44 | if (size < (tc->next_free + store->chunk_size)) | 44 | if (size < (tc->next_free + store->chunk_size)) |
45 | return -1; | 45 | return -1; |
@@ -51,7 +51,7 @@ static int transient_prepare_exception(struct dm_exception_store *store, | |||
51 | } | 51 | } |
52 | 52 | ||
53 | static void transient_commit_exception(struct dm_exception_store *store, | 53 | static void transient_commit_exception(struct dm_exception_store *store, |
54 | struct dm_snap_exception *e, | 54 | struct dm_exception *e, |
55 | void (*callback) (void *, int success), | 55 | void (*callback) (void *, int success), |
56 | void *callback_context) | 56 | void *callback_context) |
57 | { | 57 | { |
@@ -59,11 +59,14 @@ static void transient_commit_exception(struct dm_exception_store *store, | |||
59 | callback(callback_context, 1); | 59 | callback(callback_context, 1); |
60 | } | 60 | } |
61 | 61 | ||
62 | static void transient_fraction_full(struct dm_exception_store *store, | 62 | static void transient_usage(struct dm_exception_store *store, |
63 | sector_t *numerator, sector_t *denominator) | 63 | sector_t *total_sectors, |
64 | sector_t *sectors_allocated, | ||
65 | sector_t *metadata_sectors) | ||
64 | { | 66 | { |
65 | *numerator = ((struct transient_c *) store->context)->next_free; | 67 | *sectors_allocated = ((struct transient_c *) store->context)->next_free; |
66 | *denominator = get_dev_size(store->cow->bdev); | 68 | *total_sectors = get_dev_size(dm_snap_cow(store->snap)->bdev); |
69 | *metadata_sectors = 0; | ||
67 | } | 70 | } |
68 | 71 | ||
69 | static int transient_ctr(struct dm_exception_store *store, | 72 | static int transient_ctr(struct dm_exception_store *store, |
@@ -91,8 +94,7 @@ static unsigned transient_status(struct dm_exception_store *store, | |||
91 | case STATUSTYPE_INFO: | 94 | case STATUSTYPE_INFO: |
92 | break; | 95 | break; |
93 | case STATUSTYPE_TABLE: | 96 | case STATUSTYPE_TABLE: |
94 | DMEMIT(" %s N %llu", store->cow->name, | 97 | DMEMIT(" N %llu", (unsigned long long)store->chunk_size); |
95 | (unsigned long long)store->chunk_size); | ||
96 | } | 98 | } |
97 | 99 | ||
98 | return sz; | 100 | return sz; |
@@ -106,7 +108,7 @@ static struct dm_exception_store_type _transient_type = { | |||
106 | .read_metadata = transient_read_metadata, | 108 | .read_metadata = transient_read_metadata, |
107 | .prepare_exception = transient_prepare_exception, | 109 | .prepare_exception = transient_prepare_exception, |
108 | .commit_exception = transient_commit_exception, | 110 | .commit_exception = transient_commit_exception, |
109 | .fraction_full = transient_fraction_full, | 111 | .usage = transient_usage, |
110 | .status = transient_status, | 112 | .status = transient_status, |
111 | }; | 113 | }; |
112 | 114 | ||
@@ -118,7 +120,7 @@ static struct dm_exception_store_type _transient_compat_type = { | |||
118 | .read_metadata = transient_read_metadata, | 120 | .read_metadata = transient_read_metadata, |
119 | .prepare_exception = transient_prepare_exception, | 121 | .prepare_exception = transient_prepare_exception, |
120 | .commit_exception = transient_commit_exception, | 122 | .commit_exception = transient_commit_exception, |
121 | .fraction_full = transient_fraction_full, | 123 | .usage = transient_usage, |
122 | .status = transient_status, | 124 | .status = transient_status, |
123 | }; | 125 | }; |
124 | 126 | ||