aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/md/dm-snap-persistent.c
diff options
context:
space:
mode:
authorMike Snitzer <snitzer@redhat.com>2009-12-10 18:52:11 -0500
committerAlasdair G Kergon <agk@redhat.com>2009-12-10 18:52:11 -0500
commit985903bb3a6d98623360ab6c855417f638840029 (patch)
tree64e7582e0b7827aa318c4fe1c497ebc541d9ce8b /drivers/md/dm-snap-persistent.c
parent3510cb94ff7b04b016bd22bfee913e2c1c05c066 (diff)
dm snapshot: add allocated metadata to snapshot status
Add number of sectors used by metadata to the end of the snapshot's status line. Renamed dm_exception_store_type's 'fraction_full' to 'usage'. Renamed arguments to be clearer about what is being returned. Also added 'metadata_sectors'. Signed-off-by: Mike Snitzer <snitzer@redhat.com> Signed-off-by: Alasdair G Kergon <agk@redhat.com>
Diffstat (limited to 'drivers/md/dm-snap-persistent.c')
-rw-r--r--drivers/md/dm-snap-persistent.c23
1 files changed, 17 insertions, 6 deletions
diff --git a/drivers/md/dm-snap-persistent.c b/drivers/md/dm-snap-persistent.c
index 24b8acd1be83..767065f6c5f3 100644
--- a/drivers/md/dm-snap-persistent.c
+++ b/drivers/md/dm-snap-persistent.c
@@ -489,11 +489,22 @@ static struct pstore *get_info(struct dm_exception_store *store)
489 return (struct pstore *) store->context; 489 return (struct pstore *) store->context;
490} 490}
491 491
492static void persistent_fraction_full(struct dm_exception_store *store, 492static void persistent_usage(struct dm_exception_store *store,
493 sector_t *numerator, sector_t *denominator) 493 sector_t *total_sectors,
494 sector_t *sectors_allocated,
495 sector_t *metadata_sectors)
494{ 496{
495 *numerator = get_info(store)->next_free * store->chunk_size; 497 struct pstore *ps = get_info(store);
496 *denominator = get_dev_size(store->cow->bdev); 498
499 *sectors_allocated = ps->next_free * store->chunk_size;
500 *total_sectors = get_dev_size(store->cow->bdev);
501
502 /*
503 * First chunk is the fixed header.
504 * Then there are (ps->current_area + 1) metadata chunks, each one
505 * separated from the next by ps->exceptions_per_area data chunks.
506 */
507 *metadata_sectors = (ps->current_area + 2) * store->chunk_size;
497} 508}
498 509
499static void persistent_dtr(struct dm_exception_store *store) 510static void persistent_dtr(struct dm_exception_store *store)
@@ -738,7 +749,7 @@ static struct dm_exception_store_type _persistent_type = {
738 .prepare_exception = persistent_prepare_exception, 749 .prepare_exception = persistent_prepare_exception,
739 .commit_exception = persistent_commit_exception, 750 .commit_exception = persistent_commit_exception,
740 .drop_snapshot = persistent_drop_snapshot, 751 .drop_snapshot = persistent_drop_snapshot,
741 .fraction_full = persistent_fraction_full, 752 .usage = persistent_usage,
742 .status = persistent_status, 753 .status = persistent_status,
743}; 754};
744 755
@@ -751,7 +762,7 @@ static struct dm_exception_store_type _persistent_compat_type = {
751 .prepare_exception = persistent_prepare_exception, 762 .prepare_exception = persistent_prepare_exception,
752 .commit_exception = persistent_commit_exception, 763 .commit_exception = persistent_commit_exception,
753 .drop_snapshot = persistent_drop_snapshot, 764 .drop_snapshot = persistent_drop_snapshot,
754 .fraction_full = persistent_fraction_full, 765 .usage = persistent_usage,
755 .status = persistent_status, 766 .status = persistent_status,
756}; 767};
757 768