On 4/24/14, 5:09 PM, Felipe Monteiro de Carvalho wrote:
> Hello,
>
> I am writing an application which reads XFS partitions, so I am trying
> to understand the internal working of XFS. I read the documentation
> here:
> http://www.dubeyko.com/development/FileSystems/XFS/xfs_filesystem_structure.pdf
>
> But I am stuck at a particular point. To get to the inodes I see that
> I should first read xfs_agi_t, no problem here, then its root field
> points to a block which contains xfs_inobt_block_t + a sequence of
> xfs_inobt_rec_t records and those records are supposed to show me
> where the inodes are, but there is no field in xfs_inobt_rec_t such as
> a block number =( Any idea how to get then the physical position in
> the disk where the inodes are from xfs_inobt_block_t + a sequence of
> xfs_inobt_rec_t?
The inode's location is encoded in its inode number.
See for example:
/*
* Inode number format:
* low inopblog bits - offset in block
* next agblklog bits - block number in ag
* next agno_log bits - ag number
* high agno_log-agblklog-inopblog bits - 0
*/
#define XFS_INO_TO_FSB(mp,i) \
XFS_AGB_TO_FSB(mp, XFS_INO_TO_AGNO(mp,i), XFS_INO_TO_AGBNO(mp,i))
-Eric
> thanks,
>
|