Changeset 64908df in rtems for cpukit/libfs/src

Timestamp:
10/10/17 23:28:34 (7 years ago)
Author:
Fan Deng <enetor@…>
Branches:
5, master
Children:
d869c182
Parents:
095a807
git-author:
Fan Deng <enetor@…> (10/10/17 23:28:34)
git-committer:
Chris Johns <chrisj@…> (04/11/18 01:51:57)
Message:

Fixes bitmap allocation accounting logic in rtems-rfs-bitmaps.c

The bitmap allocation accounting logic in rtems-rfs-bitmaps.c is flawed
around control->free. Specifically:

In rtems_rfs_bitmap_map_set():
control->free is only decremented when its corresponding search bit is
toggled. This is wrong and will miss on average 31/32 set updates.

In rtems_rfs_bitmap_map_clear():
control->free is incremented unconditionally.

The correct behavior is:
When updating the map, check if the bit is already set/clear. Only update
control->free when the bit is toggled.

This change enforced the correct behavior.

Tested by inspecting the internal data structure.

(No files)

Note: See TracChangeset for help on using the changeset viewer.