xfs
[Top] [All Lists]

Re: Conversion Routine Help

To: Dave Chinner <david@xxxxxxxxxxxxx>
Subject: Re: Conversion Routine Help
From: Vijay Chauhan <kernel.vijay@xxxxxxxxx>
Date: Wed, 4 Jan 2012 13:26:09 +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=WBM51gvjEcNkFBK5Dy9gIbSWNw+D2VLcLSy3TRTft2Y=; b=OvsZZBt3ElRFExO2SfYpYmoextAb5QivIVQgkHEu+vMxWB/I0D+rWTqmSdUvlhJptn q6uSgndqSPhQbKX+3CwkpC1rQ8qjzWXw0hY4Fl7gVXIMFvTI0xvB5ejMW0fcKwnu0vdJ 6CVUFbT81PJ7d8hpmz7j+0cDSx/a7q+4CAgYc=
In-reply-to: <20111229215412.GM23662@dastard>
References: <CAJ61zBCgsy8=Ty9swem_TsWeVh-7iHrRfy1tMwvB4UePRj3c=w@xxxxxxxxxxxxxx> <20111229215412.GM23662@dastard>
Hi,


>>
>> 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?
>

Thanks Dave. I understand.

I am newbie and learning. Sure, i'll create the patch but before let
me try out further in the code.

Thanks.

<Prev in Thread] Current Thread [Next in Thread>
  • Re: Conversion Routine Help, Vijay Chauhan <=