Changeset ac50df2 in rtems for cpukit/libblock


Ignore:
Timestamp:
Mar 28, 2012, 9:30:59 AM (8 years ago)
Author:
Sebastian Huber <sebastian.huber@…>
Branches:
4.11, master
Children:
08b9d534
Parents:
1c2b94a
git-author:
Sebastian Huber <sebastian.huber@…> (03/28/12 09:30:59)
git-committer:
Sebastian Huber <sebastian.huber@…> (04/16/12 09:06:45)
Message:

libblock: PR2040: Add starvation threshold

Do not use the unavailable block count as the erased blocks starvation
threshold. Use instead the block count of the largest segment. This
improves the starvation resolution gain of available blocks.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • cpukit/libblock/src/flashdisk.c

    r1c2b94a rac50df2  
    178178  uint32_t block_count;                    /**< The number of avail. blocks. */
    179179  uint32_t unavail_blocks;                 /**< The number of unavail blocks. */
     180  uint32_t starvation_threshold;           /**< Erased blocks starvation threshold. */
    180181  uint32_t erased_blocks;                  /**< The number of erased blocks. */
    181182
     
    281282rtems_fdisk_is_erased_blocks_starvation (rtems_flashdisk* fd)
    282283{
    283   bool starvation = fd->erased_blocks < fd->unavail_blocks;
     284  bool starvation = fd->erased_blocks < fd->starvation_threshold;
    284285
    285286  if (starvation)
     
    14061407  if (rtems_fdisk_is_erased_blocks_starvation (fd))
    14071408  {
     1409#if RTEMS_FDISK_TRACE
     1410    rtems_fdisk_printf (fd, " resolve starvation");
     1411#endif
     1412
    14081413    ssc = rtems_fdisk_segment_queue_pop_head (&fd->used);
    14091414    if (!ssc)
     
    14831488
    14841489    if (!ssc || (pages == 0) || ((compacted_segs + segments) == 1))
     1490    {
     1491#if RTEMS_FDISK_TRACE
     1492      rtems_fdisk_printf (fd, " nothing to compact");
     1493#endif
    14851494      break;
     1495    }
    14861496
    14871497#if RTEMS_FDISK_TRACE
     
    15401550   */
    15411551  fd->erased_blocks = 0;
     1552  fd->starvation_threshold = 0;
    15421553  for (device = 0; device < fd->device_count; device++)
    15431554  {
     
    15581569      sc->pages =
    15591570        rtems_fdisk_pages_in_segment (sd, fd->block_size) - sc->pages_desc;
     1571      if (sc->pages > fd->starvation_threshold)
     1572        fd->starvation_threshold = sc->pages;
    15601573
    15611574      sc->pages_active = 0;
     
    22262239  rtems_fdisk_printf (fd, "Block count\t%d", fd->block_count);
    22272240  rtems_fdisk_printf (fd, "Unavail blocks\t%d", fd->unavail_blocks);
     2241  rtems_fdisk_printf (fd, "Starvation threshold\t%d", fd->starvation_threshold);
    22282242  rtems_fdisk_printf (fd, "Starvations\t%d", fd->starvations);
    22292243  count = rtems_fdisk_segment_count_queue (&fd->available);
Note: See TracChangeset for help on using the changeset viewer.