LVM2 lib/format_text/flags.c lib/metadata/lv_m ...
CVSROOT: /cvs/lvm2
Module name: LVM2
Changes by: agk at sourceware.org 2011-09-08 16:41:20
Modified files:
lib/format_text: flags.c
lib/metadata : lv_manip.c merge.c metadata-exported.h
metadata.h thin_manip.c
lib/thin : thin.c
tools : lvcreate.c
Log message:
lvcreate/remove thin_pool and thin volumes (--driverloaded n only)
Patches:
http://sourceware.org/cgi-bin/cvsweb.cgi/LVM2/lib/format_text/flags.c.diff?cvsroot=lvm2&r1=1.47&r2=1.48
http://sourceware.org/cgi-bin/cvsweb.cgi/LVM2/lib/metadata/lv_manip.c.diff?cvsroot=lvm2&r1=1.282&r2=1.283
http://sourceware.org/cgi-bin/cvsweb.cgi/LVM2/lib/metadata/merge.c.diff?cvsroot=lvm2&r1=1.47&r2=1.48
http://sourceware.org/cgi-bin/cvsweb.cgi/LVM2/lib/metadata/metadata-exported.h.diff?cvsroot=lvm2&r1=1.208&r2=1.209
http://sourceware.org/cgi-bin/cvsweb.cgi/LVM2/lib/metadata/metadata.h.diff?cvsroot=lvm2&r1=1.254&r2=1.255
http://sourceware.org/cgi-bin/cvsweb.cgi/LVM2/lib/metadata/thin_manip.c.diff?cvsroot=lvm2&r1=1.2&r2=1.3
http://sourceware.org/cgi-bin/cvsweb.cgi/LVM2/lib/thin/thin.c.diff?cvsroot=lvm2&r1=1.11&r2=1.12
http://sourceware.org/cgi-bin/cvsweb.cgi/LVM2/tools/lvcreate.c.diff?cvsroot=lvm2&r1=1.239&r2=1.240
lib/format_text/flags.c +4 -0
@@ -71,6 +71,10 @@ {VIRTUAL_ORIGIN, NULL, 0}, {REPLICATOR, NULL, 0}, {REPLICATOR_LOG, NULL, 0}, + {THIN_VOLUME, NULL, 0}, + {THIN_POOL, NULL, 0}, + {THIN_POOL_DATA, NULL, 0}, + {THIN_POOL_METADATA, NULL, 0}, {0, NULL, 0} };
lib/metadata/lv_manip.c +90 -53
256 lines not on this page · raw message
lib/metadata/merge.c +110 -0
128 lines not on this page · raw message
lib/metadata/metadata-exported.h +2 -3
@@ -85,8 +85,8 @@#define THIN_VOLUME UINT64_C(0x0000001000000000)/* LV */ #define THIN_POOL UINT64_C(0x0000002000000000)/* LV */ -#define THIN_POOL_DATA UINT64_C(0x0000002000000000)/* LV */ -#define THIN_POOL_METADATA UINT64_C(0x0000004000000000)/* LV */ +#define THIN_POOL_DATA UINT64_C(0x0000004000000000)/* LV */ +#define THIN_POOL_METADATA UINT64_C(0x0000008000000000)/* LV */ #define LVM_READ 0x00000100U/* LV VG 32-bit */ #define LVM_WRITE 0x00000200U/* LV VG 32-bit */
@@ -327,7 +327,6 @@struct lv_segment_area *areas;struct lv_segment_area *meta_areas;/* For RAID */ -struct logical_volume *pool_data_lv;/* For thin_pool */ struct logical_volume *pool_metadata_lv;/* For thin_pool */ uint64_t transaction_id;/* For thin_pool */ uint32_t zero_new_blocks;/* For thin_pool */
lib/metadata/metadata.h +4 -0
@@ -371,6 +371,9 @@/* Find LV segment containing given LE */ struct lv_segment *find_seg_by_le (const struct logical_volume *lv,uint32_t le); +/* Find pool LV segment given a thin pool data or metadata segment. */ +struct lv_segment *find_pool_seg (struct lv_segment *seg); +/* * Remove a dev_dir if present. */
@@ -447,6 +450,7 @@int attach_pool_data_lv (struct lv_segment *seg,struct logical_volume *pool_data_lv);int attach_pool_lv (struct lv_segment *seg,struct logical_volume *pool_lv); +int detach_pool_lv (struct lv_segment *seg);/* * Begin skeleton for external LVM library
lib/metadata/thin_manip.c +44 -4
67 lines not on this page · raw message
lib/thin/thin.c +14 -3
@@ -61,10 +61,10 @@if (!(pool_metadata_lv =find_lv (seg->lv->vg, lv_name)))return SEG_LOG_ERROR ("Unknown metadata %s in" , lv_name); -if (!attach_pool_metadata_lv (seg, pool_metadata_lv)) +if (!attach_pool_data_lv (seg, pool_data_lv)) return_0; -if (!attach_pool_data_lv (seg, pool_data_lv)) +if (!attach_pool_metadata_lv (seg, pool_metadata_lv)) return_0;if (!dm_config_get_uint64 (sn,"transaction_id" , &seg->transaction_id))
@@ -74,12 +74,22 @@ !dm_config_get_uint32(sn, "zero_new_blocks", &seg->zero_new_blocks))return SEG_LOG_ERROR ("Could not read zero_new_blocks for" ); + seg->lv->status |=THIN_POOL ; + +return 1 ; +} + +static int _thin_pool_text_import_area_count (const struct dm_config_node *sn, +uint32_t *area_count) +{ + *area_count =1 ; +return 1 ; }static int _thin_pool_text_export (const struct lv_segment *seg,struct formatter *f) { -outf (f,"pool = \"%s\"" , seg->pool_data_lv->name); +outf (f,"pool = \"%s\"" ,seg_lv (seg,0 )->name);outf (f,"metadata = \"%s\"" , seg->pool_metadata_lv->name);outf (f,"transaction_id = %" PRIu64, seg->transaction_id);if (seg->zero_new_blocks)
@@ -182,6 +192,7 @@static struct segtype_handler _thin_pool_ops = { .name = _thin_pool_name, .text_import = _thin_pool_text_import, + .text_import_area_count = _thin_pool_text_import_area_count, .text_export = _thin_pool_text_export, .modules_needed = _thin_modules_needed, .destroy = _thin_destroy,
tools/lvcreate.c +5 -0
@@ -590,6 +590,11 @@ lp->segtype =get_segtype_from_string (cmd,arg_str_value (cmd, type_ARG, segtype_str)); +if (seg_unknown (lp)) { +log_error ("Unable to create LV with unknown segment type %s." ,arg_str_value (cmd, type_ARG, segtype_str)); +return 0 ; + } +if (arg_count (cmd, snapshot_ARG) ||seg_is_snapshot (lp) || (!seg_is_thin (lp) &&arg_count (cmd, virtualsize_ARG))) lp->snapshot =1 ;