summaryrefslogtreecommitdiffstats
path: root/cpukit/libblock
diff options
context:
space:
mode:
authorSebastian Huber <sebastian.huber@embedded-brains.de>2012-07-02 15:08:08 +0200
committerSebastian Huber <sebastian.huber@embedded-brains.de>2012-07-02 16:15:54 +0200
commitf12249ff059074b265ed80eb3ea097d0afa576b7 (patch)
tree843e87ce31704f71b4de5eb6d0543cec8fefc4a4 /cpukit/libblock
parentlibblock: Remove unused field (diff)
downloadrtems-f12249ff059074b265ed80eb3ea097d0afa576b7.tar.bz2
libblock: Fix continuous blocks write request
Diffstat (limited to 'cpukit/libblock')
-rw-r--r--cpukit/libblock/src/bdbuf.c19
1 files changed, 6 insertions, 13 deletions
diff --git a/cpukit/libblock/src/bdbuf.c b/cpukit/libblock/src/bdbuf.c
index 0b84260bf0..034e5a8406 100644
--- a/cpukit/libblock/src/bdbuf.c
+++ b/cpukit/libblock/src/bdbuf.c
@@ -2296,15 +2296,10 @@ rtems_bdbuf_swapout_write (rtems_bdbuf_swapout_transfer* transfer)
*/
uint32_t last_block = 0;
- /*
- * Number of buffers per bd. This is used to detect the next
- * block.
- */
- uint32_t bufs_per_bd = 0;
-
rtems_disk_device *dd = transfer->dd;
-
- bufs_per_bd = dd->block_size / bdbuf_config.buffer_min;
+ uint32_t media_blocks_per_block = dd->media_blocks_per_block;
+ bool need_continuous_blocks =
+ (dd->phys_dev->capabilities & RTEMS_BLKDEV_CAP_MULTISECTOR_CONT) != 0;
/*
* Take as many buffers as configured and pass to the driver. Note, the
@@ -2333,12 +2328,10 @@ rtems_bdbuf_swapout_write (rtems_bdbuf_swapout_transfer* transfer)
if (rtems_bdbuf_tracer)
printf ("bdbuf:swapout write: bd:%" PRIu32 ", bufnum:%" PRIu32 " mode:%s\n",
bd->block, transfer->write_req->bufnum,
- dd->phys_dev->capabilities &
- RTEMS_BLKDEV_CAP_MULTISECTOR_CONT ? "MULIT" : "SCAT");
+ need_continuous_blocks ? "MULTI" : "SCAT");
- if ((dd->phys_dev->capabilities & RTEMS_BLKDEV_CAP_MULTISECTOR_CONT) &&
- transfer->write_req->bufnum &&
- (bd->block != (last_block + bufs_per_bd)))
+ if (need_continuous_blocks && transfer->write_req->bufnum &&
+ bd->block != last_block + media_blocks_per_block)
{
rtems_chain_prepend_unprotected (&transfer->bds, &bd->link);
write = true;