LVM2 lib/thin/thin.c libdm/libdevmapper.h libd ...
CVSROOT: /cvs/lvm2
Module name: LVM2
Changes by: zkabelac at sourceware.org 2011-11-03 14:45:01
Modified files:
lib/thin : thin.c
libdm : libdevmapper.h libdm-deptree.c
Log message:
Thin api change for passing message into libdm
Avoid exposing another struct to the libdm user and use only simple dm_tree_node_add_thin_pool_message with 2 overloaded uint64_t values.
Patches:
http://sourceware.org/cgi-bin/cvsweb.cgi/LVM2/lib/thin/thin.c.diff?cvsroot=lvm2&r1=1.28&r2=1.29
http://sourceware.org/cgi-bin/cvsweb.cgi/LVM2/libdm/libdevmapper.h.diff?cvsroot=lvm2&r1=1.167&r2=1.168
http://sourceware.org/cgi-bin/cvsweb.cgi/LVM2/libdm/libdm-deptree.c.diff?cvsroot=lvm2&r1=1.143&r2=1.144
lib/thin/thin.c +16 -14
@@ -222,7 +222,6 @@ {char *metadata_dlid, *pool_dlid;const struct lv_thin_message *lmsg; -struct dm_thin_message dmsg;if (!(metadata_dlid =build_dm_uuid (mem, seg->pool_metadata_lv->lvid.s,NULL ))) { log_error("Failed to build uuid for metadata LV %s.",
@@ -243,27 +242,30 @@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)) +if (!dm_tree_node_add_thin_pool_message (node, + lmsg->type, +first_seg (lmsg->u.lv)->device_id, +0 ))//first_seg(first_seg(lmsg->u.lv)->origin)->device_id; return_0;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); - dmsg.u.m_create_thin.device_id =first_seg (lmsg->u.lv)->device_id; -if (!dm_tree_node_add_thin_pool_message (node, &dmsg)) +if (!dm_tree_node_add_thin_pool_message (node, + lmsg->type, +first_seg (lmsg->u.lv)->device_id, +0 )) 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)) +if (!dm_tree_node_add_thin_pool_message (node, + lmsg->type, + lmsg->u.delete_id,0 )) return_0;break ;case DM_THIN_MESSAGE_TRIM :
@@ -278,11 +280,11 @@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 ; - dmsg.u.m_set_transaction_id.new_id = seg->transaction_id; -if (!dm_tree_node_add_thin_pool_message (node, &dmsg)) +log_debug ("Thin pool set transaction id %" PRIu64"." , seg->transaction_id); +if (!dm_tree_node_add_thin_pool_message (node, +DM_THIN_MESSAGE_SET_TRANSACTION_ID , + seg->transaction_id -1 , + seg->transaction_id)) return_0; }
libdm/libdevmapper.h +7 -30
@@ -555,39 +555,16 @@/* Supported messages for thin provision target */ typedef enum { -DM_THIN_MESSAGE_CREATE_SNAP , -DM_THIN_MESSAGE_CREATE_THIN , -DM_THIN_MESSAGE_DELETE , -DM_THIN_MESSAGE_SET_TRANSACTION_ID , -DM_THIN_MESSAGE_TRIM +DM_THIN_MESSAGE_CREATE_SNAP ,/* device_id, origin_id */ +DM_THIN_MESSAGE_CREATE_THIN ,/* device_id */ +DM_THIN_MESSAGE_DELETE ,/* device_id */ +DM_THIN_MESSAGE_SET_TRANSACTION_ID ,/* current_id, new_id */ +DM_THIN_MESSAGE_TRIM /* device_id, new_size */ }dm_thin_message_t ; -struct dm_thin_message { -dm_thin_message_t type; -union { -struct { -uint32_t device_id; -uint32_t origin_id; - } m_create_snap; -struct { -uint32_t device_id; - } m_create_thin; -struct { -uint32_t device_id; - } m_delete; -struct { -uint64_t current_id; -uint64_t new_id; - } m_set_transaction_id; -struct { -uint32_t device_id; -uint64_t new_size; - } m_trim; - } u; -}; -int dm_tree_node_add_thin_pool_message (struct dm_tree_node *node, -const struct dm_thin_message *message); +dm_thin_message_t type, +uint64_t id1,uint64_t id2);/* * FIXME: Defines bellow are based on kernel's dm-thin.c defines
libdm/libdm-deptree.c +49 -18
111 lines not on this page · raw message