1
0
mirror of git://sourceware.org/git/lvm2.git synced 2024-12-21 13:34:40 +03:00

Reindent code

Avoid 1 indent level and use check for empty list only for
add of transaction_id message.
This commit is contained in:
Zdenek Kabelac 2011-10-20 10:32:29 +00:00
parent 7b199dc599
commit 79c1f9fcf4

View File

@ -241,41 +241,42 @@ static int _thin_pool_add_target_line(struct dev_manager *dm,
seg->zero_new_blocks ? 0 : 1))
return_0;
if (!dm_list_empty(&seg->thin_messages)) {
dm_list_iterate_items(lmsg, &seg->thin_messages) {
dmsg.type = lmsg->type;
switch (lmsg->type) {
case DM_THIN_MESSAGE_CREATE_SNAP:
/* FIXME: to be implemented */
log_debug("Thin pool create_snap %s.", lmsg->u.lv->name);
dmsg.u.m_create_snap.device_id = first_seg(lmsg->u.lv)->device_id;
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(INTERNAL_ERROR "Sorry, not implemented yet.");
return 0;
case DM_THIN_MESSAGE_CREATE_THIN:
log_debug("Thin pool create_thin %s.", lmsg->u.lv->name);
dmsg.u.m_create_thin.device_id = first_seg(lmsg->u.lv)->device_id;
if (!dm_tree_node_add_thin_pool_message(node, &dmsg))
return_0;
break;
case DM_THIN_MESSAGE_DELETE:
log_debug("Thin pool delete %u.", lmsg->u.delete_id);
dmsg.u.m_delete.device_id = lmsg->u.delete_id;
if (!dm_tree_node_add_thin_pool_message(node, &dmsg))
return_0;
break;
case DM_THIN_MESSAGE_TRIM:
/* FIXME: to be implemented */
log_error(INTERNAL_ERROR "Sorry, not implemented yet.");
return 0;
default:
log_error(INTERNAL_ERROR "Unsupported message.");
return 0;
}
dm_list_iterate_items(lmsg, &seg->thin_messages) {
dmsg.type = lmsg->type;
switch (lmsg->type) {
case DM_THIN_MESSAGE_CREATE_SNAP:
/* FIXME: to be implemented */
log_debug("Thin pool create_snap %s.", lmsg->u.lv->name);
dmsg.u.m_create_snap.device_id = first_seg(lmsg->u.lv)->device_id;
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.");
return 0;
case DM_THIN_MESSAGE_CREATE_THIN:
log_debug("Thin pool create_thin %s.", lmsg->u.lv->name);
dmsg.u.m_create_thin.device_id = first_seg(lmsg->u.lv)->device_id;
if (!dm_tree_node_add_thin_pool_message(node, &dmsg))
return_0;
break;
case DM_THIN_MESSAGE_DELETE:
log_debug("Thin pool delete %u.", lmsg->u.delete_id);
dmsg.u.m_delete.device_id = lmsg->u.delete_id;
if (!dm_tree_node_add_thin_pool_message(node, &dmsg))
return_0;
break;
case DM_THIN_MESSAGE_TRIM:
/* FIXME: to be implemented */
log_error("Sorry TRIM is not yes supported.");
return 0;
default:
log_error(INTERNAL_ERROR "Unsupported message.");
return 0;
}
}
if (!dm_list_empty(&seg->thin_messages)) {
/* Messages were passed, modify transaction_id as the last one */
log_debug("Thin pool set_transaction_id %" PRIu64 ".", seg->transaction_id);
dmsg.type = DM_THIN_MESSAGE_SET_TRANSACTION_ID;
dmsg.u.m_set_transaction_id.current_id = seg->transaction_id - 1;