LVM2/lib activate/dev_manager.c metadata/lv_ma ...
CVSROOT: /cvs/lvm2
Module name: LVM2
Changes by: zkabelac at sourceware.org 2011-09-29 08:56:39
Modified files:
lib/activate : dev_manager.c lib/metadata : lv_manip.c merge.c metadata-exported.h lib/thin : thin.c
Log message:
Add experimental code for activation of thinp targets
No dm messages yes - just a base functionality in the steps of other targets. For now usable only for debugging and tracing.
Patches:
http://sourceware.org/cgi-bin/cvsweb.cgi/LVM2/lib/activate/dev_manager.c.diff?cvsroot=lvm2&r1=1.233&r2=1.234
http://sourceware.org/cgi-bin/cvsweb.cgi/LVM2/lib/metadata/lv_manip.c.diff?cvsroot=lvm2&r1=1.291&r2=1.292
http://sourceware.org/cgi-bin/cvsweb.cgi/LVM2/lib/metadata/merge.c.diff?cvsroot=lvm2&r1=1.49&r2=1.50
http://sourceware.org/cgi-bin/cvsweb.cgi/LVM2/lib/metadata/metadata-exported.h.diff?cvsroot=lvm2&r1=1.212&r2=1.213
http://sourceware.org/cgi-bin/cvsweb.cgi/LVM2/lib/thin/thin.c.diff?cvsroot=lvm2&r1=1.12&r2=1.13
lib/activate/dev_manager.c +6 -0
@@ -1485,7 +1485,13 @@ }else if (lv_is_cow (seg->lv) && !layer) {if (!_add_new_lv_to_dtree (dm, dtree, seg->lv, laopts,"cow" )) return_0; + }else if (lv_is_thin_volume (seg->lv)) { +if (!_add_new_lv_to_dtree (dm, dtree, seg->pool_lv, laopts,NULL )) + return_0; }else { +if (lv_is_thin_pool (seg->lv) && + !_add_new_lv_to_dtree (dm, dtree, seg->pool_metadata_lv, laopts,NULL )) + return_0;/* Add any LVs used by this segment */ for (s =0 ; s < seg->area_count; s++) { if ((seg_type(seg, s) == AREA_LV) &&
lib/metadata/lv_manip.c +18 -3
@@ -2602,9 +2602,17 @@ r =_lv_extend_layered_lv (ah, lv, extents,0 , stripes, stripe_size); -if (r &&segtype_is_thin_pool (segtype)) - r =lv_add_segment (ah, ah->area_count,1 ,first_seg (lv)->pool_metadata_lv, -get_segtype_from_string (lv->vg->cmd,"striped" ),0 ,0 ,0 ); +if (r &&segtype_is_thin_pool (segtype)) { +/* FIXME: resize metadata size here for now */ +struct logical_volume *tmeta =first_seg (lv)->pool_metadata_lv; +if ((r =lv_add_segment (ah, ah->area_count,1 , tmeta, +get_segtype_from_string (lv->vg->cmd,"striped" ),0 ,0 ,0 ))) { +if (!(r =lv_extend (tmeta,first_seg (tmeta)->segtype, +1 ,0 ,1 ,0 ,10 ,NULL , allocatable_pvs,ALLOC_INHERIT ))) + stack; + }else + stack; + } }alloc_destroy (ah);return r;
@@ -4106,6 +4114,13 @@if (seg_is_thin_pool (lp) && lp->zero)first_seg (lv)->zero_new_blocks =1 ; +if (seg_is_thin_pool (lp)) { +/* FIXME: add lvcreate params - maybe -c/--chunksize?, +* use lowwatermark via lvm.conf global for all thinpools ?*/ +first_seg (lv)->data_block_size =128 ; +first_seg (lv)->low_water_mark =4096 ; + } + if (lp->log_count && !seg_is_raid(first_seg(lv)) && seg_is_mirrored(first_seg(lv))) { if (!add_mirror_log(cmd, lv, lp->log_count,
lib/metadata/merge.c +12 -0
@@ -201,6 +201,12 @@ lv->name, seg_count); inc_error_count; } + +if (seg->data_block_size <128 || seg->data_block_size >2097152 ) { +log_error ("LV %s: thin pool segment %u data block size %d is out of range" , + lv->name, seg_count, seg->data_block_size); + inc_error_count; + } }else {if (seg->pool_metadata_lv) { log_error("LV %s: segment %u must not have thin pool metadata LV set",
@@ -231,6 +237,12 @@ lv->name, seg_count); inc_error_count; } + +if (seg->device_id >= (1 <<24 )) { +log_error ("LV %s: thin volume segment %u pool LV to large device id %d" , + lv->name, seg_count, seg->device_id); + inc_error_count; + } }else {if (seg->pool_lv) { log_error("LV %s: segment %u must not have thin pool LV set",
lib/metadata/metadata-exported.h +4 -2
@@ -335,9 +335,11 @@struct lv_segment_area *meta_areas;/* For RAID */ struct logical_volume *pool_metadata_lv;/* For thin_pool */ uint64_t transaction_id;/* For thin_pool */ -uint32_t zero_new_blocks;/* For thin_pool */ +uint64_t low_water_mark;/* For thin_pool */ +uint32_t data_block_size;/* For thin_pool, 128..2097152 */ +unsigned zero_new_blocks;/* For thin_pool */ struct logical_volume *pool_lv;/* For thin */ -uint64_t device_id;/* For thin */ +uint32_t device_id;/* For thin, 24bit */ struct logical_volume *replicator;/* For replicator-devs - link to replicator LV */ struct logical_volume *rlog_lv;/* For replicators */
lib/thin/thin.c +68 -2
118 lines not on this page · raw message