Skip to content

Commit

Permalink
feat: Adding detection for when the capacity of a drive has changed, …
Browse files Browse the repository at this point in the history
…but the adapter does not know

After changing the capacity of a drive, the HBA/bridge/adapter may not know about the change.
So a new function was added so that the user can be prompted to reboot and make sure the adapter knows about the change. This is because in many cases with SATA drives the drive is behind a SATL to translate SCSI info to the host from the ATA drive. This information is often cached, so that cache may be out of date and can only be refreshed by a reboot of the system and thus the adapter.

Signed-off-by: Tyler Erickson <tyler.erickson@seagate.com>
  • Loading branch information
vonericsen committed Aug 2, 2023
1 parent a61f1c1 commit 1d862e0
Show file tree
Hide file tree
Showing 3 changed files with 40 additions and 4 deletions.
2 changes: 1 addition & 1 deletion subprojects/opensea-operations
31 changes: 30 additions & 1 deletion utils/C/openSeaChest/openSeaChest_Configure.c
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@
// Global Variables //
////////////////////////
const char *util_name = "openSeaChest_Configure";
const char *buildVersion = "2.4.2";
const char *buildVersion = "2.4.3";

////////////////////////////
// functions to declare //
Expand Down Expand Up @@ -1848,9 +1848,16 @@ int32_t main(int argc, char *argv[])
switch (dco_Restore(&deviceList[deviceIter]))
{
case SUCCESS:
fill_Drive_Info_Data(&deviceList[deviceIter]);
if (VERBOSITY_QUIET < toolVerbosity)
{
printf("Successfully restored factory settings using DCO.\n");
if (is_Max_LBA_In_Sync_With_Adapter_Or_Driver(&deviceList[deviceIter]))
{
printf("\nWARNING: The adapter/driver/bridge is not in sync with the capacity change!\n");
printf(" A reboot is strongly recommended to make sure the system works without\n");
printf(" errors with the drive at its new capacity.\n\n");
}
}
break;
case NOT_SUPPORTED:
Expand Down Expand Up @@ -2098,9 +2105,19 @@ int32_t main(int argc, char *argv[])
switch (dco_Set(&deviceList[deviceIter], &dco))
{
case SUCCESS:
if (ATA_DCO_SETMAXLBA)
{
fill_Drive_Info_Data(&deviceList[deviceIter]);
}
if (VERBOSITY_QUIET < toolVerbosity)
{
printf("Successfully configured available features/modes/maxLBA using DCO.\n");
if (!is_Max_LBA_In_Sync_With_Adapter_Or_Driver(&deviceList[deviceIter]))
{
printf("\nWARNING: The adapter/driver/bridge is not in sync with the capacity change!\n");
printf(" A reboot is strongly recommended to make sure the system works without\n");
printf(" errors with the drive at its new capacity.\n\n");
}
}
break;
case NOT_SUPPORTED:
Expand Down Expand Up @@ -3005,6 +3022,12 @@ int32_t main(int argc, char *argv[])
capacity_Unit_Convert(&capacity, &capUnit);
printf("Successfully set the max LBA to %" PRIu64 "\n", SET_MAX_LBA_VALUE);
printf("New Drive Capacity (%s/%s): %0.02f/%0.02f\n", mCapUnit, capUnit, mCapacity, capacity);
if (!is_Max_LBA_In_Sync_With_Adapter_Or_Driver(&deviceList[deviceIter]))
{
printf("\nWARNING: The adapter/driver/bridge is not in sync with the capacity change!\n");
printf(" A reboot is strongly recommended to make sure the system works without\n");
printf(" errors with the drive at its new capacity.\n\n");
}
}
break;
case NOT_SUPPORTED:
Expand Down Expand Up @@ -3051,6 +3074,12 @@ int32_t main(int argc, char *argv[])
capacity_Unit_Convert(&capacity, &capUnit);
printf("Successfully restored the max LBA\n");
printf("New Drive Capacity (%s/%s): %0.02f/%0.02f\n", mCapUnit, capUnit, mCapacity, capacity);
if (!is_Max_LBA_In_Sync_With_Adapter_Or_Driver(&deviceList[deviceIter]))
{
printf("\nWARNING: The adapter/driver/bridge is not in sync with the capacity change!\n");
printf(" A reboot is strongly recommended to make sure the system works without\n");
printf(" errors with the drive at its new capacity.\n\n");
}
}
break;
case NOT_SUPPORTED:
Expand Down
11 changes: 9 additions & 2 deletions utils/C/openSeaChest/openSeaChest_Erase.c
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,7 @@
// Global Variables //
////////////////////////
const char *util_name = "openSeaChest_Erase";
const char *buildVersion = "4.3.2";
const char *buildVersion = "4.3.3";

typedef enum _eSeaChestEraseExitCodes
{
Expand Down Expand Up @@ -1677,7 +1677,14 @@ int32_t main(int argc, char *argv[])
capacity_Unit_Convert(&capacity, &capUnit);
printf("Successfully restored maxLBA to highest possible user addressable LBA!\n");
printf("New Drive Capacity (%s/%s): %0.02f/%0.02f\n", mCapUnit, capUnit, mCapacity, capacity);
printf("Continuing to erase!\n");
if (!is_Max_LBA_In_Sync_With_Adapter_Or_Driver(&deviceList[deviceIter]))
{
printf("\nWARNING: The adapter/driver/bridge is not in sync with the capacity change!\n");
printf(" If using a drive managed erase, this will not be an issue since the\n");
printf(" drive firmware will handle this change properly.\n");
printf(" If performing a manual overwrite, such as --%s, then a power cycle\n", OVERWRITE_LONG_OPT_STRING);
printf(" is strongly recommended to make sure all writes complete without error.\n");
}
}
break;
case DEVICE_ACCESS_DENIED:
Expand Down

0 comments on commit 1d862e0

Please sign in to comment.