[lvm-devel] master - format_text: Use absolute alignment to calculate metadata usage

Alasdair Kergon agk at sourceware.org
Mon Dec 11 21:00:34 UTC 2017


Gitweb:        https://sourceware.org/git/?p=lvm2.git;a=commitdiff;h=053d35de473aafe641f595b1182626ea39fc0ab0
Commit:        053d35de473aafe641f595b1182626ea39fc0ab0
Parent:        2db67a8ea09a6f1073583e135bfb7b66228d3526
Author:        Alasdair G Kergon <agk at redhat.com>
AuthorDate:    Mon Dec 11 17:14:38 2017 +0000
Committer:     Alasdair G Kergon <agk at redhat.com>
CommitterDate: Mon Dec 11 17:14:38 2017 +0000

format_text: Use absolute alignment to calculate metadata usage

Currently both start and offset should always be divisible by alignment,
so this should have no effect, but a later patch will increase alignment
so these variables can no longer be optimised out.
---
 lib/format_text/format-text.c |    2 +-
 1 files changed, 1 insertions(+), 1 deletions(-)

diff --git a/lib/format_text/format-text.c b/lib/format_text/format-text.c
index 881fd4d..c226131 100644
--- a/lib/format_text/format-text.c
+++ b/lib/format_text/format-text.c
@@ -1292,7 +1292,7 @@ int vgname_from_mda(const struct format_type *fmt,
 			   (char *)&vgsummary->vgid);
 
 	if (mda_free_sectors) {
-		current_usage = ALIGN_ABSOLUTE(rlocn->size, 0, MDA_ORIGINAL_ALIGNMENT);
+		current_usage = ALIGN_ABSOLUTE(rlocn->size, dev_area->start + rlocn->offset, MDA_ORIGINAL_ALIGNMENT);
 
 		buffer_size = mdah->size - MDA_HEADER_SIZE;
 




More information about the lvm-devel mailing list