aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/md/dm-snap-persistent.c
diff options
context:
space:
mode:
authorMike Snitzer <snitzer@redhat.com>2009-12-10 18:52:12 -0500
committerAlasdair G Kergon <agk@redhat.com>2009-12-10 18:52:12 -0500
commitfc56f6fbcca3672c63c93c65f45105faacfc13cb (patch)
treef50f42a461ef33f8617fbdb781879e6ae77b62c4 /drivers/md/dm-snap-persistent.c
parent985903bb3a6d98623360ab6c855417f638840029 (diff)
dm snapshot: move cow ref from exception store to snap core
Store the reference to the snapshot cow device in the core snapshot code instead of each exception store. It can be accessed through the new function dm_snap_cow(). Exception stores should each now maintain a reference to their parent snapshot struct. This is cleaner and makes part of the forthcoming snapshot merge code simpler. Signed-off-by: Mike Snitzer <snitzer@redhat.com> Signed-off-by: Alasdair G Kergon <agk@redhat.com> Reviewed-by: Jonathan Brassow <jbrassow@redhat.com> Cc: Mikulas Patocka <mpatocka@redhat.com>
Diffstat (limited to 'drivers/md/dm-snap-persistent.c')
-rw-r--r--drivers/md/dm-snap-persistent.c12
1 files changed, 6 insertions, 6 deletions
diff --git a/drivers/md/dm-snap-persistent.c b/drivers/md/dm-snap-persistent.c
index 767065f6c5f3..157999ebd236 100644
--- a/drivers/md/dm-snap-persistent.c
+++ b/drivers/md/dm-snap-persistent.c
@@ -214,7 +214,7 @@ static int chunk_io(struct pstore *ps, void *area, chunk_t chunk, int rw,
214 int metadata) 214 int metadata)
215{ 215{
216 struct dm_io_region where = { 216 struct dm_io_region where = {
217 .bdev = ps->store->cow->bdev, 217 .bdev = dm_snap_cow(ps->store->snap)->bdev,
218 .sector = ps->store->chunk_size * chunk, 218 .sector = ps->store->chunk_size * chunk,
219 .count = ps->store->chunk_size, 219 .count = ps->store->chunk_size,
220 }; 220 };
@@ -294,7 +294,8 @@ static int read_header(struct pstore *ps, int *new_snapshot)
294 */ 294 */
295 if (!ps->store->chunk_size) { 295 if (!ps->store->chunk_size) {
296 ps->store->chunk_size = max(DM_CHUNK_SIZE_DEFAULT_SECTORS, 296 ps->store->chunk_size = max(DM_CHUNK_SIZE_DEFAULT_SECTORS,
297 bdev_logical_block_size(ps->store->cow->bdev) >> 9); 297 bdev_logical_block_size(dm_snap_cow(ps->store->snap)->
298 bdev) >> 9);
298 ps->store->chunk_mask = ps->store->chunk_size - 1; 299 ps->store->chunk_mask = ps->store->chunk_size - 1;
299 ps->store->chunk_shift = ffs(ps->store->chunk_size) - 1; 300 ps->store->chunk_shift = ffs(ps->store->chunk_size) - 1;
300 chunk_size_supplied = 0; 301 chunk_size_supplied = 0;
@@ -497,7 +498,7 @@ static void persistent_usage(struct dm_exception_store *store,
497 struct pstore *ps = get_info(store); 498 struct pstore *ps = get_info(store);
498 499
499 *sectors_allocated = ps->next_free * store->chunk_size; 500 *sectors_allocated = ps->next_free * store->chunk_size;
500 *total_sectors = get_dev_size(store->cow->bdev); 501 *total_sectors = get_dev_size(dm_snap_cow(store->snap)->bdev);
501 502
502 /* 503 /*
503 * First chunk is the fixed header. 504 * First chunk is the fixed header.
@@ -596,7 +597,7 @@ static int persistent_prepare_exception(struct dm_exception_store *store,
596 struct pstore *ps = get_info(store); 597 struct pstore *ps = get_info(store);
597 uint32_t stride; 598 uint32_t stride;
598 chunk_t next_free; 599 chunk_t next_free;
599 sector_t size = get_dev_size(store->cow->bdev); 600 sector_t size = get_dev_size(dm_snap_cow(store->snap)->bdev);
600 601
601 /* Is there enough room ? */ 602 /* Is there enough room ? */
602 if (size < ((ps->next_free + 1) * store->chunk_size)) 603 if (size < ((ps->next_free + 1) * store->chunk_size))
@@ -733,8 +734,7 @@ static unsigned persistent_status(struct dm_exception_store *store,
733 case STATUSTYPE_INFO: 734 case STATUSTYPE_INFO:
734 break; 735 break;
735 case STATUSTYPE_TABLE: 736 case STATUSTYPE_TABLE:
736 DMEMIT(" %s P %llu", store->cow->name, 737 DMEMIT(" P %llu", (unsigned long long)store->chunk_size);
737 (unsigned long long)store->chunk_size);
738 } 738 }
739 739
740 return sz; 740 return sz;