[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[PATCH] hostdisk: Fix linux disk cache workaround on multipath disks
From: |
Michael Chang |
Subject: |
[PATCH] hostdisk: Fix linux disk cache workaround on multipath disks |
Date: |
Wed, 25 Jul 2018 16:49:15 +0800 |
User-agent: |
NeoMutt/20170421 (1.8.2) |
In hostdisk.c::grub_util_fd_open_device, there's a workaround to linux disk
cache described below.
"Linux has a bug that the disk cache for a whole disk is not consistent with
the one for a partition of the disk."
The workaround will result in using the partition device for writing the image
of which the address offset is calculated to be within it's range, to avoid the
cache problem of the whole disk device.
This patch fixed the linux disk cache workaround not being effective for
multipath/dm device because its partition device cannot be correctly determined
by grub_hostdisk_linux_find_partition function.
---
grub-core/osdep/linux/hostdisk.c | 6 ++++++
1 file changed, 6 insertions(+)
diff --git a/grub-core/osdep/linux/hostdisk.c b/grub-core/osdep/linux/hostdisk.c
index 06179fca7..ed530bdc4 100644
--- a/grub-core/osdep/linux/hostdisk.c
+++ b/grub-core/osdep/linux/hostdisk.c
@@ -263,6 +263,12 @@ grub_hostdisk_linux_find_partition (char *dev,
grub_disk_addr_t sector)
p = real_dev + len;
format = "-part%d";
}
+ else if (strncmp (real_dev, "/dev/dm-",
+ sizeof ("/dev/dm-") - 1) == 0)
+ {
+ p = real_dev + len - 1;
+ format = "%d";
+ }
else if (real_dev[len - 1] >= '0' && real_dev[len - 1] <= '9')
{
p = real_dev + len;
--
2.13.6
[Prev in Thread] |
Current Thread |
[Next in Thread] |
- [PATCH] hostdisk: Fix linux disk cache workaround on multipath disks,
Michael Chang <=