diff options
author | Zdenek Kabelac <zkabelac@redhat.com> | 2015-12-15 15:13:11 +0100 |
---|---|---|
committer | Zdenek Kabelac <zkabelac@redhat.com> | 2016-01-14 11:34:05 +0100 |
commit | ebcfd09ba9631b52762b4932fbe06260326b9827 (patch) | |
tree | 679653069571225a9b993ae9b0e12abf71b3f837 | |
parent | 753a496348828fd296f79af2cf4803eade5c375b (diff) | |
download | lvm2-ebcfd09ba9631b52762b4932fbe06260326b9827.tar.gz |
cleanup: more readable check
-rw-r--r-- | lib/metadata/lv_manip.c | 21 |
1 files changed, 9 insertions, 12 deletions
diff --git a/lib/metadata/lv_manip.c b/lib/metadata/lv_manip.c index dd9df3b30..62564c572 100644 --- a/lib/metadata/lv_manip.c +++ b/lib/metadata/lv_manip.c @@ -5146,22 +5146,19 @@ static int _lvresize_check_type(struct cmd_context *cmd, const struct logical_vo } } - if (lv_is_thin_pool(lv)) { - if (lp->resize == LV_REDUCE) { + if (lp->resize == LV_REDUCE) { + if (lv_is_thin_pool(lv)) { log_error("Thin pool volumes cannot be reduced in size yet."); return 0; } - } - - if ((lp->resize == LV_REDUCE) && lv_is_thin_pool_metadata(lv)) { - log_error("Thin pool metadata volumes cannot be reduced."); - return 0; - } - - if (lv_is_thin_volume(lv) && first_seg(lv)->external_lv && - (lp->resize == LV_EXTEND)) { + if (lv_is_thin_pool_metadata(lv)) { + log_error("Thin pool metadata volumes cannot be reduced."); + return 0; + } + } else if (lp->resize == LV_EXTEND) { /* Validate thin target supports bigger size of thin volume then external origin */ - if (first_seg(lv)->external_lv->size <= lv->size && + if (lv_is_thin_volume(lv) && first_seg(lv)->external_lv && + (lv->size > first_seg(lv)->external_lv->size) && !thin_pool_feature_supported(first_seg(lv)->pool_lv, THIN_FEATURE_EXTERNAL_ORIGIN_EXTEND)) { log_error("Thin target does not support external origin smaller then thin volume."); return 0; |