public inbox for lvm2-cvs@sourceware.org
help / color / mirror / Atom feed
From: agk@sourceware.org
To: lvm-devel@redhat.com, lvm2-cvs@sourceware.org
Subject: LVM2 ./WHATS_NEW lib/metadata/lv_manip.c lib/m ...
Date: Mon, 23 Oct 2006 15:54:00 -0000	[thread overview]
Message-ID: <20061023155452.20354.qmail@sourceware.org> (raw)

CVSROOT:	/cvs/lvm2
Module name:	LVM2
Changes by:	agk@sourceware.org	2006-10-23 15:54:51

Modified files:
	.              : WHATS_NEW 
	lib/metadata   : lv_manip.c pv_map.c pv_map.h 

Log message:
	Perform high-level free space check before each allocation attempt.

Patches:
http://sourceware.org/cgi-bin/cvsweb.cgi/LVM2/WHATS_NEW.diff?cvsroot=lvm2&r1=1.477&r2=1.478
http://sourceware.org/cgi-bin/cvsweb.cgi/LVM2/lib/metadata/lv_manip.c.diff?cvsroot=lvm2&r1=1.110&r2=1.111
http://sourceware.org/cgi-bin/cvsweb.cgi/LVM2/lib/metadata/pv_map.c.diff?cvsroot=lvm2&r1=1.26&r2=1.27
http://sourceware.org/cgi-bin/cvsweb.cgi/LVM2/lib/metadata/pv_map.h.diff?cvsroot=lvm2&r1=1.7&r2=1.8

--- LVM2/WHATS_NEW	2006/10/23 11:46:15	1.477
+++ LVM2/WHATS_NEW	2006/10/23 15:54:51	1.478
@@ -1,5 +1,6 @@
 Version 2.02.13 -
 ===================================
+  Perform high-level free space check before each allocation attempt.
   Don't allow a node to remove an LV that's exclusively active on anther node.
   Cope if same PV is included more than once in cmdline PE range list.
   Set PV size to current device size if it is found to be zero.
--- LVM2/lib/metadata/lv_manip.c	2006/10/08 12:01:12	1.110
+++ LVM2/lib/metadata/lv_manip.c	2006/10/23 15:54:51	1.111
@@ -890,8 +890,17 @@
 	uint32_t next_le;
 	struct seg_pvs *spvs;
 	struct list *parallel_pvs;
+	uint32_t free_pes;
+
+	/* Is there enough total space? */
+	free_pes = pv_maps_size(pvms);
+	if (needed > free_pes) {
+		log_error("Insufficient free space: %" PRIu32 " extents needed,"
+			  " but only %" PRIu32 " available", needed,
+			  free_pes);
+		return 0;
+	}
 
-	/* FIXME Do calculations on free extent counts before selecting space */
 	/* FIXME Select log PV appropriately if there isn't one yet */
 
 	/* Are there any preceding segments we must follow on from? */
--- LVM2/lib/metadata/pv_map.c	2006/10/21 23:18:43	1.26
+++ LVM2/lib/metadata/pv_map.c	2006/10/23 15:54:51	1.27
@@ -32,6 +32,7 @@
 	}
 
 	list_add(&pva->list, &a->list);
+	a->map->pe_count += a->count;
 }
 
 static int _create_single_area(struct dm_pool *mem, struct pv_map *pvm,
@@ -191,6 +192,7 @@
 void consume_pv_area(struct pv_area *pva, uint32_t to_go)
 {
 	list_del(&pva->list);
+	pva->map->pe_count -= pva->count;
 
 	assert(to_go <= pva->count);
 
@@ -201,3 +203,14 @@
 		_insert_area(&pva->map->areas, pva);
 	}
 }
+
+uint32_t pv_maps_size(struct list *pvms)
+{
+	struct pv_map *pvm;
+	uint32_t pe_count = 0;
+
+	list_iterate_items(pvm, pvms)
+		pe_count += pvm->pe_count;
+
+	return pe_count;
+}
--- LVM2/lib/metadata/pv_map.h	2005/10/16 23:03:58	1.7
+++ LVM2/lib/metadata/pv_map.h	2006/10/23 15:54:51	1.8
@@ -37,6 +37,7 @@
 struct pv_map {
 	struct physical_volume *pv;
 	struct list areas;		/* struct pv_areas */
+	uint32_t pe_count;		/* Total number of PEs */
 
 	struct list list;
 };
@@ -49,4 +50,6 @@
 
 void consume_pv_area(struct pv_area *area, uint32_t to_go);
 
+uint32_t pv_maps_size(struct list *pvms);
+
 #endif


             reply	other threads:[~2006-10-23 15:54 UTC|newest]

Thread overview: 36+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2006-10-23 15:54 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-08 12:01 agk
2006-09-11 21:14 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=20061023155452.20354.qmail@sourceware.org \
    --to=agk@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).