From: Eric Sandeen <sandeen@redhat.com>
To: Eric Sandeen <sandeen@redhat.com>, Jan Kara <jack@suse.cz>,
Andreas Dilger <adilger@dilger.ca>, "Ted Ts'o" <tytso@mit.edu>,
ocfs2-devel@oss.oracle.com, linux-fsdevel@vger.kernel.org,
Subject: Re: [Ocfs2-devel] [PATCH 1/3] ext3/ext4: Factor out disk addressability check
Date: Sun, 15 Aug 2010 22:36:36 -0500 [thread overview]
Message-ID: <4C68B244.6080406@redhat.com> (raw)
In-Reply-To: <20100816025436.GA9061@mail.oracle.com>
Joel Becker wrote:
> On Sun, Aug 15, 2010 at 12:19:36PM -0500, Eric Sandeen wrote:
>>>> + (last_fs_block >
>>>> + (pgoff_t)(~0ULL) >> (PAGE_CACHE_SHIFT - blocksize_bits))) {
>>> ^^^ I don't get the pgoff_t check. Shouldn't it rather be
>>> (u64)(pgoff_t)(~0ULL) << (PAGE_CACHE_SHIFT - blocksize_bits)?
>> Argh that was my fault... Thankfully not too many 1k-blocksize-formatted
>> 16T devices out there, I guess.
>>
>> I went through the math again and also came up with:
>>
>> total fs pages is blocks / (blocks per page)
>> total pages is blocks / (1 << PAGE_CACHE_SHIFT / 1 << blocksize_bits)
>> total pages is blocks / (1 << (PAGE_CACHE_SHIFT - blocksize_bits))
>> total pages is blocks * (1 >> (PAGE_CACHE_SHIFT - blocksize_bits))
>> total pages is blocks >> (PAGE_CACHE_SHIFT - blocksize_bits)
>>
>> too big if total pages is > (pgoff_t)(~0ULL)
>> too big if blocks >> (PAGE_CACHE_SHIFT - blocksize_bits) > (pgoff_t)(~0ULL)
>
> Why not stop here, which is what I put in my other email?
> "blocks >> SHIFT-bits" is "how many pages do I need?".
yeah, ok. Was going for pointless symmetry w/ the other test...
>> too big if blocks > (pgoff_t)(~0ULL) << (PAGE_CACHE_SHIFT - blocksize_bits)
>> and to not overflow:
>> too big if blocks > (u64)(pgoff_t)(~0ULL) << (PAGE_CACHE_SHIFT - blocksize_bits)
>
> This still overflows. pgoff_t is a u64 on 64bit machines,
> right? So shift that left by anything and you wrap.
Er, yeah. I had 32 bits in my head since that's the case we're
checking for... whoops.
So I guess your
... ||
((last_fs_block >> (PAGE_CACHE_SHIFT - blocksize_bits)) >
(pgoff_t)(!0ULL))) {
is right :) (my feeble brain has a hard time reading that, though, TBH)
-Eric
> Joel
>
next prev parent reply other threads:[~2010-08-16 3:36 UTC|newest]
Thread overview: 30+ messages / expand[flat|nested] mbox.gz Atom feed top
2010-07-22 22:03 [PATCH 1/3] ext3/ext4: Factor out disk addressability check Patrick J. LoPresti
2010-07-22 22:04 ` [PATCH 2/3] JBD2: Allow feature checks before journal recovery Patrick J. LoPresti
2010-07-22 22:05 ` [PATCH 3/3] OCFS2: Allow huge (> 16 TiB) volumes to mount Patrick J. LoPresti
2010-08-12 17:43 ` [Ocfs2-devel] [PATCH 2/3] JBD2: Allow feature checks before journal recovery Joel Becker
2010-08-12 23:03 ` Joel Becker
2010-08-12 23:03 ` Joel Becker
2010-08-13 3:39 ` Ted Ts'o
2010-08-13 7:17 ` Joel Becker
2010-08-10 15:15 ` [Ocfs2-devel] [PATCH 1/3] ext3/ext4: Factor out disk addressability check Joel Becker
2010-08-12 17:42 ` Joel Becker
2010-08-12 18:45 ` Andreas Dilger
2010-08-12 20:15 ` Joel Becker
2010-08-12 21:32 ` Andreas Dilger
2010-08-12 22:29 ` Joel Becker
2010-08-12 23:07 ` Andreas Dilger
2010-08-12 23:13 ` Joel Becker
2010-08-13 16:30 ` Jan Kara
2010-08-13 20:47 ` Joel Becker
2010-08-13 22:52 ` Joel Becker
2010-08-16 15:09 ` Jan Kara
2010-08-15 17:19 ` Eric Sandeen
2010-08-16 2:54 ` Joel Becker
2010-08-16 3:36 ` Eric Sandeen [this message]
2010-08-16 9:21 ` Joel Becker
2010-08-16 14:44 ` [Ocfs2-devel] " Eric Sandeen
[not found] ` <4C694ED3.5070500@redhat.com>
2010-08-16 19:13 ` Joel Becker
2010-08-16 19:21 ` [Ocfs2-devel] " Jan Kara
2010-08-16 20:45 ` Joel Becker
2010-08-12 23:03 ` Joel Becker
2010-08-13 3:39 ` [Ocfs2-devel] " Ted Ts'o
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=4C68B244.6080406@redhat.com \
--to=sandeen@redhat.com \
--cc=adilger@dilger.ca \
--cc=jack@suse.cz \
--cc=linux-fsdevel@vger.kernel.org \
--cc=ocfs2-devel@oss.oracle.com \
--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).