From: Karel Zak Date: Thu, 17 Sep 2015 10:04:23 +0000 (+0200) Subject: libfdisk: add more debug message to resize code X-Git-Tag: v2.28-rc1~343 X-Git-Url: http://git.ipfire.org/?a=commitdiff_plain;h=f2be8b3dfcf990872e1964f028a89d46bf16b230;p=thirdparty%2Futil-linux.git libfdisk: add more debug message to resize code Signed-off-by: Karel Zak --- diff --git a/libfdisk/src/partition.c b/libfdisk/src/partition.c index aeba7c402f..001fa356e6 100644 --- a/libfdisk/src/partition.c +++ b/libfdisk/src/partition.c @@ -1006,7 +1006,7 @@ static int recount_resize( struct fdisk_table *tb = NULL; int rc; - DBG(PART, ul_debugobj(tpl, "resize requested")); + DBG(PART, ul_debugobj(tpl, ">>> resize requested")); FDISK_INIT_UNDEF(start); FDISK_INIT_UNDEF(size); @@ -1033,9 +1033,14 @@ static int recount_resize( } else start += fdisk_partition_get_start(tpl); + DBG(PART, ul_debugobj(tpl, "resize: moving start %s relative, new start: %ju", + tpl->movestart == FDISK_MOVE_DOWN ? "DOWN" : "UP", start)); + /* 1b) set new start - absolute number */ - } else if (fdisk_partition_has_start(tpl)) + } else if (fdisk_partition_has_start(tpl)) { start = fdisk_partition_get_start(tpl); + DBG(PART, ul_debugobj(tpl, "resize: moving start to absolute offset: %ju", start)); + } /* 2) verify that start is within the current partition or any freespace area */ if (!FDISK_IS_UNDEF(start)) { @@ -1050,6 +1055,7 @@ static int recount_resize( goto erange; } else { /* no change, start points to the current partition */ + DBG(PART, ul_debugobj(tpl, "resize: start unchanged")); start = fdisk_partition_get_start(cur); } @@ -1088,9 +1094,12 @@ static int recount_resize( (uintmax_t) size, (uintmax_t) maxsz)); if (size > maxsz) goto erange; + } else { + DBG(PART, ul_debugobj(tpl, "resize: size unchanged (undefined)")); } - DBG(PART, ul_debugobj(tpl, "resize: SUCCESS: start %ju->%ju; size %ju->%ju", + + DBG(PART, ul_debugobj(tpl, "<<< resize: SUCCESS: start %ju->%ju; size %ju->%ju", (uintmax_t) fdisk_partition_get_start(cur), (uintmax_t) start, (uintmax_t) fdisk_partition_get_size(cur), (uintmax_t) size)); res->start = start; @@ -1098,7 +1107,7 @@ static int recount_resize( fdisk_unref_table(tb); return 0; erange: - DBG(PART, ul_debugobj(tpl, "resize: FAILED")); + DBG(PART, ul_debugobj(tpl, "<<< resize: FAILED")); fdisk_warnx(cxt, _("Failed to resize partition #%zu."), partno + 1); fdisk_unref_table(tb); return -ERANGE;