From faf27705fe74dc5bbe419efcf109a808b8d1d164 Mon Sep 17 00:00:00 2001 From: Karel Zak Date: Mon, 15 Feb 2010 14:06:56 +0100 Subject: [PATCH] fdisk: fix ALIGN_UP Signed-off-by: Karel Zak --- fdisk/fdisk.c | 3 +++ 1 file changed, 3 insertions(+) diff --git a/fdisk/fdisk.c b/fdisk/fdisk.c index 655bf0c6..55caa0c2 100644 --- a/fdisk/fdisk.c +++ b/fdisk/fdisk.c @@ -689,6 +689,9 @@ align_lba(unsigned long long lba, int direction) /* fprintf(stderr, "LBA: %llu apply alignment_offset\n", res); */ res -= (max(phy_sector_size, min_io_size) - alignment_offset) / sector_size; + + if (direction == ALIGN_UP && res < lba) + res += sects_in_phy; } } -- 2.39.5