mirror of
git://sourceware.org/git/lvm2.git
synced 2024-12-21 13:34:40 +03:00
libdm: parse more info from cache status
Parse Fail/Error/need_check/ro status info from cache.
This commit is contained in:
parent
9918d95490
commit
29d1533a49
@ -1,5 +1,6 @@
|
||||
Version 1.02.120 -
|
||||
=================================
|
||||
Improve parsing of cache status and report Fail, Error, needs_check, ro.
|
||||
|
||||
Version 1.02.119 - 4th March 2016
|
||||
=================================
|
||||
|
@ -361,8 +361,14 @@ struct dm_status_cache {
|
||||
char **core_argv;
|
||||
|
||||
char *policy_name;
|
||||
int policy_argc;
|
||||
int policy_argc;
|
||||
char **policy_argv;
|
||||
|
||||
unsigned error : 1; /* detected error (switches to fail soon) */
|
||||
unsigned fail : 1; /* all I/O fails */
|
||||
unsigned needs_check : 1; /* metadata needs check */
|
||||
unsigned read_only : 1; /* metadata may not be changed */
|
||||
uint32_t reserved : 28;
|
||||
};
|
||||
|
||||
int dm_get_status_cache(struct dm_pool *mem, const char *params,
|
||||
|
@ -194,6 +194,17 @@ int dm_get_status_cache(struct dm_pool *mem, const char *params,
|
||||
if (!(s = dm_pool_zalloc(mem, sizeof(struct dm_status_cache))))
|
||||
return_0;
|
||||
|
||||
if (strstr(params, "Error")) {
|
||||
s->error = 1;
|
||||
s->fail = 1; /* This is also I/O fail state */
|
||||
goto out;
|
||||
}
|
||||
|
||||
if (strstr(params, "Fail")) {
|
||||
s->fail = 1;
|
||||
goto out;
|
||||
}
|
||||
|
||||
/* Read in args that have definitive placement */
|
||||
if (sscanf(params,
|
||||
" %" PRIu32
|
||||
@ -258,6 +269,13 @@ int dm_get_status_cache(struct dm_pool *mem, const char *params,
|
||||
(dm_split_words(str, s->policy_argc, 0, s->policy_argv) != s->policy_argc)))
|
||||
goto bad;
|
||||
|
||||
/* TODO: improve this parser */
|
||||
if (strstr(p, " ro"))
|
||||
s->read_only = 1;
|
||||
|
||||
if (strstr(p, " needs_check"))
|
||||
s->needs_check = 1;
|
||||
out:
|
||||
*status = s;
|
||||
return 1;
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user