Trouble with RFS block addressing

Deng Fan enetor at gmail.com
Thu Jul 27 17:32:04 UTC 2017


Hi guys,

I am experimenting with RFS. There is an issue around block addressing in
RFS that has been bothering me quite a bit.

To my knowledge, there are two ways to ID a block in RFS:

- Via a direct bno
- Via a group number and a bit (offset)

They should be fully convertible (1-1 mapping). However, the source code I
am reading is inconsistent in converting one to the other. Below is a
summary of the different equations used in the code.

1. In rtems_rfs_group_bitmap_alloc (rtems-rfs-group.c, line #172)
bno = group * group_blocks + bit

2. In rtems_rfs_group_bitmap_alloc (rtems-rfs-group.c, line #228)
bno = group * group_blocks + bit + 1 (via rtems_rfs_group_block() function)

3. In rtems_rfs_group_bitmap_free (rtems-rfs-group.c, line #283)
bno = group * group_blocks + bit + 1 (RTEMS_RFS_SUPERBLOCK_SIZE)

4. In rtems_rfs_group_bitmap_test (rtems-rfs-group.c, line #332)
bno = group * group_blocks + bit

#1 and #4 are different from #2 and #3.

I did a little test. On a newly formatted RFS partition, I called
rtems_rfs_group_bitmap_alloc() to allocate a block. Then check if the block
is allocated via rtems_rfs_group_bitmap_test. The result confirmed that the
addressing is inconsistent, as the bno returned by
rtems_rfs_group_bitmap_alloc() is unallocated according to
rtems_rfs_group_bitmap_test().

Is there anything I interpreted incorrectly or is this a real issue?

Thanks,
Fan
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.rtems.org/pipermail/users/attachments/20170727/71763359/attachment.html>


More information about the users mailing list