[Top] [All Lists]

Re: How to find the inodes in XFS

To: Felipe Monteiro de Carvalho <felipemonteiro.carvalho@xxxxxxxxx>, xfs@xxxxxxxxxxx
Subject: Re: How to find the inodes in XFS
From: Eric Sandeen <sandeen@xxxxxxxxxxx>
Date: Thu, 24 Apr 2014 17:33:14 -0500
Delivered-to: xfs@xxxxxxxxxxx
In-reply-to: <CACyNnZMtP87y6VHum+J4xKEZqaYp2YERVnt3YuaCmeiZBmMTzQ@xxxxxxxxxxxxxx>
References: <CACyNnZMtP87y6VHum+J4xKEZqaYp2YERVnt3YuaCmeiZBmMTzQ@xxxxxxxxxxxxxx>
User-agent: Mozilla/5.0 (Macintosh; Intel Mac OS X 10.9; rv:24.0) Gecko/20100101 Thunderbird/24.4.0
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))


> thanks,

<Prev in Thread] Current Thread [Next in Thread>