From: Surbhi Palande <surbhi.palande@canonical.com>
To: Leonard Michlmayr <leonard.michlmayr@gmail.com>
Cc: Andreas Dilger <adilger@sun.com>, Theodore Ts'o <tytso@mit.edu>,
linux-ext4@vger.kernel.org, linux-kernel@vger.kernel.org,
474597@bugs.launchpad.net
Subject: Re: ext4_fiemap gives 0 extents for files smaller than a block (patch included)
Date: Mon, 08 Feb 2010 15:54:27 +0200 [thread overview]
Message-ID: <4B701793.9010005@canonical.com> (raw)
In-Reply-To: <1257371050.13852.28.camel@michlmayr>
Leonard Michlmayr wrote:
> Thank you for your reply.
>
>>> @@ -3700,7 +3701,8 @@
>>> start_blk = start >> inode->i_sb->s_blocksize_bits;
>>> - len_blks = len >> inode->i_sb->s_blocksize_bits;
>>> + end_blk = (start + len - 1) >> inode->i_sb->s_blocksize_bits;
>>> + len_blks = end_blk - start_blk + 1;
>> I don't think this is quite correct either. For example, if blocksize
>> is 1024
>> and start is 1023 (start_blk = 0) and len is 2 (end = 1024, end_blk =
>> 1) then
>> len_blks = 2 which is too much.
>
> I think that len_blks = 2 is the correct value, because the requested
> region extends into 2 blocks (namely 0 and 1). If both blocks are in two
> separate extents, then ext4_ext_walk_space should report 2 extents. (If
> it's the same extent, only 1 will be reported anyways)
>
>> I think the right calculation here is:
>>
>> end_blk = (start + len + inode->i_sb->s_blocksize - 1) >>
>> inode->i_sb->s_blocksize_bits;
>> len_blks = end_blk - start_blk;
>>
>
> This is exactly the same (provided that len > 0). You can convince
> yourself easily that ((blocksize + x) >> blocksize_bits == x >>
> blocksize_bits + 1) for any positive x, because the lower bits of
> blocksize are all 0. (Your calculation would handle the case len == 0
> right, if that was allowed.)
>
> Regards
> Leonard
I was wondering if there is any update on the status of this patch.
Thanks !
Warm Regards,
Surbhi.
next prev parent reply other threads:[~2010-02-08 13:54 UTC|newest]
Thread overview: 11+ messages / expand[flat|nested] mbox.gz Atom feed top
2009-11-04 18:42 ext4_fiemap gives 0 extents for files smaller than a block (patch included) Leonard Michlmayr
2009-11-04 19:44 ` Andreas Dilger
2009-11-04 21:44 ` Leonard Michlmayr
2010-02-08 13:54 ` Surbhi Palande [this message]
2010-02-12 18:42 ` [PATCH 2.6.32.7] ext4: number of blocks for fiemap Leonard Michlmayr
2010-02-12 21:49 ` Andreas Dilger
2010-02-12 23:20 ` Leonard Michlmayr
2010-02-15 19:50 ` tytso
2010-02-15 20:33 ` Eric Sandeen
2010-02-15 22:01 ` tytso
2010-01-25 19:04 ` ext4_fiemap gives 0 extents for files smaller than a block (patch included) Leonard Michlmayr
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=4B701793.9010005@canonical.com \
--to=surbhi.palande@canonical.com \
--cc=474597@bugs.launchpad.net \
--cc=adilger@sun.com \
--cc=leonard.michlmayr@gmail.com \
--cc=linux-ext4@vger.kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=tytso@mit.edu \
/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;
as well as URLs for NNTP newsgroup(s).