How to find the inodes in XFS
Felipe Monteiro de Carvalho
felipemonteiro.carvalho at gmail.com
Sun Apr 27 10:53:36 CDT 2014
Oh, well, ...now my code works great for low inode numbers, but it
doesn't work at all for high inode numbers. =)
If inode is the root one 0x80 or similar small numbers which as 0x83
it will map correctly to the block 8, which means position 0x8000 +
internal offset inside the block
But in high inodes, for example 0x204B87 and 0x204B80 it will split
the inode number like this:
AG=2
Block inside AG Nr=0x4B8
And since XFS_INO_TO_FSB just recombines back together the parts:
#define XFS_INO_TO_FSB(mp,i) \
XFS_AGB_TO_FSB(mp, XFS_INO_TO_AGNO(mp,i), XFS_INO_TO_AGBNO(mp,i))
#define XFS_AGB_TO_FSB(mp,agno,agbno) \
(((xfs_fsblock_t)(agno) << (mp)->m_sb.sb_agblklog) | (agbno))
I get as the result from XFS_INO_TO_FSB 0x204B8, which would mean
position 0x204B8000, but this is a wrong position =(
I opened the partition with a hex viewer and the correct position is
block 0x1521A which means position 0x1521A000 + offset inside block
My superblock has these values:
XFS_INO_AGINO_BITS = mp^.m_agino_log = 20
XFS_INO_OFFSET_BITS= m_sb^.sb_inopblog = 4
XFS_INO_AGBNO_BITS = m_sb^.sb_agblklog = 16
XFS_INO_MASK = FFFF
sb_agcount = 4
Any ideas?
Maybe my flaw is that to get the disk position I simply multiply the
block number by the size of a block ... I tryed to use
XFS_FSB_TO_DADDR instead but it gives 64 for block nr 8, which doesn't
make much sense, I'd expect 0x8000
thanks!
--
Felipe Monteiro de Carvalho
More information about the xfs
mailing list