From: Dave Chinner <david@fromorbit.com>
To: Vijay Chauhan <kernel.vijay@gmail.com>
Cc: xfs@oss.sgi.com
Subject: Re: Conversion Routine Help
Date: Fri, 30 Dec 2011 08:54:12 +1100 [thread overview]
Message-ID: <20111229215412.GM23662@dastard> (raw)
In-Reply-To: <CAJ61zBCgsy8=Ty9swem_TsWeVh-7iHrRfy1tMwvB4UePRj3c=w@mail.gmail.com>
On Thu, Dec 29, 2011 at 07:42:31PM +0530, Vijay Chauhan 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?
>
> I tried to understand from code but its not clear to me:
> #define XFS_FSB_TO_BB(mp,fsbno) ((fsbno) << (mp)->m_blkbb_log)
Convert FileSystem Blocks to Basic Blocks
FSBs are defined at mkfs time, BBs are always 512 bytes.
> #define XFS_BB_TO_FSB(mp,bb) \
> (((bb) + (XFS_FSB_TO_BB(mp,1) - 1)) >> (mp)->m_blkbb_log)
Convert BB to FSB, rounding up to the next FSB
> #define XFS_BB_TO_FSBT(mp,bb) ((bb) >> (mp)->m_blkbb_log)
Convert BB to FSB, rounding down to the FSB containing the BB
> #define XFS_BB_FSB_OFFSET(mp,bb) ((bb) & ((mp)->m_bsize - 1))
Offset of the give BB within a FSB. e.g. if FSB = 4k = 8BB, then
"bb = 5" would return 5, "bb = 63" would return 7...
> 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
m_bsize is the FSB in BB, which will always be a power of 2.
> (considering FS block size 4096), then this will return 3 [e.g. ( 7 &
in that case, m_bsize = 8.
> 11) ]. then what does 3 means here? what offset value it is denoting?
It's the offset of the BB within the first partial FSB in the range
given. This was once used for sub-block zeroing needed by direct IO,
but is now stale code as the generic DIO layer does this zeroing.
Care to submit a patch to remove that macro?
Cheers,
Dave.
--
Dave Chinner
david@fromorbit.com
_______________________________________________
xfs mailing list
xfs@oss.sgi.com
http://oss.sgi.com/mailman/listinfo/xfs
next prev parent reply other threads:[~2011-12-29 21:54 UTC|newest]
Thread overview: 4+ messages / expand[flat|nested] mbox.gz Atom feed top
2011-12-29 14:12 Conversion Routine Help Vijay Chauhan
2011-12-29 16:44 ` Amit Sahrawat
2011-12-29 21:54 ` Dave Chinner [this message]
2012-01-04 7:56 ` Vijay Chauhan
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20111229215412.GM23662@dastard \
--to=david@fromorbit.com \
--cc=kernel.vijay@gmail.com \
--cc=xfs@oss.sgi.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox