public inbox for lvm2-cvs@sourceware.org help / color / mirror / Atom feed
From: agk@sourceware.org To: lvm2-cvs@sourceware.org Subject: LVM2 ./WHATS_NEW lib/metadata/lv_manip.c lib/m ... Date: Mon, 11 Sep 2006 21:14:00 -0000 [thread overview] Message-ID: <20060911211456.16346.qmail@sourceware.org> (raw) CVSROOT: /cvs/lvm2 Module name: LVM2 Changes by: agk@sourceware.org 2006-09-11 21:14:56 Modified files: . : WHATS_NEW lib/metadata : lv_manip.c metadata.h Log message: Extend _check_contiguous() to detect single-area LVs. Include mirror log (untested) in _for_each_pv() processing. Use MIRROR_LOG_SIZE constant. Remove struct seg_pvs from _for_each_pv() for generalisation. Avoid adding duplicates to list of parallel PVs to avoid. Patches: http://sourceware.org/cgi-bin/cvsweb.cgi/LVM2/WHATS_NEW.diff?cvsroot=lvm2&r1=1.437&r2=1.438 http://sourceware.org/cgi-bin/cvsweb.cgi/LVM2/lib/metadata/lv_manip.c.diff?cvsroot=lvm2&r1=1.101&r2=1.102 http://sourceware.org/cgi-bin/cvsweb.cgi/LVM2/lib/metadata/metadata.h.diff?cvsroot=lvm2&r1=1.148&r2=1.149 --- LVM2/WHATS_NEW 2006/09/11 14:24:58 1.437 +++ LVM2/WHATS_NEW 2006/09/11 21:14:55 1.438 @@ -1,5 +1,10 @@ Version 2.02.10 - ================================== + Extend _check_contiguous() to detect single-area LVs. + Include mirror log (untested) in _for_each_pv() processing. + Use MIRROR_LOG_SIZE constant. + Remove struct seg_pvs from _for_each_pv() to generalise. + Avoid adding duplicates to list of parallel PVs to avoid. Fix several incorrect comparisons in parallel area avoidance code. Fix segment lengths when flattening existing parallel areas. Log existing parallel areas prior to allocation. --- LVM2/lib/metadata/lv_manip.c 2006/09/11 14:24:58 1.101 +++ LVM2/lib/metadata/lv_manip.c 2006/09/11 21:14:56 1.102 @@ -657,7 +657,7 @@ if (log_area) { ah->log_area.pv = log_area->map->pv; ah->log_area.pe = log_area->start; - ah->log_area.len = 1; /* FIXME Calculate & check this */ + ah->log_area.len = MIRROR_LOG_SIZE; /* FIXME Calculate & check this */ consume_pv_area(log_area, ah->log_area.len); } @@ -685,14 +685,21 @@ */ static int _check_contiguous(struct lv_segment *prev_lvseg, struct physical_volume *pv, struct pv_area *pva, - struct pv_area **areas) + struct pv_area **areas, uint32_t areas_size) { struct pv_segment *prev_pvseg; + struct lv_segment *lastseg; uint32_t s; - for (s = 0; s < prev_lvseg->area_count; s++) { - if (seg_type(prev_lvseg, s) != AREA_PV) - continue; /* FIXME Broken */ + for (s = 0; s < prev_lvseg->area_count && s < areas_size; s++) { + if (seg_type(prev_lvseg, s) == AREA_LV) { + lastseg = list_item(list_last(&seg_lv(prev_lvseg, s)->segments), struct lv_segment); + /* FIXME For more areas supply flattened prev_lvseg to ensure consistency */ + if (lastseg->area_count == 1 && + _check_contiguous(lastseg, pv, pva, &areas[s], 1)) + return 1; + continue; + } if (!(prev_pvseg = seg_pvseg(prev_lvseg, s))) continue; /* FIXME Broken */ @@ -796,7 +803,8 @@ if (prev_lvseg && _check_contiguous(prev_lvseg, pvm->pv, - pva, areas)) { + pva, areas, + areas_size)) { contiguous_count++; goto next_pv; } @@ -1374,11 +1382,15 @@ return lv; } -/* Recursively process each PV used by part of an LV */ +/* + * Call fn for each AREA_PV used by the LV segment at lv:le of length *max_seg_len. + * If any constituent area contains more than one segment, max_seg_len is + * reduced to cover only the first. + */ static int _for_each_pv(struct cmd_context *cmd, struct logical_volume *lv, - uint32_t le, uint32_t len, - int (*fn)(struct cmd_context *cmd, struct pv_segment *peg, struct seg_pvs *spvs), - struct seg_pvs *spvs) + uint32_t le, uint32_t len, uint32_t *max_seg_len, + int (*fn)(struct cmd_context *cmd, struct pv_segment *peg, void *data), + void *data) { struct lv_segment *seg; uint32_t s; @@ -1396,36 +1408,41 @@ if (remaining_seg_len > len) remaining_seg_len = len; - if (spvs->len > remaining_seg_len) - spvs->len = remaining_seg_len; + if (max_seg_len && *max_seg_len > remaining_seg_len) + *max_seg_len = remaining_seg_len; area_multiple = segtype_is_striped(seg->segtype) ? seg->area_count : 1; - area_len = remaining_seg_len / area_multiple; + area_len = remaining_seg_len / area_multiple ? : 1; - for (s = 0; s < seg->area_count; s++) { + for (s = 0; s < seg->area_count; s++) if (seg_type(seg, s) == AREA_LV) { if (!_for_each_pv(cmd, seg_lv(seg, s), seg_le(seg, s) + (le - seg->le) / area_multiple, - area_len, fn, spvs)) { - stack; - return 0; - } - } else if (seg_type(seg, s) == AREA_PV) { - if (!fn(cmd, seg_pvseg(seg, s), spvs)) { - stack; - return 0; - } - } - } + area_len, max_seg_len, fn, data)) + return_0; + } else if ((seg_type(seg, s) == AREA_PV) && + !fn(cmd, seg_pvseg(seg, s), data)) + return_0; + + if (seg_is_mirrored(seg) && + !_for_each_pv(cmd, seg->log_lv, 0, MIRROR_LOG_SIZE, + NULL, fn, data)) + return_0; + + /* FIXME Add snapshot cow LVs etc. */ return 1; } -static int _add_pvs(struct cmd_context *cmd, struct pv_segment *peg, struct seg_pvs *spvs) +static int _add_pvs(struct cmd_context *cmd, struct pv_segment *peg, void *data) { + struct seg_pvs *spvs = (struct seg_pvs *) data; struct pv_list *pvl; - /* FIXME Don't add again if it's already on the list! */ + /* Don't add again if it's already on list. */ + list_iterate_items(pvl, &spvs->pvs) + if (pvl->pv == peg->pv) + return 1; if (!(pvl = dm_pool_alloc(cmd->mem, sizeof(*pvl)))) { log_error("pv_list allocation failed"); @@ -1434,11 +1451,8 @@ pvl->pv = peg->pv; - /* FIXME Use ordered list to facilitate comparison */ list_add(&spvs->pvs, &pvl->list); - /* FIXME Add mirror logs, snapshot cow LVs etc. */ - return 1; } @@ -1474,7 +1488,7 @@ /* Find next segment end */ /* FIXME Unnecessary nesting! */ - if (!_for_each_pv(cmd, lv, current_le, lv->le_count - current_le, _add_pvs, spvs)) { + if (!_for_each_pv(cmd, lv, current_le, spvs->len, &spvs->len, _add_pvs, (void *) spvs)) { stack; return NULL; } --- LVM2/lib/metadata/metadata.h 2006/08/17 19:30:59 1.148 +++ LVM2/lib/metadata/metadata.h 2006/09/11 21:14:56 1.149 @@ -34,6 +34,7 @@ #define STRIPE_SIZE_LIMIT ((UINT_MAX >> 2) + 1) #define PV_MIN_SIZE ( 512L * 1024L >> SECTOR_SHIFT) /* 512 KB in sectors */ #define MAX_RESTRICTED_LVS 255 /* Used by FMT_RESTRICTED_LVIDS */ +#define MIRROR_LOG_SIZE 1 /* Extents */ /* Various flags */ /* Note that the bits no longer necessarily correspond to LVM1 disk format */
next reply other threads:[~2006-09-11 21:14 UTC|newest] Thread overview: 36+ messages / expand[flat|nested] mbox.gz Atom feed top 2006-09-11 21:14 agk [this message] -- strict thread matches above, loose matches on Subject: below -- 2012-02-23 17:36 jbrassow 2012-02-23 3:57 jbrassow 2012-02-15 15:18 zkabelac 2012-02-08 13:05 zkabelac 2012-02-01 2:10 agk 2011-10-22 16:42 zkabelac 2011-09-06 18:49 agk 2011-08-18 19:41 jbrassow 2011-08-11 3:29 jbrassow 2011-06-23 14:01 jbrassow 2011-04-09 19:05 zkabelac 2011-01-24 14:19 agk 2011-01-11 17:05 jbrassow 2010-10-14 20:03 jbrassow 2010-04-23 19:27 snitzer 2010-04-09 1:00 agk 2010-03-25 21:19 agk 2010-03-25 2:31 agk 2010-01-08 22:32 jbrassow 2009-05-13 21:29 mbroz 2009-05-13 21:28 mbroz 2009-04-21 14:32 mbroz 2009-04-07 10:20 mbroz 2008-03-28 19:08 wysochanski 2008-01-26 0:25 agk 2008-01-18 22:01 agk 2007-12-20 18:55 agk 2007-08-28 16:14 wysochanski 2007-08-03 21:22 wysochanski 2006-12-13 3:40 agk 2006-10-23 15:54 agk 2006-10-08 12:01 agk 2005-11-10 14:45 agk 2005-10-18 13:43 agk 2004-05-05 18:49 agk
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=20060911211456.16346.qmail@sourceware.org \ --to=agk@sourceware.org \ --cc=lvm2-cvs@sourceware.org \ /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: linkBe sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions for how to clone and mirror all data and code used for this inbox; as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).