Trouble with RFS block addressing

Chris Johns chrisj at rtems.org
Wed Aug 2 02:33:02 UTC 2017


On 28/07/2017 03:32, Deng Fan wrote:
> Hi guys,
> 

Hey nice to hear from you. I hope all is well.

> 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). 

Correct.

> 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?
> 

It looks like a bug to me. Could you please create a ticket on 4.11 with a
milestone to the next release?

Any chance of a patch? Pretty please.

Chris


More information about the users mailing list