diff options
author | Alan Cudmore <alan.cudmore@gmail.com> | 2013-12-18 11:39:19 -0500 |
---|---|---|
committer | Chris Johns <chrisj@rtems.org> | 2013-12-19 11:03:27 +1100 |
commit | e60b7b1b4f19894dda0096b116bb0a21a5c51101 (patch) | |
tree | 63cd4ea19e689a22c43ea658f1cfd26fea86aa23 /cpukit/libfs/src/rfs | |
parent | psxtests: add psxcleanup/psxcleanup.doc (diff) | |
download | rtems-e60b7b1b4f19894dda0096b116bb0a21a5c51101.tar.bz2 |
For PR 2163 - RFS File System - fix group search algorithm bug
This is for the RFS file system. There is a bug in the group search
algorithm where it will skip groups, causing blocks to remain
unallocated. This is dependant on the size of the blocks and number
of blocks in a group, so it does not always show up. The fix corrects
the skipping of groups during the search, allowing all of the blocks
to be found.
Diffstat (limited to 'cpukit/libfs/src/rfs')
-rw-r--r-- | cpukit/libfs/src/rfs/rtems-rfs-group.c | 16 |
1 files changed, 15 insertions, 1 deletions
diff --git a/cpukit/libfs/src/rfs/rtems-rfs-group.c b/cpukit/libfs/src/rfs/rtems-rfs-group.c index b08e785114..b096528fbb 100644 --- a/cpukit/libfs/src/rfs/rtems-rfs-group.c +++ b/cpukit/libfs/src/rfs/rtems-rfs-group.c @@ -232,10 +232,24 @@ rtems_rfs_group_bitmap_alloc (rtems_rfs_file_system* fs, return 0; } + /* + * If we are still looking back and forth around the + * group_start, then alternate the direction and + * increment the offset on every other iteration. + * Otherwise we are marching through the groups, so just + * increment the offset. + */ if (updown) + { direction = direction > 0 ? -1 : 1; + if ( direction == -1 ) + offset++; + } + else + { + offset++; + } - offset++; } if (rtems_rfs_trace (RTEMS_RFS_TRACE_GROUP_BITMAPS)) |