[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[PATCH 09/15] ieee1275: ofdisk - don't continue to query block-size afte
From: |
Eric Snowberg |
Subject: |
[PATCH 09/15] ieee1275: ofdisk - don't continue to query block-size after we have it |
Date: |
Wed, 29 Jun 2016 14:43:22 -0700 |
Within commit: 87ec3b7fa9061f470616ed927fc140e995831c00 - "Don't continue
to query block-size if disk doesn't have it.” Disks that returned 0 to the
block-size query, still get queried every time.
OpenBoot PROM (OBP) does not have hotplug support until the OS is running.
Therefore, fix logic in grub_ofdisk_get_block_size so the block size is not
requested upon each open since it will not change.
Signed-off-by: Eric Snowberg <address@hidden>
---
grub-core/disk/ieee1275/ofdisk.c | 26 +++++++++++++-------------
1 files changed, 13 insertions(+), 13 deletions(-)
diff --git a/grub-core/disk/ieee1275/ofdisk.c b/grub-core/disk/ieee1275/ofdisk.c
index 956f675..6eaa044 100644
--- a/grub-core/disk/ieee1275/ofdisk.c
+++ b/grub-core/disk/ieee1275/ofdisk.c
@@ -35,7 +35,8 @@ struct ofdisk_hash_ent
char *grub_devpath;
int is_boot;
int is_removable;
- int block_size_fails;
+ int block_size_retries;
+ grub_uint32_t block_size;
/* Pointer to shortest available name on nodes representing canonical names,
otherwise NULL. */
const char *shortest;
@@ -703,10 +704,15 @@ grub_ofdisk_get_block_size (grub_uint32_t *block_size,
struct ofdisk_hash_ent *o
grub_ieee1275_cell_t size2;
} args_ieee1275;
+ if ((op->block_size_retries >= 2) || (op->block_size > 0))
+ {
+ *block_size = op->block_size;
+ return GRUB_ERR_NONE;
+ }
+
*block_size = 0;
- if (op->block_size_fails >= 2)
- return GRUB_ERR_NONE;
+ op->block_size_retries++;
INIT_IEEE1275_COMMON (&args_ieee1275.common, "call-method", 2, 2);
args_ieee1275.method = (grub_ieee1275_cell_t) "block-size";
@@ -714,21 +720,15 @@ grub_ofdisk_get_block_size (grub_uint32_t *block_size,
struct ofdisk_hash_ent *o
args_ieee1275.result = 1;
if (IEEE1275_CALL_ENTRY_FN (&args_ieee1275) == -1)
- {
- grub_dprintf ("disk", "can't get block size: failed call-method\n");
- op->block_size_fails++;
- }
+ grub_dprintf ("disk", "can't get block size: failed call-method\n");
else if (args_ieee1275.result)
- {
- grub_dprintf ("disk", "can't get block size: %lld\n",
- (long long) args_ieee1275.result);
- op->block_size_fails++;
- }
+ grub_dprintf ("disk", "can't get block size: %lld\n",
+ (long long) args_ieee1275.result);
else if (args_ieee1275.size1
&& !(args_ieee1275.size1 & (args_ieee1275.size1 - 1))
&& args_ieee1275.size1 >= 512 && args_ieee1275.size1 <= 16384)
{
- op->block_size_fails = 0;
+ op->block_size = args_ieee1275.size1;
*block_size = args_ieee1275.size1;
}
--
1.7.1
- [PATCH 00/15] Add missing SPARC support, Eric Snowberg, 2016/06/29
- [PATCH 01/15] sparc64: fix OF path names for sun4v systems, Eric Snowberg, 2016/06/29
- [PATCH 02/15] sparc64: Add blocklist GPT support for SPARC, Eric Snowberg, 2016/06/29
- [PATCH 03/15] grub-install: fix memory leak, Eric Snowberg, 2016/06/29
- [PATCH 04/15] sparc64: Use the correct disk name in core.img, Eric Snowberg, 2016/06/29
- [PATCH 05/15] ieee1275: fix segfault in grub-ofpathname, Eric Snowberg, 2016/06/29
- [PATCH 06/15] ieee1275: add nvme support within ofpath, Eric Snowberg, 2016/06/29
- [PATCH 07/15] ofdisk: memory corruption fix, Eric Snowberg, 2016/06/29
- [PATCH 09/15] ieee1275: ofdisk - don't continue to query block-size after we have it,
Eric Snowberg <=
- [PATCH 08/15] ofdisk: move open logic, Eric Snowberg, 2016/06/29
- [PATCH 11/15] sparc64: boot performance improvements, Eric Snowberg, 2016/06/29
- [PATCH 10/15] ofdisk: refactor open logic, Eric Snowberg, 2016/06/29
- [PATCH 12/15] ofdisk: only add aliases that exist, Eric Snowberg, 2016/06/29
- [PATCH 14/15] parser: Remove escape from the state transitions, Eric Snowberg, 2016/06/29
- [PATCH 13/15] sparc64: add disks that don't have a devalias to the device list, Eric Snowberg, 2016/06/29
- [PATCH 15/15] sparc64: ignore hypervisor reboot memory block device, Eric Snowberg, 2016/06/29