mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: Andreas Dilger <adilger@clusterfs.com>
To: "Stephen C. Tweedie" <sct@redhat.com>
Cc: "ext2-devel@lists.sourceforge.net"
	<ext2-devel@lists.sourceforge.net>,
	"Theodore Ts'o" <tytso@mit.edu>, Alex Tomas <alex@clusterfs.com>,
	Al Viro <viro@parcelfarce.linux.theplanet.co.uk>,
	linux-kernel <linux-kernel@vger.kernel.org>,
	Andrew Morton <akpm@osdl.org>
Subject: Re: Ext2/3 32-bit stat() wrap for ~2TB files
Date: Fri, 11 Feb 2005 14:27:36 -0700	[thread overview]
Message-ID: <20050211212736.GD16520@schnapps.adilger.int> (raw)
In-Reply-To: <1108155135.1944.196.camel@sisko.sctweedie.blueyonder.co.uk>

[-- Attachment #1: Type: text/plain, Size: 1775 bytes --]

On Feb 11, 2005  20:52 +0000, Stephen C. Tweedie wrote:
> /*
>  * Maximal file size.  There is a direct, and {,double-,triple-}indirect
>  * block limit, and also a limit of (2^32 - 1) 512-byte sectors in i_blocks.
>  * We need to be 1 filesystem block less than the 2^32 sector limit.
>  */
> 
> Trouble is, that limit *should* be an i_blocks limit, because i_blocks
> is still 32-bits, and (more importantly) is multiplied by the fs
> blocksize / 512 in stat(2) to return st_blocks in 512-byte chunks. 
> Overflow 2^32 sectors in i_blocks and stat(2) wraps.

I agree.  The problem AFAIR is that the i_blocks accounting is done in
the quota code, so it was a challenge to get it right, and the i_size
limit was easier to do.  Until now I don't think anyone has created
dense 2TB files, so the sparse limit was enough.

Fixing this to count i_blocks correctly would also allow us to have
larger sparse files (up to the indirect limit).

Note also that there was a patch to extend i_blocks floating around
(pretty small hack to use one of the reserved fields), and it might make
sense to get this into the kernel before we actually need it.

> But i_blocks includes indirect blocks as well as data, so for a
> non-sparse file we wrap stat(2) st_blocks well before the file is
> 2^32*512 bytes long.  Yet ext3_max_size() doesn't understand this:
> it simply caps the size with
> 
> 	if (res > (512LL << 32) - (1 << bits))
> 		res = (512LL << 32) - (1 << bits);

So, for the quick fix we could reduce this by the number of expected
[td]indirect blocks and submit that to 2.4 also.

Cheers, Andreas
--
Andreas Dilger
http://sourceforge.net/projects/ext2resize/
http://members.shaw.ca/adilger/             http://members.shaw.ca/golinux/


[-- Attachment #2: Type: application/pgp-signature, Size: 189 bytes --]

  reply	other threads:[~2005-02-11 21:28 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2005-02-11 20:52 Stephen C. Tweedie
2005-02-11 21:27 ` Andreas Dilger [this message]
2005-02-11 21:39   ` Stephen C. Tweedie
2005-02-11 22:50     ` Andreas Dilger

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=20050211212736.GD16520@schnapps.adilger.int \
    --to=adilger@clusterfs.com \
    --cc=akpm@osdl.org \
    --cc=alex@clusterfs.com \
    --cc=ext2-devel@lists.sourceforge.net \
    --cc=linux-kernel@vger.kernel.org \
    --cc=sct@redhat.com \
    --cc=tytso@mit.edu \
    --cc=viro@parcelfarce.linux.theplanet.co.uk \
    /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

all inboxes | Powered by JetHome®