1
0
mirror of git://sourceware.org/git/lvm2.git synced 2024-12-22 17:35:59 +03:00

thin: fix condition for kernels without discards

Report warning if the kernel is not support given discards settings.
(In this case the behavior is equal to IGNORE.)
This commit is contained in:
Zdenek Kabelac 2012-08-09 11:25:41 +02:00
parent 1f1c664b78
commit b8a6efbcc0
2 changed files with 3 additions and 2 deletions

View File

@ -1,6 +1,7 @@
Version 2.02.98 Version 2.02.98
================================= =================================
Use 'ignore' discards for thin metadata created with older versions. Use 'ignore' discards for thin metadata created with older versions.
Use proper condition to check for unsupported discards settings.
Version 2.02.97 - 7th August 2012 Version 2.02.97 - 7th August 2012
================================= =================================

View File

@ -276,13 +276,13 @@ static int _thin_pool_add_target_line(struct dev_manager *dm,
seg->zero_new_blocks ? 0 : 1)) seg->zero_new_blocks ? 0 : 1))
return_0; return_0;
if ((seg->discards != THIN_DISCARDS_PASSDOWN) && (attr & THIN_FEATURE_DISCARDS)) { if (attr & THIN_FEATURE_DISCARDS) {
/* FIXME: Check whether underlying dev supports discards */ /* FIXME: Check whether underlying dev supports discards */
if (!dm_tree_node_set_thin_pool_discard(node, if (!dm_tree_node_set_thin_pool_discard(node,
seg->discards == THIN_DISCARDS_IGNORE, seg->discards == THIN_DISCARDS_IGNORE,
seg->discards == THIN_DISCARDS_NO_PASSDOWN)) seg->discards == THIN_DISCARDS_NO_PASSDOWN))
return_0; return_0;
} else } else if (seg->discards != THIN_DISCARDS_IGNORE)
log_warn_suppress(_no_discards++, "WARNING: Thin pool target does " log_warn_suppress(_no_discards++, "WARNING: Thin pool target does "
"not support discards (needs kernel >= 3.4)."); "not support discards (needs kernel >= 3.4).");