Changeset 6c9b390 in rtems for cpukit/libblock


Ignore:
Timestamp:
11/02/09 09:50:06 (14 years ago)
Author:
Thomas Doerfler <Thomas.Doerfler@…>
Branches:
4.10, 4.11, 5, master
Children:
5ac15a5
Parents:
deb22fc
Message:

Fixed buffer recycling
Wake-up access waiters after sync

File:
1 edited

Legend:

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

    rdeb22fc r6c9b390  
    11351135
    11361136    /*
    1137      * If this bd is already part of a group that supports the same number of
    1138      * BDs per group return it. If the bd is part of another group check the
    1139      * number of users and if 0 we can take this group and resize it.
     1137     * If nobody waits for this BD, we may recycle it.
    11401138     */
    1141     if (bd->group->bds_per_group == bds_per_group)
    1142     {
    1143       rtems_chain_extract (node);
    1144       return bd;
    1145     }
    1146 
    1147     if (bd->group->users == 0)
     1139    if (bd->waiters == 0)
    11481140    {
    11491141      /*
    1150        * We use the group to locate the start of the BDs for this group.
     1142       * If this bd is already part of a group that supports the same number of
     1143       * BDs per group return it. If the bd is part of another group check the
     1144       * number of users and if 0 we can take this group and resize it.
    11511145       */
    1152       rtems_bdbuf_group_realloc (bd->group, bds_per_group);
    1153       bd = (rtems_bdbuf_buffer*) rtems_chain_get (&bdbuf_cache.ready);
    1154       return bd;
     1146      if (bd->group->bds_per_group == bds_per_group)
     1147      {
     1148        rtems_chain_extract (node);
     1149        return bd;
     1150      }
     1151
     1152      if (bd->group->users == 0)
     1153      {
     1154        /*
     1155         * We use the group to locate the start of the BDs for this group.
     1156         */
     1157        rtems_bdbuf_group_realloc (bd->group, bds_per_group);
     1158        bd = (rtems_bdbuf_buffer*) rtems_chain_get (&bdbuf_cache.ready);
     1159        return bd;
     1160      }
    11551161    }
    11561162
     
    21602166  rtems_chain_append (&bdbuf_cache.sync, &bd->link);
    21612167
     2168  if (bd->waiters)
     2169    rtems_bdbuf_wake (&bdbuf_cache.access_waiters);
     2170
    21622171  rtems_bdbuf_wake_swapper ();
    21632172
Note: See TracChangeset for help on using the changeset viewer.