In case of writing a partial block, the complete block is first read

into a buffer. The size of the S/G list for that buffer is now
temporarily set to the block size for the read request. This works
around the problem that the IDE bus manager would erroneously request
DMA for the complete buffer (32 KB), but issue a read request only for
one block, thus, after a few timeouts and bus resets, needing to resort
to PIO mode. Fixes bugs #985 and #1176.


git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@22975 a95241bf-73f2-0310-859d-f6bbb57e9c96
This commit is contained in:
Ingo Weinhold
2007-11-22 00:40:40 +00:00
parent 7579aad575
commit ff7cf84b89
+9
View File
@@ -383,9 +383,18 @@ retry:
cur_blocks = 1;
SHOW_FLOW0(3, "partial write at beginning: reading content of first block");
// temporarily restrict the buffer's S/G list size to how much
// we actually want to read
block_io_buffer_phys_vec.total_len = block_size;
block_io_buffer_phys_vec.vec[0].size = block_size;
res = device->interface->read(handle->cookie,
&block_io_buffer_phys_vec, block_pos,
cur_blocks, block_size, &bytes_transferred);
block_io_buffer_phys_vec.total_len = block_io_buffer_size;
block_io_buffer_phys_vec.vec[0].size = block_io_buffer_size;
} else {
// alignment problem or partial block read - find out how many
// blocks are spanned by this transfer