Optionally use the IOCache instead of the IOScheduler (specified by

USE_IO_CACHE macro in the header). Currently disabled, though. It works fine,
if the machine has a good deal of RAM. I tested with the anyboot CD -- the
boot and installation times drop dramatically. On machines with little RAM
there are issues, though. Apparently the cache isn't drained fast enough, so
that other allocations can fail.


git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@36438 a95241bf-73f2-0310-859d-f6bbb57e9c96
This commit is contained in:
Ingo Weinhold
2010-04-23 18:14:53 +00:00
parent d177903646
commit 574e5742ad
2 changed files with 19 additions and 0 deletions
@@ -884,7 +884,13 @@ cd_set_capacity(cd_driver_info* info, uint64 capacity, uint32 blockSize)
if (status != B_OK)
panic("initializing DMAResource failed: %s", strerror(status));
#if USE_IO_CACHE
info->io_scheduler = new(std::nothrow) IOCache(info->dma_resource,
1024 * 1024);
#else
info->io_scheduler = new(std::nothrow) IOScheduler(info->dma_resource);
#endif
if (info->io_scheduler == NULL)
panic("allocating IOScheduler failed.");
@@ -896,6 +902,11 @@ cd_set_capacity(cd_driver_info* info, uint64 capacity, uint32 blockSize)
info->io_scheduler->SetCallback(do_io, info);
}
#if USE_IO_CACHE
if (info->io_scheduler != NULL)
info->io_scheduler->SetDeviceCapacity(capacity * blockSize);
#endif
info->block_size = blockSize;
}
@@ -12,6 +12,7 @@
#include <scsi.h>
#include "dma_resources.h"
#include "IOCache.h"
#include "IORequest.h"
#include "IOScheduler.h"
@@ -19,13 +20,20 @@
#define SCSI_CD_DRIVER_MODULE_NAME "drivers/disk/scsi/scsi_cd/driver_v1"
#define SCSI_CD_DEVICE_MODULE_NAME "drivers/disk/scsi/scsi_cd/device_v1"
// enables using the IOCache instead of the IOScheduler
#define USE_IO_CACHE 0
struct cd_driver_info {
device_node* node;
::scsi_periph_device scsi_periph_device;
::scsi_device scsi_device;
scsi_device_interface* scsi;
#if USE_IO_CACHE
IOCache* io_scheduler;
#else
IOScheduler* io_scheduler;
#endif
DMAResource* dma_resource;
uint64 capacity;