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

thin: update pool_is_active

Change it to take LV and move it to exported header - seems
to be a better fit for usability from tools/ directory.
This commit is contained in:
Zdenek Kabelac 2013-02-05 16:49:09 +01:00
parent c984d8fbab
commit 7910b6c0ba
4 changed files with 4 additions and 5 deletions

View File

@ -566,6 +566,7 @@ int lv_rename_update(struct cmd_context *cmd, struct logical_volume *lv,
uint64_t extents_from_size(struct cmd_context *cmd, uint64_t size, uint64_t extents_from_size(struct cmd_context *cmd, uint64_t size,
uint32_t extent_size); uint32_t extent_size);
int pool_is_active(const struct logical_volume *pool_lv);
int update_pool_lv(struct logical_volume *lv, int activate); int update_pool_lv(struct logical_volume *lv, int activate);
int get_pool_discards(const char *str, thin_discards_t *discards); int get_pool_discards(const char *str, thin_discards_t *discards);
const char *get_pool_discards_name(thin_discards_t discards); const char *get_pool_discards_name(thin_discards_t discards);

View File

@ -472,7 +472,6 @@ int attach_pool_message(struct lv_segment *pool_seg, dm_thin_message_t type,
int auto_increment); int auto_increment);
int pool_has_message(const struct lv_segment *seg, int pool_has_message(const struct lv_segment *seg,
const struct logical_volume *lv, uint32_t device_id); const struct logical_volume *lv, uint32_t device_id);
int pool_is_active(const struct lv_segment *pool_seg);
int pool_below_threshold(const struct lv_segment *pool_seg); int pool_below_threshold(const struct lv_segment *pool_seg);
int extend_pool(struct logical_volume *lv, const struct segment_type *segtype, int extend_pool(struct logical_volume *lv, const struct segment_type *segtype,
struct alloc_handle *ah, uint32_t stripes, uint32_t stripe_size); struct alloc_handle *ah, uint32_t stripes, uint32_t stripe_size);

View File

@ -234,13 +234,12 @@ int pool_has_message(const struct lv_segment *seg,
return 0; return 0;
} }
int pool_is_active(const struct lv_segment *pool_seg) int pool_is_active(const struct logical_volume *lv)
{ {
struct lvinfo info; struct lvinfo info;
const struct seg_list *sl; const struct seg_list *sl;
const struct logical_volume *lv = pool_seg->lv;
if (!seg_is_thin_pool(pool_seg)) { if (!lv_is_thin_pool(lv)) {
log_error(INTERNAL_ERROR "LV %s is not pool.", lv->name); log_error(INTERNAL_ERROR "LV %s is not pool.", lv->name);
return 0; return 0;
} }

View File

@ -113,7 +113,7 @@ static int lvchange_pool_update(struct cmd_context *cmd,
if (discards != first_seg(lv)->discards) { if (discards != first_seg(lv)->discards) {
if (((discards == THIN_DISCARDS_IGNORE) || if (((discards == THIN_DISCARDS_IGNORE) ||
(first_seg(lv)->discards == THIN_DISCARDS_IGNORE)) && (first_seg(lv)->discards == THIN_DISCARDS_IGNORE)) &&
pool_is_active(first_seg(lv))) pool_is_active(lv))
log_error("Cannot change discards state for active " log_error("Cannot change discards state for active "
"pool volume \"%s\".", lv->name); "pool volume \"%s\".", lv->name);
else { else {