All of lore.kernel.org
 help / color / mirror / Atom feed
From: prajnoha@sourceware.org <prajnoha@sourceware.org>
To: lvm-devel@redhat.com
Subject: LVM2/lib/format_text format-text.c
Date: 21 Feb 2011 12:25:16 -0000	[thread overview]
Message-ID: <20110221122516.3057.qmail@sourceware.org> (raw)

CVSROOT:	/cvs/lvm2
Module name:	LVM2
Changes by:	prajnoha at sourceware.org	2011-02-21 12:25:16

Modified files:
	lib/format_text: format-text.c 

Log message:
	Remove unused _mda_setup fn. This functionality is covered by new pv_add_metadata_area fn.

Patches:
http://sourceware.org/cgi-bin/cvsweb.cgi/LVM2/lib/format_text/format-text.c.diff?cvsroot=lvm2&r1=1.162&r2=1.163

--- LVM2/lib/format_text/format-text.c	2011/02/21 12:24:17	1.162
+++ LVM2/lib/format_text/format-text.c	2011/02/21 12:25:16	1.163
@@ -1255,159 +1255,6 @@
 	return (_scan_file(fmt, vgname) & _scan_raw(fmt, vgname));
 }
 
-/* For orphan, creates new mdas according to policy.
-   Always have an mda between end-of-label and pe_align() boundary */
-static int _mda_setup(const struct format_type *fmt,
-		      uint64_t pe_start, uint64_t pe_end,
-		      int pvmetadatacopies, uint64_t pvmetadatasize,
-		      unsigned metadataignore, struct dm_list *mdas,
-		      struct physical_volume *pv,
-		      struct volume_group *vg __attribute__((unused)))
-{
-	uint64_t mda_adjustment, disk_size, alignment, alignment_offset;
-	uint64_t start1, mda_size1;	/* First area - start of disk */
-	uint64_t start2, mda_size2;	/* Second area - end of disk */
-	uint64_t wipe_size = 8 << SECTOR_SHIFT;
-	size_t pagesize = lvm_getpagesize();
-
-	if (!pvmetadatacopies)
-		return 1;
-
-	alignment = pv->pe_align << SECTOR_SHIFT;
-	alignment_offset = pv->pe_align_offset << SECTOR_SHIFT;
-	disk_size = pv->size << SECTOR_SHIFT;
-	pe_start <<= SECTOR_SHIFT;
-	pe_end <<= SECTOR_SHIFT;
-
-	if (pe_end > disk_size) {
-		log_error("Physical extents end beyond end of device %s!",
-			  pv_dev_name(pv));
-		return 0;
-	}
-
-	/* Requested metadatasize */
-	mda_size1 = pvmetadatasize << SECTOR_SHIFT;
-
-	/* Place mda straight after label area@start of disk */
-	start1 = LABEL_SCAN_SIZE;
-
-	/* Unless the space available is tiny, round to PAGE_SIZE boundary */
-	if ((!pe_start && !pe_end) ||
-	    ((pe_start > start1) && (pe_start - start1 >= MDA_SIZE_MIN))) {
-		mda_adjustment = start1 % pagesize;
-		if (mda_adjustment)
-			start1 += (pagesize - mda_adjustment);
-	}
-
-	/* Round up to pe_align boundary */
-	mda_adjustment = (mda_size1 + start1) % alignment;
-	if (mda_adjustment) {
-		mda_size1 += (alignment - mda_adjustment);
-		/* Revert if it's now too large */
-		if (start1 + mda_size1 > disk_size)
-			mda_size1 -= (alignment - mda_adjustment);
-	}
-
-	/* Add pe_align_offset if on pe_align boundary */
-	if (alignment_offset &&
-	    (((start1 + mda_size1) % alignment) == 0)) {
-		mda_size1 += alignment_offset;
-		/* Revert if it's now too large */
-		if (start1 + mda_size1 > disk_size)
-			mda_size1 -= alignment_offset;
-	}
-
-	/* Ensure it's not going to be bigger than the disk! */
-	if (start1 + mda_size1 > disk_size) {
-		log_warn("WARNING: metadata area fills disk leaving no "
-			 "space for data on %s.", pv_dev_name(pv));
-		/* Leave some free space for rounding */
-		/* Avoid empty data area as could cause tools problems */
-		mda_size1 = disk_size - start1 - alignment * 2;
-		if (start1 + mda_size1 > disk_size) {
-			log_error("Insufficient space for first mda on %s",
-				  pv_dev_name(pv));
-			return 0;
-		}
-		/* Round up to pe_align boundary */
-		mda_adjustment = (mda_size1 + start1) % alignment;
-		if (mda_adjustment)
-			mda_size1 += (alignment - mda_adjustment);
-		/* Only have 1 mda in this case */
-		pvmetadatacopies = 1;
-	}
-
-	/* If we already have PEs, avoid overlap */
-	if (pe_start || pe_end) {
-		if (pe_start <= start1)
-			mda_size1 = 0;
-		else if (start1 + mda_size1 > pe_start)
-			mda_size1 = pe_start - start1;
-	}
-
-	/* FIXME If creating new mdas, wipe them! */
-	if (mda_size1) {
-		if (!add_mda(fmt, fmt->cmd->mem, mdas, pv->dev, start1,
-			     mda_size1, metadataignore))
-			return 0;
-
-		if (!dev_set((struct device *) pv->dev, start1,
-			     (size_t) ((mda_size1 > wipe_size) ?
-				       wipe_size : mda_size1), 0)) {
-			log_error("Failed to wipe new metadata area");
-			return 0;
-		}
-
-		if (pvmetadatacopies == 1)
-			return 1;
-	} else
-		start1 = 0;
-
-	/* A second copy at end of disk */
-	mda_size2 = pvmetadatasize << SECTOR_SHIFT;
-
-	/* Ensure it's not going to be bigger than the disk! */
-	if (mda_size2 > disk_size)
-		mda_size2 = disk_size - start1 - mda_size1;
-
-	mda_adjustment = (disk_size - mda_size2) % alignment;
-	if (mda_adjustment)
-		mda_size2 += mda_adjustment;
-
-	start2 = disk_size - mda_size2;
-
-	/* If we already have PEs, avoid overlap */
-	if (pe_start || pe_end) {
-		if (start2 < pe_end) {
-			mda_size2 -= (pe_end - start2);
-			start2 = pe_end;
-		}
-	}
-
-	/* If we already have a first mda, avoid overlap */
-	if (mda_size1) {
-		if (start2 < start1 + mda_size1) {
-			mda_size2 -= (start1 + mda_size1 - start2);
-			start2 = start1 + mda_size1;
-		}
-		/* No room for any PEs here now! */
-	}
-
-	if (mda_size2) {
-		if (!add_mda(fmt, fmt->cmd->mem, mdas, pv->dev, start2,
-			     mda_size2, metadataignore)) return 0;
-		if (!dev_set(pv->dev, start2,
-			     (size_t) ((mda_size2 > wipe_size) ?
-				       wipe_size : mda_size2), 0)) {
-			log_error("Failed to wipe new metadata area");
-			return 0;
-		}
-	} else
-		return 0;
-
-	return 1;
-}
-
 /* Only for orphans */
 /* Set label_sector to -1 if rewriting existing label into same sector */
 /* If mdas is supplied it overwrites existing mdas e.g. used with pvcreate */



             reply	other threads:[~2011-02-21 12:25 UTC|newest]

Thread overview: 11+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2011-02-21 12:25 prajnoha [this message]
  -- strict thread matches above, loose matches on Subject: below --
2012-02-27  9:54 LVM2/lib/format_text format-text.c zkabelac
2011-03-02 10:23 prajnoha
2011-02-28 17:05 prajnoha
2011-02-25 13:50 prajnoha
2010-11-29 11:16 zkabelac
2010-08-26 12:22 mbroz
2010-06-29 13:29 wysochanski
2010-06-28 20:30 wysochanski
2009-07-31 14:23 snitzer
2009-07-30 17:41 snitzer

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=20110221122516.3057.qmail@sourceware.org \
    --to=prajnoha@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.