[Top] [All Lists]

Re: Conversion Routine Help

To: Vijay Chauhan <kernel.vijay@xxxxxxxxx>
Subject: Re: Conversion Routine Help
From: Amit Sahrawat <amit.sahrawat83@xxxxxxxxx>
Date: Thu, 29 Dec 2011 22:14:20 +0530
Cc: xfs@xxxxxxxxxxx
Dkim-signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=gamma; h=mime-version:in-reply-to:references:date:message-id:subject:from:to :cc:content-type:content-transfer-encoding; bh=4GGfQw+VIxGQ+ZJHp6/bjAYtHBt0WZRweIqbszSp8NQ=; b=Qyt9ddS1h6lRVXPUf/T0YarWUKI7c10FdSZcQcnOZPWJN7ZBzEzL/PdqG5zz2VI4UQ fetfjWQe2G9sfdy4RSA6L7Ff8OW/QQ8DpEr5Mj9BTs/k94zsSuxOCVhXNtMqoH9A/yOA d6qP/vYB9W532ys5ojbr0ycp5+gGra6i6rDgA=
In-reply-to: <CAJ61zBCgsy8=Ty9swem_TsWeVh-7iHrRfy1tMwvB4UePRj3c=w@xxxxxxxxxxxxxx>
References: <CAJ61zBCgsy8=Ty9swem_TsWeVh-7iHrRfy1tMwvB4UePRj3c=w@xxxxxxxxxxxxxx>
On Thu, Dec 29, 2011 at 7:42 PM, Vijay Chauhan <kernel.vijay@xxxxxxxxx> wrote:
> Hi list,
> Can anyone please provide me links about the basic explanations of XFS
> basic blocks and filesystem logical block mapping and conversion
> routines?
You can refer the XFSdocuments from the links:
But the information which you are looking for is actually - trying to
dig into the layout of filesystem on disk.
After going through intial documents - few things can be verified by
taking a hexdump of the disk and then analysing the data. Keeping the
filesystem partition to empty and to a small partition size will help
fast analyses. You can give this a try with a 100MB XFS formatted
> I tried to understand from code but its not clear to me:
> #define XFS_FSB_TO_BB(mp,fsbno) ((fsbno) << (mp)->m_blkbb_log)
> #define XFS_BB_TO_FSB(mp,bb)    \
>        (((bb) + (XFS_FSB_TO_BB(mp,1) - 1)) >> (mp)->m_blkbb_log)
> #define XFS_BB_TO_FSBT(mp,bb)   ((bb) >> (mp)->m_blkbb_log)
> #define XFS_BB_FSB_OFFSET(mp,bb) ((bb) & ((mp)->m_bsize - 1))
> lets consider the last one:
> #define XFS_BB_FSB_OFFSET(mp,bb) ((bb) & ((mp)->m_bsize - 1))
> if basic block (512 byte size) number is 7 and m_bsize is 12
> (considering FS block size 4096), then this will return 3 [e.g. ( 7 &
> 11) ]. then what does 3 means here? what offset value it is denoting?
If I am correct this indicates the starting block with respect to that
So, If I have 20GB disk with 10-10 GB partitions, and Suppose the
second partition is XFS formatted - then layout will be in terms of
offset on that partition and not with respect to Starting of the disk.
For actually checking the data about some file and understanding more:
Create a file on XFS partition and then use xfs_bmap to view the block
mapping of the file(xfs_db can also be used - this is explained in the
documents - but this works on unmounted device)
xfs_bmap <filename> will return a layout for the file(in terms of extent)
0: [0..9503]:          67181048..67190551
where the values in [] - indicates starting and ending offset, while
the values next to it represent the block numbers on that disk with
respect to that partition. These values are in terms of 'sectors' and
not in blocks - so to actually correlate them - divide each values by
'8'(512 =4096/8)

Amit Sahrawat
> Thanks in advance.
> _______________________________________________
> xfs mailing list
> xfs@xxxxxxxxxxx
> http://oss.sgi.com/mailman/listinfo/xfs

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