Changeset 0c2241c in rtems


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

Make bit addressing consistent in rtems_rfs_group.c

This change fixes https://devel.rtems.org/ticket/3089.

Briefly, rtems_rfs_group.c contains conflicting conversions between
block numbers and group number and bit offset pairs. This caused the
actual bit stored on the bitmask to be one bit displaced from its
intended location.

For more details, please see the associated ticket.

Tested by inspecting the written bitmasks with and without this change.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • cpukit/libfs/src/rfs/rtems-rfs-group.c

    r343f2084 r0c2241c  
    168168  }
    169169  else
     170  {
    170171    size = fs->group_blocks;
     172    /*
     173     * It is possible for 'goal' to be zero. Any newly created inode will have
     174     * its 'last_data_block' set to zero, which is then used as 'goal' to
     175     * allocate new blocks. When that happens, we simply set 'goal' to zero and
     176     * continue the search from there.
     177     */
     178    if (goal >= RTEMS_RFS_ROOT_INO)
     179        goal -= RTEMS_RFS_ROOT_INO;
     180  }
    171181
    172182  group_start = goal / size;
     
    325335  else
    326336  {
    327     if (no >= rtems_rfs_fs_blocks (fs))
     337    if ((no < RTEMS_RFS_ROOT_INO) || (no >= rtems_rfs_fs_blocks (fs)))
    328338        return EINVAL;
     339    no -= RTEMS_RFS_ROOT_INO;
    329340    size = fs->group_blocks;
    330341  }
Note: See TracChangeset for help on using the changeset viewer.