public inbox for lvm2-cvs@sourceware.org
help / color / mirror / Atom feed
From: mbroz@sourceware.org
To: lvm-devel@redhat.com, lvm2-cvs@sourceware.org
Subject: LVM2 ./WHATS_NEW lib/activate/activate.c lib/a ...
Date: Mon, 01 Jun 2009 12:43:00 -0000	[thread overview]
Message-ID: <20090601124333.11757.qmail@sourceware.org> (raw)

CVSROOT:	/cvs/lvm2
Module name:	LVM2
Changes by:	mbroz@sourceware.org	2009-06-01 12:43:32

Modified files:
	.              : WHATS_NEW 
	lib/activate   : activate.c dev_manager.c 
	lib/metadata   : metadata.c metadata.h 

Log message:
	Fix readahead calculation problems.
	
	During vgreduce is failed mirror image replaced with error segment,
	this segmant type has always area_count == 0.
	Current code expects that there is at least one area with device,
	patch fixes it by additional check (fixes segfault during vgreduce).
	
	Also do not calculate readahead in every lv_info call, we only need
	to cache PV readahead before activation calls which locks memory.

Patches:
http://sourceware.org/cgi-bin/cvsweb.cgi/LVM2/WHATS_NEW.diff?cvsroot=lvm2&r1=1.1135&r2=1.1136
http://sourceware.org/cgi-bin/cvsweb.cgi/LVM2/lib/activate/activate.c.diff?cvsroot=lvm2&r1=1.152&r2=1.153
http://sourceware.org/cgi-bin/cvsweb.cgi/LVM2/lib/activate/dev_manager.c.diff?cvsroot=lvm2&r1=1.151&r2=1.152
http://sourceware.org/cgi-bin/cvsweb.cgi/LVM2/lib/metadata/metadata.c.diff?cvsroot=lvm2&r1=1.223&r2=1.224
http://sourceware.org/cgi-bin/cvsweb.cgi/LVM2/lib/metadata/metadata.h.diff?cvsroot=lvm2&r1=1.195&r2=1.196

--- LVM2/WHATS_NEW	2009/05/30 01:54:29	1.1135
+++ LVM2/WHATS_NEW	2009/06/01 12:43:31	1.1136
@@ -1,5 +1,7 @@
 Version 2.02.48 - 
 ===============================
+  Cache underlying device readahead only before activation calls.
+  Fix segfault when calculating readahead on missing device in vgreduce.
   Remove verbose 'visited' messages.
   Handle multi-extent mirror log allocation when smallest PV has only 1 extent.
   Add LSB standard headers and functions (incl. reload) to clvmd initscript.
--- LVM2/lib/activate/activate.c	2009/05/21 03:04:52	1.152
+++ LVM2/lib/activate/activate.c	2009/06/01 12:43:32	1.153
@@ -469,11 +469,6 @@
 	info->live_table = dminfo.live_table;
 	info->inactive_table = dminfo.inactive_table;
 
-	/*
-	 * Cache read ahead value for PV devices now (before possible suspend)
-	 */
-	(void)lv_calculate_readhead(lv);
-
 	if (name)
 		dm_pool_free(cmd->mem, name);
 
@@ -879,6 +874,8 @@
 		goto out;
 	}
 
+	lv_calculate_readahead(lv, NULL);
+
 	/* If VG was precommitted, preload devices for the LV */
 	if ((lv_pre->vg->status & PRECOMMITTED)) {
 		if (!_lv_preload(lv_pre, &flush_required)) {
@@ -1010,6 +1007,8 @@
 		goto out;
 	}
 
+	lv_calculate_readahead(lv, NULL);
+
 	if (!monitor_dev_for_events(cmd, lv, 0))
 		stack;
 
@@ -1093,6 +1092,8 @@
 		goto out;
 	}
 
+	lv_calculate_readahead(lv, NULL);
+
 	if (exclusive)
 		lv->status |= ACTIVATE_EXCL;
 
--- LVM2/lib/activate/dev_manager.c	2009/05/28 01:11:30	1.151
+++ LVM2/lib/activate/dev_manager.c	2009/06/01 12:43:32	1.152
@@ -1023,7 +1023,7 @@
 		/* we need RA at least twice a whole stripe - see the comment in md/raid0.c */
 		read_ahead = max_stripe_size * 2;
 		if (!read_ahead)
