1
0
Fork 0
mirror of git://slackware.nl/current.git synced 2025-02-11 08:48:30 +01:00
slackware-current/source/a/util-linux/0002-fdisk-don-t-ignore-1MiB-granularity-on-512-byte-sect.patch

32 lines
984 B
Diff
Raw Normal View History

--- ./fdisk/fdisk.c.orig 2012-05-25 04:44:58.977195366 -0500
+++ ./fdisk/fdisk.c 2012-08-02 12:00:59.692457377 -0500
@@ -569,6 +569,19 @@
lba_is_aligned(unsigned long long lba)
{
unsigned int granularity = max(phy_sector_size, min_io_size);
+ unsigned long long offset;
+
+ if (grain > granularity)
+ granularity = grain;
+ offset = (lba * sector_size) & (granularity - 1);
+
+ return !((granularity + alignment_offset - offset) & (granularity - 1));
+}
+
+static int
+lba_is_phy_aligned(unsigned long long lba)
+{
+ unsigned int granularity = max(phy_sector_size, min_io_size);
unsigned long long offset = (lba * sector_size) & (granularity - 1);
return !((granularity + alignment_offset - offset) & (granularity - 1));
@@ -1808,7 +1821,7 @@
static void
check_alignment(unsigned long long lba, int partition)
{
- if (!lba_is_aligned(lba))
+ if (!lba_is_phy_aligned(lba))
printf(_("Partition %i does not start on physical sector boundary.\n"),
partition + 1);
}