From: zkabelac@sourceware.org <zkabelac@sourceware.org>
To: lvm-devel@redhat.com
Subject: LVM2/lib/metadata lv_manip.c
Date: 22 Oct 2011 16:48:59 -0000 [thread overview]
Message-ID: <20111022164859.9914.qmail@sourceware.org> (raw)
CVSROOT: /cvs/lvm2
Module name: LVM2
Changes by: zkabelac at sourceware.org 2011-10-22 16:48:59
Modified files:
lib/metadata : lv_manip.c
Log message:
Remove old thin code from _lv_insert_empty_sublvs
Since thin is not able to use _lv_insert_empty_sublvs,
remove its appearence from this function.
Start to use extend_pool() function for desired functionality
and modify lv_extend() for this.
Patches:
http://sourceware.org/cgi-bin/cvsweb.cgi/LVM2/lib/metadata/lv_manip.c.diff?cvsroot=lvm2&r1=1.302&r2=1.303
--- LVM2/lib/metadata/lv_manip.c 2011/10/22 16:46:34 1.302
+++ LVM2/lib/metadata/lv_manip.c 2011/10/22 16:48:59 1.303
@@ -2369,9 +2369,6 @@
lv->status |= MIRRORED;
sub_lv_status = MIRROR_IMAGE;
layer_name = "mimage";
- } else if (segtype_is_thin_pool(segtype)) {
- lv->status |= THIN_POOL;
- layer_name = "tpool";
} else
return_0;
@@ -2406,19 +2403,13 @@
lv->alloc, lv->vg)))
return_0;
- if (segtype_is_thin_pool(segtype)) {
- if (!attach_pool_data_lv(mapseg, sub_lv))
- return_0;
- } else if (!set_lv_segment_area_lv(mapseg, i, sub_lv, 0, sub_lv_status))
+ if (!set_lv_segment_area_lv(mapseg, i, sub_lv, 0, sub_lv_status))
return_0;
- /* Metadata LVs for raid or thin pool */
+ /* Metadata LVs for raid */
if (segtype_is_raid(segtype)) {
if (dm_snprintf(img_name, len, "%s_rmeta_%u", lv->name, i) < 0)
return_0;
- } else if (segtype_is_thin_pool(segtype)) {
- if (dm_snprintf(img_name, len, "%s_tmeta", lv->name) < 0)
- return_0;
} else
continue;
@@ -2428,12 +2419,10 @@
lv->alloc, lv->vg)))
return_0;
- if (segtype_is_thin_pool(segtype)) {
- if (!attach_pool_metadata_lv(mapseg, sub_lv))
- return_0;
- } else if (!set_lv_segment_area_lv(mapseg, i, sub_lv, 0, RAID_META))
+ if (!set_lv_segment_area_lv(mapseg, i, sub_lv, 0, RAID_META))
return_0;
}
+
dm_list_add(&lv->segments, &mapseg->list);
return 1;
@@ -2562,29 +2551,15 @@
struct alloc_handle *ah;
uint32_t sub_lv_count;
- /*
- * For RAID, all the devices are AREA_LV.
- * However, for 'mirror on stripe' using non-RAID targets,
- * the mirror legs are AREA_LV while the stripes underneath
- * are AREA_PV.
- */
- if (segtype_is_raid(segtype))
- sub_lv_count = mirrors * stripes + segtype->parity_devs;
- else if (segtype_is_thin_pool(segtype))
- sub_lv_count = 1;
- else
- sub_lv_count = mirrors;
-
log_very_verbose("Extending segment type, %s", segtype->name);
if (segtype_is_virtual(segtype))
return lv_add_virtual_segment(lv, 0u, extents, segtype, thin_pool_name);
- if (segtype_is_raid(segtype) && !lv->le_count)
- log_count = mirrors * stripes;
-
if (segtype_is_thin_pool(segtype))
log_count = 1;
+ else if (segtype_is_raid(segtype) && !lv->le_count)
+ log_count = mirrors * stripes;
/* Thin pool allocation treats its metadata device like a mirror log. */
if (!(ah = allocate_extents(lv->vg, lv, segtype, stripes, mirrors,
@@ -2592,10 +2567,24 @@
allocatable_pvs, alloc, NULL)))
return_0;
- if (!segtype_is_mirrored(segtype) && !segtype_is_raid(segtype) && !segtype_is_thin_pool(segtype))
+ if (segtype_is_thin_pool(segtype)) {
+ if (!(r = extend_pool(lv, segtype, ah)))
+ stack;
+ } else if (!segtype_is_mirrored(segtype) && !segtype_is_raid(segtype))
r = lv_add_segment(ah, 0, ah->area_count, lv, segtype,
stripe_size, 0u, 0);
else {
+ /*
+ * For RAID, all the devices are AREA_LV.
+ * However, for 'mirror on stripe' using non-RAID targets,
+ * the mirror legs are AREA_LV while the stripes underneath
+ * are AREA_PV.
+ */
+ if (segtype_is_raid(segtype))
+ sub_lv_count = mirrors * stripes + segtype->parity_devs;
+ else
+ sub_lv_count = mirrors;
+
if (!lv->le_count &&
!_lv_insert_empty_sublvs(lv, segtype, stripe_size,
region_size, sub_lv_count)) {
@@ -4202,34 +4191,12 @@
init_dmeventd_monitor(lp->activation_monitoring);
- if (seg_is_thin_pool(lp)) {
- /* FIXME: skipping in test mode is not going work */
- if (!activate_lv_excl(cmd, first_seg(lv)->pool_metadata_lv) ||
- /* Clear 4KB of metadata device for new thin-pool. */
- // FIXME: maybe -zero n should allow to recreate same thin pool
- // and different option should be used for zero_new_blocks
- !set_lv(cmd, first_seg(lv)->pool_metadata_lv, UINT64_C(0), 0)) {
- log_error("Aborting. Failed to wipe pool metadata %s.",
- lv->name);
- goto revert_new_lv;
- }
- /* FIXME: we may postpone finish of the pool creation to the
- * moment of the first activation - but this needs more changes
- * so we would update metadata with vgchange -ay
- *
- * For now always activate.
- */
+ if (seg_is_thin_pool(lp) || seg_is_thin(lp)) {
if (!activate_lv_excl(cmd, lv)) {
- log_error("Aborting. Could not to activate thin pool %s.",
+ log_error("Aborting. Failed to activate thin %s.",
lv->name);
goto revert_new_lv;
}
- } else if (seg_is_thin(lp)) {
- /* FIXME: same as with thin pool - add lazy creation support */
- if (!activate_lv_excl(cmd, lv)) {
- log_error("Aborting. Failed to activate thin %s.", lv->name);
- goto revert_new_lv;
- }
} else if (lp->snapshot) {
if (!activate_lv_excl(cmd, lv)) {
log_error("Aborting. Failed to activate snapshot "
next reply other threads:[~2011-10-22 16:48 UTC|newest]
Thread overview: 76+ messages / expand[flat|nested] mbox.gz Atom feed top
2011-10-22 16:48 zkabelac [this message]
-- strict thread matches above, loose matches on Subject: below --
2012-05-11 15:32 LVM2/lib/metadata lv_manip.c agk
2012-05-11 15:26 agk
2012-03-04 15:57 zkabelac
2012-03-01 10:09 zkabelac
2012-02-28 10:08 zkabelac
2012-02-12 21:37 agk
2012-02-01 2:11 agk
2012-01-26 21:39 zkabelac
2012-01-25 11:27 zkabelac
2012-01-25 9:15 zkabelac
2012-01-25 9:14 zkabelac
2012-01-25 9:02 zkabelac
2012-01-25 8:57 zkabelac
2012-01-24 14:54 agk
2012-01-24 14:15 mbroz
2012-01-19 15:39 zkabelac
2011-11-15 17:29 zkabelac
2011-11-15 17:23 zkabelac
2011-11-12 22:53 zkabelac
2011-11-12 22:52 zkabelac
2011-11-12 22:51 zkabelac
2011-11-10 12:42 zkabelac
2011-11-10 12:42 zkabelac
2011-11-10 12:39 zkabelac
2011-11-07 13:54 agk
2011-11-04 22:45 zkabelac
2011-11-03 15:46 zkabelac
2011-11-03 14:56 zkabelac
2011-10-30 22:02 zkabelac
2011-10-28 20:29 zkabelac
2011-10-28 20:18 zkabelac
2011-10-22 16:46 zkabelac
2011-10-21 9:55 zkabelac
2011-10-20 10:35 zkabelac
2011-10-03 18:43 zkabelac
2011-09-16 18:39 jbrassow
2011-09-16 12:12 zkabelac
2011-09-16 11:59 zkabelac
2011-09-06 15:39 agk
2011-08-19 22:55 agk
2011-08-19 16:41 agk
2011-08-10 16:44 jbrassow
2011-08-05 9:21 prajnoha
2011-06-06 12:08 agk
2011-03-25 22:02 jbrassow
2011-03-25 22:10 ` Zdenek Kabelac
2010-04-08 0:56 agk
2010-04-08 0:52 agk
2010-04-02 1:35 agk
2010-04-01 13:58 agk
2010-04-01 12:29 agk
2010-03-31 20:26 agk
2010-02-17 23:36 snitzer
2010-01-20 21:53 snitzer
2010-01-14 10:17 zkabelac
2010-01-14 10:09 zkabelac
2010-01-14 10:08 zkabelac
2010-01-13 1:52 snitzer
2010-01-13 1:51 snitzer
2010-01-10 20:44 snitzer
2010-01-08 23:06 jbrassow
2009-06-06 16:37 mbroz
2009-06-01 14:23 mbroz
2009-01-06 17:24 mbroz
2008-01-16 20:00 agk
2007-11-04 16:28 agk
2007-08-08 18:00 wysochanski
2007-08-09 2:46 ` jorge alberto garcia gonzalez
2007-08-09 2:52 ` jorge alberto garcia gonzalez
2007-08-07 18:55 wysochanski
2007-08-07 16:57 wysochanski
2007-08-06 20:35 wysochanski
2007-08-07 12:52 ` Alasdair G Kergon
2007-08-07 12:56 ` Alasdair G Kergon
2007-08-07 21:15 ` Jun'ichi Nomura
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20111022164859.9914.qmail@sourceware.org \
--to=zkabelac@sourceware.org \
--cc=lvm-devel@redhat.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.