[haiku-commits] haiku: hrev53471 - in src/system/kernel: disk_device_manager fs

  • From: waddlesplash <waddlesplash@xxxxxxxxx>
  • To: haiku-commits@xxxxxxxxxxxxx
  • Date: Mon, 9 Sep 2019 20:52:20 -0400 (EDT)

hrev53471 adds 3 changesets to branch 'master'
old head: 4ee6978ed7cb22beae0d47c16839220d40a3f8c2
new head: a310e5e52ff93d15a16b96bf84e486379c6e5f68
overview: 
https://git.haiku-os.org/haiku/log/?qt=range&q=a310e5e52ff9+%5E4ee6978ed7cb

----------------------------------------------------------------------------

1bdffaf4271e: kernel/fs: Only dump devices and partitions under KDEBUG.
  
  Avoids a lot of noise in release kernel syslogs.

598b8e19a209: kernel/disk_device_manager: Continue scanning after invalid 
partitions.
  
  As the inline comment notes, just because we could not scan one
  partition does not mean we won't be able to scan the following ones.
  This fixes scanning for disks on certain systems following axeld's
  change in 7c2135591ba90958b5c8d92a2a5ef8a930c9ee28.
  
  Part of #15330.

a310e5e52ff9: kernel/fs: Continue even if InitialDeviceScan returns an error.
  
  See inline comment. Should fix #15330.

                              [ Augustin Cavalier <waddlesplash@xxxxxxxxx> ]

----------------------------------------------------------------------------

2 files changed, 25 insertions(+), 18 deletions(-)
.../disk_device_manager/KDiskDeviceManager.cpp   | 24 ++++++++++++--------
src/system/kernel/fs/vfs_boot.cpp                | 19 +++++++++-------

############################################################################

Commit:      1bdffaf4271e12edb892cbc11ff8c0f095125448
URL:         https://git.haiku-os.org/haiku/commit/?id=1bdffaf4271e
Author:      Augustin Cavalier <waddlesplash@xxxxxxxxx>
Date:        Tue Sep 10 00:46:45 2019 UTC

kernel/fs: Only dump devices and partitions under KDEBUG.

Avoids a lot of noise in release kernel syslogs.

----------------------------------------------------------------------------

diff --git a/src/system/kernel/fs/vfs_boot.cpp 
b/src/system/kernel/fs/vfs_boot.cpp
index 3e5a9d94e4..f84b7e1681 100644
--- a/src/system/kernel/fs/vfs_boot.cpp
+++ b/src/system/kernel/fs/vfs_boot.cpp
@@ -365,13 +365,14 @@ get_boot_partitions(KMessage& bootVolume, PartitionStack& 
partitions)
                return status;
        }
 
