Commit 1e302a92 authored by Jonathan Brassow's avatar Jonathan Brassow Committed by Alasdair G Kergon

dm snapshot: move status to exception store

Let the exception store types print out their status through
the new API, rather than having the snapshot code do it.

Adjust the buffer position to allow for the preceding DMEMIT in the
arguments to type->status().
Signed-off-by: default avatarJonathan Brassow <jbrassow@redhat.com>
Signed-off-by: default avatarAlasdair G Kergon <agk@redhat.com>
parent fee1998e
...@@ -79,8 +79,9 @@ struct dm_exception_store_type { ...@@ -79,8 +79,9 @@ struct dm_exception_store_type {
*/ */
void (*drop_snapshot) (struct dm_exception_store *store); void (*drop_snapshot) (struct dm_exception_store *store);
int (*status) (struct dm_exception_store *store, status_type_t status, unsigned (*status) (struct dm_exception_store *store,
char *result, unsigned int maxlen); status_type_t status, char *result,
unsigned maxlen);
/* /*
* Return how full the snapshot is. * Return how full the snapshot is.
......
...@@ -688,11 +688,19 @@ static int persistent_ctr(struct dm_exception_store *store, ...@@ -688,11 +688,19 @@ static int persistent_ctr(struct dm_exception_store *store,
return 0; return 0;
} }
static int persistent_status(struct dm_exception_store *store, static unsigned persistent_status(struct dm_exception_store *store,
status_type_t status, char *result, status_type_t status, char *result,
unsigned int maxlen) unsigned maxlen)
{ {
int sz = 0; unsigned sz = 0;
switch (status) {
case STATUSTYPE_INFO:
break;
case STATUSTYPE_TABLE:
DMEMIT(" %s P %llu", store->cow->name,
(unsigned long long)store->chunk_size);
}
return sz; return sz;
} }
......
...@@ -81,11 +81,19 @@ static int transient_ctr(struct dm_exception_store *store, ...@@ -81,11 +81,19 @@ static int transient_ctr(struct dm_exception_store *store,
return 0; return 0;
} }
static int transient_status(struct dm_exception_store *store, static unsigned transient_status(struct dm_exception_store *store,
status_type_t status, char *result, status_type_t status, char *result,
unsigned maxlen) unsigned maxlen)
{ {
int sz = 0; unsigned sz = 0;
switch (status) {
case STATUSTYPE_INFO:
break;
case STATUSTYPE_TABLE:
DMEMIT(" %s N %llu", store->cow->name,
(unsigned long long)store->chunk_size);
}
return sz; return sz;
} }
......
...@@ -70,9 +70,6 @@ struct dm_snapshot { ...@@ -70,9 +70,6 @@ struct dm_snapshot {
/* Origin writes don't trigger exceptions until this is set */ /* Origin writes don't trigger exceptions until this is set */
int active; int active;
/* Used for display of table */
char type;
mempool_t *pending_pool; mempool_t *pending_pool;
atomic_t pending_exceptions_count; atomic_t pending_exceptions_count;
...@@ -1166,9 +1163,8 @@ static int snapshot_status(struct dm_target *ti, status_type_t type, ...@@ -1166,9 +1163,8 @@ static int snapshot_status(struct dm_target *ti, status_type_t type,
* make sense. * make sense.
*/ */
DMEMIT("%s", snap->origin->name); DMEMIT("%s", snap->origin->name);
DMEMIT(" %s %s %llu", snap->store->cow->name, snap->store->type->status(snap->store, type, result + sz,
snap->store->type->name, maxlen - sz);
(unsigned long long)snap->store->chunk_size);
break; break;
} }
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment