summaryrefslogtreecommitdiff
path: root/source/a/util-linux/0002-fdisk-don-t-ignore-1MiB-granularity-on-512-byte-sect.patch
diff options
context:
space:
mode:
Diffstat (limited to 'source/a/util-linux/0002-fdisk-don-t-ignore-1MiB-granularity-on-512-byte-sect.patch')
-rw-r--r--source/a/util-linux/0002-fdisk-don-t-ignore-1MiB-granularity-on-512-byte-sect.patch31
1 files changed, 31 insertions, 0 deletions
diff --git a/source/a/util-linux/0002-fdisk-don-t-ignore-1MiB-granularity-on-512-byte-sect.patch b/source/a/util-linux/0002-fdisk-don-t-ignore-1MiB-granularity-on-512-byte-sect.patch
new file mode 100644
index 00000000..4d3622c3
--- /dev/null
+++ b/source/a/util-linux/0002-fdisk-don-t-ignore-1MiB-granularity-on-512-byte-sect.patch
@@ -0,0 +1,31 @@
+--- ./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);
+ }