-			read_ahead = lv_calculate_readhead(lv);
+			lv_calculate_readahead(lv, &read_ahead);
 		read_ahead_flags = DM_READ_AHEAD_MINIMUM_FLAG;
 	}
 
--- LVM2/lib/metadata/metadata.c	2009/05/30 01:54:29	1.223
+++ LVM2/lib/metadata/metadata.c	2009/06/01 12:43:32	1.224
@@ -1422,7 +1422,7 @@
 	struct lv_segment *seg = first_seg(lv);
 	uint32_t seg_read_ahead = 0, *read_ahead = data;
 
-	if (seg && seg_type(seg, 0) == AREA_PV)
+	if (seg && seg->area_count && seg_type(seg, 0) == AREA_PV)
 		dev_get_read_ahead(seg_pv(seg, 0)->dev, &seg_read_ahead);
 
 	if (seg_read_ahead > *read_ahead)
@@ -1431,15 +1431,22 @@
 	return 1;
 }
 
-uint32_t lv_calculate_readhead(const struct logical_volume *lv)
+/*
+ * Calculate readahead for logical volume from underlying PV devices.
+ * If read_ahead is NULL, only ensure that readahead of PVs are preloaded
+ * into PV struct device in dev cache.
+ */
+void lv_calculate_readahead(const struct logical_volume *lv, uint32_t *read_ahead)
 {
-	uint32_t read_ahead = 0;
+	uint32_t _read_ahead = 0;
 
 	if (lv->read_ahead == DM_READ_AHEAD_AUTO)
-		_lv_postorder((struct logical_volume *)lv, _lv_read_ahead_single, &read_ahead);
+		_lv_postorder((struct logical_volume *)lv, _lv_read_ahead_single, &_read_ahead);
 
-	log_debug("Calculated readahead of LV %s is %u", lv->name, read_ahead);
-	return read_ahead;
+	if (read_ahead) {
+		log_debug("Calculated readahead of LV %s is %u", lv->name, _read_ahead);
+		*read_ahead = _read_ahead;
+	}
 }
 
 int vg_validate(struct volume_group *vg)
--- LVM2/lib/metadata/metadata.h	2009/05/20 11:09:49	1.195
+++ LVM2/lib/metadata/metadata.h	2009/06/01 12:43:32	1.196
@@ -347,7 +347,7 @@
 /*
  * Calculate readahead from underlying PV devices
  */
-uint32_t lv_calculate_readhead(const struct logical_volume *lv);
+void lv_calculate_readahead(const struct logical_volume *lv, uint32_t *read_ahead);
 
 /*
  * For internal metadata caching.


             reply	other threads:[~2009-06-01 12:43 UTC|newest]

Thread overview: 36+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2009-06-01 12:43 mbroz [this message]
  -- strict thread matches above, loose matches on Subject: below --
2012-03-23  9:58 zkabelac
2012-02-23 22:42 zkabelac
2012-01-25 13:10 zkabelac
2012-01-25  8:48 zkabelac
2011-11-18 19:31 zkabelac
2011-10-06 14:55 jbrassow
2011-10-03 18:37 zkabelac
2011-09-22 17:33 prajnoha
2011-06-30 18:25 agk
2011-06-22 21:31 jbrassow
2011-06-17 14:22 zkabelac
2011-06-17 14:14 zkabelac
2011-02-04 19:14 zkabelac
2011-02-03  1:24 zkabelac
2010-08-17  1:16 agk
2010-02-24 20:01 mbroz
2010-02-24 20:00 mbroz
2009-10-01  0:35 agk
2009-05-20 11:09 mbroz
2009-05-20  9:52 mbroz
2009-02-28  0:54 agk
2008-12-19 14:22 prajnoha
2008-04-07 10:23 mbroz
2008-01-30 14:00 agk
2007-11-12 20:51 agk
2007-07-02 11:17 wysochanski
2007-03-08 21:08 agk
2006-10-03 17:55 agk
2006-08-21 12:55 agk
2006-08-08 21:20 agk
2005-12-19 21:01 agk
2005-10-25 19:08 agk
2005-10-19 13:59 agk
2005-06-01 16:51 agk
2005-01-12 22:58 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=20090601124333.11757.qmail@sourceware.org \
    --to=mbroz@sourceware.org \
    --cc=lvm-devel@redhat.com \
    --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: link
Be 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).