LVM2/lib metadata/lv_manip.c metadata/metadata ...
CVSROOT: /cvs/lvm2
Module name: LVM2
Changes by: zkabelac at sourceware.org 2011-10-17 14:17:10
Modified files:
lib/metadata : lv_manip.c metadata-exported.h metadata.h
thin_manip.c
lib/thin : thin.c
Log message:
Message support for thin provisiong
lvm part of messaging.
Each message is now stored it's own thin pool section:
message1 {
create = lv
}
Messages are queued to thin pool dm target when this target is going to be resumed or used through some dependency.
Currently 'delete' message are purely queued and processed with next thin pool resume operation (i.e. create_thin).
WARNING - thin provisioning support is developmental code.
Patches:
http://sourceware.org/cgi-bin/cvsweb.cgi/LVM2/lib/metadata/lv_manip.c.diff?cvsroot=lvm2&r1=1.294&r2=1.295
http://sourceware.org/cgi-bin/cvsweb.cgi/LVM2/lib/metadata/metadata-exported.h.diff?cvsroot=lvm2&r1=1.214&r2=1.215
http://sourceware.org/cgi-bin/cvsweb.cgi/LVM2/lib/metadata/metadata.h.diff?cvsroot=lvm2&r1=1.257&r2=1.258
http://sourceware.org/cgi-bin/cvsweb.cgi/LVM2/lib/metadata/thin_manip.c.diff?cvsroot=lvm2&r1=1.6&r2=1.7
http://sourceware.org/cgi-bin/cvsweb.cgi/LVM2/lib/thin/thin.c.diff?cvsroot=lvm2&r1=1.16&r2=1.17
lib/metadata/lv_manip.c +13 -3
@@ -1,6 +1,6 @@/* * Copyright (C) 2001-2004 Sistina Software, Inc. All rights reserved. -* Copyright (C) 2004-2007 Red Hat, Inc. All rights reserved. +* Copyright (C) 2004-2011 Red Hat, Inc. All rights reserved. * * This file is part of LVM2. *
@@ -251,6 +251,7 @@ seg->extents_copied = extents_copied; seg->pvmove_source_seg = pvmove_source_seg;dm_list_init (&seg->tags); +dm_list_init (&seg->thin_messages);if (thin_pool_lv && !attach_pool_lv (seg, thin_pool_lv)) return_NULL;
@@ -4173,9 +4174,9 @@return NULL ; } -if (!lv_send_message (pool_lv,"create_thin %u" ,first_seg (lv)->device_id)) +if (!attach_pool_message (first_seg (pool_lv), +DM_THIN_MESSAGE_CREATE_THIN , lv,0 ,0 )) return_NULL; -/* * FIXME: Skipping deactivate_lv(pool_lv) as it is going to be needed anyway * but revert_new_lv should revert to deactivated state.
@@ -4238,6 +4239,15 @@if (!set_lv (cmd,first_seg (lv)->pool_metadata_lv,UINT64_C (0 ),0 ))log_error ("Aborting. Failed to wipe pool metadata %s." , lv->name); + }else if (seg_is_thin_volume (lp)) { +/* since we've got here, we may drop any queued thin messages */ +if (!detach_pool_messages (first_seg (first_seg (lv)->pool_lv))) + goto deactivate_and_revert_new_lv; + +if (!vg_write (vg) || !vg_commit (vg)) + goto deactivate_and_revert_new_lv; + +backup (vg); }if (lp->snapshot) {
lib/metadata/metadata-exported.h +10 -0
@@ -256,6 +256,15 @@ } u; }; +struct lv_thin_message { +struct dm_list list;/* Chained list of messages */ +dm_thin_message_t type;/* Use dm thin message datatype */ +union { +struct logical_volume *lv;/* For: create_thin, create_snap, trim */ +uint32_t delete_id;/* For delete, needs device_id */ + } u; +}; +struct segment_type ;/* List with vg_name, vgid and flags */
@@ -338,6 +347,7 @@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 dm_list thin_messages;/* For thin_pool */ struct logical_volume *pool_lv;/* For thin */ uint32_t device_id;/* For thin, 24bit */
lib/metadata/metadata.h +4 -0
@@ -454,6 +454,10 @@ 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); +int attach_pool_message (struct lv_segment *seg,dm_thin_message_t type, +struct logical_volume *lv,uint32_t device_id, +int read_only); +int detach_pool_messages (struct lv_segment *seg);/* * Begin skeleton for external LVM library
lib/metadata/thin_manip.c +66 -0
75 lines not on this page · raw message
lib/thin/thin.c +141 -1
184 lines not on this page · raw message