mirror of
git://sourceware.org/git/lvm2.git
synced 2024-12-21 13:34:40 +03:00
cache: properly translate DM_THIN_DISCARDS
DM status uses DM defines which need to be translated to LVM enum.
This commit is contained in:
parent
f221ba97c9
commit
50441f2433
@ -227,12 +227,23 @@ char *lvseg_kernel_discards_dup_with_info_and_seg_status(struct dm_pool *mem, co
|
||||
{
|
||||
const char *s = "";
|
||||
char *ret;
|
||||
thin_discards_t d;
|
||||
|
||||
if (lvdm->seg_status.type == SEG_STATUS_THIN_POOL)
|
||||
s = get_pool_discards_name(lvdm->seg_status.thin_pool->discards);
|
||||
if (lvdm->seg_status.type == SEG_STATUS_THIN_POOL) {
|
||||
switch (lvdm->seg_status.thin_pool->discards) {
|
||||
case DM_THIN_DISCARDS_IGNORE: d = THIN_DISCARDS_IGNORE; break;
|
||||
case DM_THIN_DISCARDS_NO_PASSDOWN: d = THIN_DISCARDS_NO_PASSDOWN; break;
|
||||
case DM_THIN_DISCARDS_PASSDOWN: d = THIN_DISCARDS_PASSDOWN; break;
|
||||
default:
|
||||
log_error("Kernel reports unknown discards status %u.",
|
||||
lvdm->seg_status.thin_pool->discards);
|
||||
return 0;
|
||||
}
|
||||
s = get_pool_discards_name(d);
|
||||
}
|
||||
|
||||
if (!(ret = dm_pool_strdup(mem, s))) {
|
||||
log_error("lvseg_kernel_discards_dup_with_info_and_seg_status: dm_pool_strdup failed");
|
||||
log_error("lvseg_kernel_discards_dup_with_info_and_seg_status: dm_pool_strdup failed.");
|
||||
return NULL;
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user