[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]

[lvm-devel] lvresize.c: use kilobytes when passing sizes to fsadm



Hi all,

The code in lvresize.c computes a new file system size to pass to fsadm when resizing as (extents * extent_size), giving a result in kilobytes.

This is then passed on to fsadm without a suffix, meaning that fsadm interprets it as a count of the number of file system blocks instead.

This breaks fsadm for all file system block sizes other than 1K.

The attached patch adds a "K" suffix and fixes the problem for me - see:

https://bugzilla.redhat.com/show_bug.cgi?id=480022

For testing details.

Regards,
Bryn.
--- LVM2.2.02.37/tools/lvresize.c.orig	2009-01-14 10:52:56.000000000 -0500
+++ LVM2.2.02.37/tools/lvresize.c	2009-01-14 10:53:11.000000000 -0500
@@ -144,7 +144,7 @@
 		return 0;
 	}
 
-	if (dm_snprintf(size_buf, SIZE_BUF, "%" PRIu64,
+	if (dm_snprintf(size_buf, SIZE_BUF, "%" PRIu64 "K",
 			(uint64_t) lp->extents * vg->extent_size / 2) < 0) {
 		log_error("Couldn't generate new LV size string");
 		return 0;
@@ -630,7 +630,7 @@
 				  lp->lv_name);
 			return ECMD_FAILED;
 		}
-		if (dm_snprintf(size_buf, SIZE_BUF, "%" PRIu64,
+		if (dm_snprintf(size_buf, SIZE_BUF, "%" PRIu64 "K",
 				(uint64_t) lp->extents * vg->extent_size / 2) < 0) {
 		    log_error("Couldn't generate new LV size string");
 		    return ECMD_FAILED;

[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]