1
0
mirror of git://sourceware.org/git/lvm2.git synced 2025-01-23 02:05:07 +03:00

Thin cleanups

Fix/cleanup several error messages.
Remove test for seg_is_thin which could never be true there.
Replace (1<<24) with predefined constant.
This commit is contained in:
Zdenek Kabelac 2011-10-30 22:00:57 +00:00
parent 9c5039d3e1
commit eadb017622
3 changed files with 12 additions and 10 deletions

View File

@ -4206,7 +4206,7 @@ static struct logical_volume *_lv_create_an_lv(struct volume_group *vg, struct l
(lp->activate == CHANGE_AE && !activate_lv_excl(cmd, lv)) ||
(lp->activate == CHANGE_ALY && !activate_lv_local(cmd, lv))) {
log_error("Failed to activate new LV.");
if (lp->zero && !seg_is_thin(lp))
if (lp->zero)
goto deactivate_and_revert_new_lv;
return NULL;
}

View File

@ -197,7 +197,8 @@ uint32_t get_free_pool_device_id(struct lv_segment *thin_pool_seg)
struct dm_list *h;
if (!seg_is_thin_pool(thin_pool_seg)) {
log_error("Segment in %s is not a thin pool segment.",
log_error(INTERNAL_ERROR
"Segment in %s is not a thin pool segment.",
thin_pool_seg->lv->name);
return 0;
}
@ -208,9 +209,9 @@ uint32_t get_free_pool_device_id(struct lv_segment *thin_pool_seg)
max_id = dev_id;
}
if (++max_id >= (1 << 24)) {
if (++max_id > DM_THIN_MAX_DEVICE_ID) {
// FIXME: try to find empty holes....
log_error("Free device_id exhausted...");
log_error("Cannot find free device_id.");
return 0;
}
@ -228,8 +229,9 @@ int extend_pool(struct logical_volume *pool_lv, const struct segment_type *segty
const size_t len = strlen(pool_lv->name) + 16;
char name[len];
if (lv_is_thin_pool(pool_lv)) {
log_error("Resize of pool %s not yet implemented.", pool_lv->name);
if (pool_lv->le_count) {
/* FIXME move code for manipulation from lv_manip.c */
log_error(INTERNAL_ERROR "Pool %s has already extents.", pool_lv->name);
return 0;
}
@ -276,7 +278,7 @@ int extend_pool(struct logical_volume *pool_lv, const struct segment_type *segty
return 0;
}
} else {
log_error("Pool %s created without initilization.", pool_lv->name);
log_warn("WARNING: Pool %s is created without initilization.", pool_lv->name);
}
if (dm_snprintf(name, len, "%s_tmeta", pool_lv->name) < 0)

View File

@ -252,7 +252,7 @@ static int _thin_pool_add_target_line(struct dev_manager *dm,
dmsg.u.m_create_snap.origin_id = 0;//first_seg(first_seg(lmsg->u.lv)->origin)->device_id;
if (!dm_tree_node_add_thin_pool_message(node, &dmsg))
return_0;
log_error("Sorry SNAPSHOTS is not yet supported.");
log_error("Sorry SNAPSHOT is not yet supported.");
return 0;
case DM_THIN_MESSAGE_CREATE_THIN:
log_debug("Thin pool create_thin %s.", lmsg->u.lv->name);
@ -268,7 +268,7 @@ static int _thin_pool_add_target_line(struct dev_manager *dm,
break;
case DM_THIN_MESSAGE_TRIM:
/* FIXME: to be implemented */
log_error("Sorry TRIM is not yes supported.");
log_error("Sorry TRIM is not yet supported.");
return 0;
default:
log_error(INTERNAL_ERROR "Unsupported message.");
@ -346,7 +346,7 @@ static int _thin_text_export(const struct lv_segment *seg, struct formatter *f)
#ifdef DEVMAPPER_SUPPORT
static int _thin_add_target_line(struct dev_manager *dm,
struct dm_pool *mem __attribute__((unused)),
struct dm_pool *mem,
struct cmd_context *cmd __attribute__((unused)),
void **target_state __attribute__((unused)),
struct lv_segment *seg,