-       if (1 /* dump devices and partitions */) {
-               KDiskDevice *device;
-               int32 cookie = 0;
-               while ((device = manager->NextDevice(&cookie)) != NULL) {
-                       device->Dump(true, 0);
-               }
+#if KDEBUG
+       // dump devices and partitions
+       KDiskDevice *device;
+       int32 cookie = 0;
+       while ((device = manager->NextDevice(&cookie)) != NULL) {
+               device->Dump(true, 0);
        }
+#endif
 
        struct BootPartitionVisitor : KPartitionVisitor {
                BootPartitionVisitor(BootMethod* bootMethod, PartitionStack 
&stack)

############################################################################

Commit:      598b8e19a209a9a4374673a8b625a0819129ceb7
URL:         https://git.haiku-os.org/haiku/commit/?id=598b8e19a209
Author:      Augustin Cavalier <waddlesplash@xxxxxxxxx>
Date:        Tue Sep 10 00:50:54 2019 UTC

Ticket:      https://dev.haiku-os.org/ticket/15330

kernel/disk_device_manager: Continue scanning after invalid partitions.

As the inline comment notes, just because we could not scan one
partition does not mean we won't be able to scan the following ones.
This fixes scanning for disks on certain systems following axeld's
change in 7c2135591ba90958b5c8d92a2a5ef8a930c9ee28.

Part of #15330.

----------------------------------------------------------------------------

diff --git a/src/system/kernel/disk_device_manager/KDiskDeviceManager.cpp 
b/src/system/kernel/disk_device_manager/KDiskDeviceManager.cpp
index 56d48c1fbc..c960d59bc5 100644
--- a/src/system/kernel/disk_device_manager/KDiskDeviceManager.cpp
+++ b/src/system/kernel/disk_device_manager/KDiskDeviceManager.cpp
@@ -986,31 +986,33 @@ KDiskDeviceManager::LoadNextDiskSystem(int32* cookie)
 status_t
 KDiskDeviceManager::InitialDeviceScan()
 {
-       status_t error = B_ERROR;
-
        // scan for devices
        if (ManagerLocker locker = this) {
-               error = _Scan("/dev/disk");
+               status_t error = _Scan("/dev/disk");
                if (error != B_OK)
                        return error;
        }
 
        // scan the devices for partitions
        int32 cookie = 0;
+       status_t status = B_OK;
        while (KDiskDevice* device = RegisterNextDevice(&cookie)) {
                PartitionRegistrar _(device, true);
                if (DeviceWriteLocker deviceLocker = device) {
                        if (ManagerLocker locker = this) {
-                               error = _ScanPartition(device, false);
+                               status_t error = _ScanPartition(device, false);
                                device->UnmarkBusy(true);
                                if (error != B_OK)
-                                       break;
+                                       status = error;
+                               // Even if we could not scan this partition, we 
want to try
+                               // and scan the rest. Just because one 
partition is invalid
+                               // or unscannable does not mean the ones after 
it are.
                        } else
                                return B_ERROR;
                } else
                        return B_ERROR;
        }
-       return error;
+       return status;
 }
 
 
@@ -1091,21 +1093,23 @@ KDiskDeviceManager::RescanDiskSystems()
 
        // rescan existing devices with the new disk systems
        int32 cookie = 0;
+       status_t status = B_OK;
        while (KDiskDevice* device = RegisterNextDevice(&cookie)) {
                PartitionRegistrar _(device, true);
                if (DeviceWriteLocker deviceLocker = device) {
                        if (ManagerLocker locker = this) {
-                               status_t status = _ScanPartition(device, false, 
&addedSystems);
+                               status_t error = _ScanPartition(device, false, 
&addedSystems);
                                device->UnmarkBusy(true);
-                               if (status != B_OK)
-                                       break;
+                               if (error != B_OK)
+                                       status = error;
+                               // See comment in InitialDeviceScan().
                        } else
                                return B_ERROR;
                } else
                        return B_ERROR;
        }
 
-       return B_OK;
+       return status;
 }
 
 

############################################################################

Revision:    hrev53471
Commit:      a310e5e52ff93d15a16b96bf84e486379c6e5f68
URL:         https://git.haiku-os.org/haiku/commit/?id=a310e5e52ff9
Author:      Augustin Cavalier <waddlesplash@xxxxxxxxx>
Date:        Tue Sep 10 00:51:58 2019 UTC

Ticket:      https://dev.haiku-os.org/ticket/15330

kernel/fs: Continue even if InitialDeviceScan returns an error.

See inline comment. Should fix #15330.

----------------------------------------------------------------------------

diff --git a/src/system/kernel/fs/vfs_boot.cpp 
b/src/system/kernel/fs/vfs_boot.cpp
index f84b7e1681..db8c7f8fd7 100644
--- a/src/system/kernel/fs/vfs_boot.cpp
+++ b/src/system/kernel/fs/vfs_boot.cpp
@@ -360,9 +360,11 @@ get_boot_partitions(KMessage& bootVolume, PartitionStack& 
partitions)
 
        status = manager->InitialDeviceScan();
        if (status != B_OK) {
-               dprintf("KDiskDeviceManager::InitialDeviceScan() failed: %s\n",
+               dprintf("KDiskDeviceManager::InitialDeviceScan() returned 
error: %s\n",
                        strerror(status));
-               return status;
+               // InitialDeviceScan returns error if one (or more) partitions 
are
+               // determined to be invalid. The partition we are trying to 
boot from
+               // may be usuable anyway, so don't fail here.
        }
 
 #if KDEBUG


Other related posts: