Changeset 8aa608df in rtems


Ignore:
Timestamp:
05/18/10 02:14:05 (14 years ago)
Author:
Chris Johns <chrisj@…>
Branches:
4.10, 4.11, 5, master
Children:
9020491
Parents:
baf64cdb
Message:

2010-05-18 Chris Johns <chrisj@…>

  • libblock/src/diskdevs.c, libblock/include/rtems/blkdev.h, libblock/src/bdbuf.c: PR 1448/filesystem.
  • libblock/include/rtems/blkdev.h, libblock/src/bdbuf.c: PR 1514/filesystem.
Location:
cpukit
Files:
4 edited

Legend:

Unmodified
Added
Removed
  • cpukit/ChangeLog

    rbaf64cdb r8aa608df  
     12010-05-18      Chris Johns <chrisj@rtems.org>
     2
     3        * libblock/src/diskdevs.c, libblock/include/rtems/blkdev.h,
     4        libblock/src/bdbuf.c: PR 1448/filesystem.
     5
     6        * libblock/include/rtems/blkdev.h, libblock/src/bdbuf.c: PR
     7        1514/filesystem.
     8       
    192010-05-17      Oleg Kravtsov <Oleg.Kravtsov@oktetlabs.ru>
    210
  • cpukit/libblock/include/rtems/blkdev.h

    rbaf64cdb r8aa608df  
    4343/**
    4444 * Block device request type.
     45 *
     46 * @warning The sync request is an IO one and only used from the cache. Use the
     47 *          Block IO when operating at the device level. We need a sync request
     48 *          to avoid requests looping for ever.
    4549 */
    4650typedef enum rtems_blkdev_request_op {
    4751  RTEMS_BLKDEV_REQ_READ,       /**< Read the requested blocks of data. */
    4852  RTEMS_BLKDEV_REQ_WRITE,      /**< Write the requested blocks of data. */
    49   RTEMS_BLKDEV_CAPABILITIES    /**< Return the driver capabilities set. */
     53  RTEMS_BLKDEV_REQ_SYNC        /**< Sync any data with the media. */
    5054} rtems_blkdev_request_op;
    51 
    52 /**
    53  * Only consecutive multi-sector buffer requests are supported.
    54  *
    55  * This option means the cache will only supply multiple buffers that are
    56  * inorder so the ATA multi-sector command for example can be used. This is a
    57  * hack to work around the current ATA driver.
    58  */
    59 #define RTEMS_BLKDEV_CAP_MULTISECTOR_CONT (1 << 0)
    6055
    6156/**
     
    148143 * The start block in a request.
    149144 *
    150  * Only valid if the driver has returned the @ref RTEMS_BLKDEV_CAPABILITIES of
     145 * Only valid if the driver has returned the @ref RTEMS_BLKIO_CAPABILITIES of
    151146 * @ref RTEMS_BLKDEV_CAP_MULTISECTOR_CONT.
    152147 */
     
    166161#define RTEMS_BLKIO_SYNCDEV         _IO('B', 6)
    167162#define RTEMS_BLKIO_DELETED         _IO('B', 7)
     163#define RTEMS_BLKIO_CAPABILITIES    _IO('B', 8)
    168164
    169165/** @} */
     166
     167/**
     168 * Only consecutive multi-sector buffer requests are supported.
     169 *
     170 * This option means the cache will only supply multiple buffers that are
     171 * inorder so the ATA multi-sector command for example can be used. This is a
     172 * hack to work around the current ATA driver.
     173 */
     174#define RTEMS_BLKDEV_CAP_MULTISECTOR_CONT (1 << 0)
     175
     176/**
     177 * The driver will accept a sync call. A sync call is made to a driver
     178 * after a bdbuf cache sync has finished.
     179 */
     180#define RTEMS_BLKDEV_CAP_SYNC (1 << 1)
    170181
    171182/**
  • cpukit/libblock/src/bdbuf.c

    rbaf64cdb r8aa608df  
    6161  rtems_chain_control   bds;         /**< The transfer list of BDs. */
    6262  dev_t                 dev;         /**< The device the transfer is for. */
     63  bool                  syncing;     /**< The data is a sync'ing. */
    6364  rtems_blkdev_request* write_req;   /**< The write request array. */
    6465  uint32_t              bufs_per_bd; /**< Number of buffers per bd. */
     
    7576  rtems_id                     id;       /**< The id of the task so we can wake
    7677                                          * it. */
    77   volatile bool                enabled;  /**< The worked is enabled. */
     78  volatile bool                enabled;  /**< The worker is enabled. */
    7879  rtems_bdbuf_swapout_transfer transfer; /**< The transfer data for this
    7980                                          * thread. */
     
    13201321  {
    13211322    rtems_bdbuf_restore_preemption (prev_mode);
    1322 
    13231323    return RTEMS_RESOURCE_IN_USE;
    13241324  }
     1325
    13251326  memset(&bdbuf_cache, 0, sizeof(bdbuf_cache));
    13261327  bdbuf_cache.initialised = true;
     
    20432044
    20442045  req = bdbuf_alloc (sizeof (rtems_blkdev_request) +
    2045                      sizeof ( rtems_blkdev_sg_buffer) *
     2046                     sizeof (rtems_blkdev_sg_buffer) *
    20462047                      (bdbuf_config.max_read_ahead_blocks + 1));
    20472048
     
    22612262 * Swapout transfer to the driver. The driver will break this I/O into groups
    22622263 * of consecutive write requests is multiple consecutive buffers are required
    2263  * by the driver.
     2264 * by the driver. The cache is not locked.
    22642265 *
    22652266 * @param transfer The transfer transaction.
     
    23742375
    23752376    if (dd != &null_disk)
     2377    {
     2378      /*
     2379       * If sync'ing and the deivce is capability of handling a sync IO control
     2380       * call perform the call.
     2381       */
     2382      if (transfer->syncing &&
     2383          (dd->phys_dev->capabilities & RTEMS_BLKDEV_CAP_SYNC))
     2384      {
     2385        /* int result = */ dd->ioctl (dd->phys_dev, RTEMS_BLKDEV_REQ_SYNC, NULL);
     2386        /* How should the error be handled ? */
     2387      }
     2388     
    23762389      rtems_disk_release (dd);
     2390    }
    23772391  }
    23782392}
     
    24022416  {
    24032417    rtems_chain_node* node = rtems_chain_head (chain);
     2418    bool              sync_all;
     2419   
    24042420    node = node->next;
    24052421
     2422    /*
     2423     * A sync active with no valid dev means sync all.
     2424     */
     2425    if (sync_active && (*dev == BDBUF_INVALID_DEV))
     2426      sync_all = true;
     2427    else
     2428      sync_all = false;
     2429   
    24062430    while (!rtems_chain_is_tail (chain, node))
    24072431    {
     
    24102434      /*
    24112435       * Check if the buffer's hold timer has reached 0. If a sync is active
    2412        * or someone waits for a buffer force all the timers to 0.
     2436       * or someone waits for a buffer written force all the timers to 0.
    24132437       *
    24142438       * @note Lots of sync requests will skew this timer. It should be based
    24152439       *       on TOD to be accurate. Does it matter ?
    24162440       */
    2417       if (sync_active || rtems_bdbuf_has_buffer_waiters ())
     2441      if (sync_all || (sync_active && (*dev == bd->dev))
     2442          || rtems_bdbuf_has_buffer_waiters ())
    24182443        bd->hold_timer = 0;
    24192444
     
    25162541   * If a sync is active do not use a worker because the current code does not
    25172542   * cleaning up after. We need to know the buffers have been written when
    2518    * syncing to the release sync lock and currently worker threads do not
    2519    * return to here. We do not know the worker is the last in a sequence of
    2520    * sync writes until after we have it running so we do not know to tell it to
    2521    * release the lock. The simplest solution is to get the main swap out task
    2522    * perform all sync operations.
     2543   * syncing to release sync lock and currently worker threads do not return to
     2544   * here. We do not know the worker is the last in a sequence of sync writes
     2545   * until after we have it running so we do not know to tell it to release the
     2546   * lock. The simplest solution is to get the main swap out task perform all
     2547   * sync operations.
    25232548   */
    25242549  if (bdbuf_cache.sync_active)
     
    25342559  rtems_chain_initialize_empty (&transfer->bds);
    25352560  transfer->dev = BDBUF_INVALID_DEV;
    2536 
     2561  transfer->syncing = bdbuf_cache.sync_active;
     2562 
    25372563  /*
    25382564   * When the sync is for a device limit the sync to that device. If the sync
     
    25422568  if (bdbuf_cache.sync_active)
    25432569    transfer->dev = bdbuf_cache.sync_device;
    2544 
     2570   
    25452571  /*
    25462572   * If we have any buffers in the sync queue move them to the modified
     
    27542780  rtems_chain_initialize_empty (&transfer.bds);
    27552781  transfer.dev = BDBUF_INVALID_DEV;
     2782  transfer.syncing = false;
    27562783
    27572784  /*
  • cpukit/libblock/src/diskdevs.c

    rbaf64cdb r8aa608df  
    260260  dd->driver_data = driver_data;
    261261
    262   if ((*handler)(dd, RTEMS_BLKDEV_CAPABILITIES, &dd->capabilities) < 0) {
     262  if ((*handler)(dd, RTEMS_BLKIO_CAPABILITIES, &dd->capabilities) < 0) {
    263263    dd->capabilities = 0;
    264264  }
Note: See TracChangeset for help on using the changeset viewer.