From: Jeff Mahoney <jeffm@suse.com>
To: ReiserFS Mailing List <reiserfs-devel@vger.kernel.org>
Cc: Edward Shishkin <edward.shishkin@gmail.com>
Subject: [PATCH RESUBMIT] reiserfs: Remove 2 TB file size limit
Date: Thu, 22 Apr 2010 15:12:31 -0400 [thread overview]
Message-ID: <4BD09F9F.6010801@suse.com> (raw)
In its early life, reiserfs had an evolving s_max_bytes. It started out
at 4 GB, then was raised to MAX_LFS_FILESIZE, then dropped to 2 TiB when
it was observed that struct stat only had a 32-bit st_blocks field.
Since then, both the kernel and glibc have evolved as well and now both
support 64-bit st_blocks. Applications that can't deal with these ranges
are assumed to be "legacy" or "broken." File systems now routinely
support file sizes much larger than can be represented by 2^32 * 512.
But we never revisited that limitation. ReiserFS has always been able to
support larger file sizes (up to 16 TiB, in fact), but the s_max_bytes
limitation has prevented that.
This patch adds a max_file_offset helper to set s_max_bytes to a more
appropriate value. I noticed that XFS adjusts the limit based on the
CPU but I'd prefer to err on the side of compatibility and place the
limit at the smaller of the 32-bit MAX_LFS_FILESIZE and the maximum
supported by the file system. At a 4k block size, this is conveniently
also the advertised maximum file size of reiserfs.
Update: This version properly extends PAGE_SIZE_CACHE so the math works
on 32-bit systems.
This bug is tracked at: https://bugzilla.novell.com/show_bug.cgi?id=592100
Signed-off-by: Jeff Mahoney <jeffm@suse.com>
---
fs/reiserfs/super.c | 17 +++++++++++++----
1 file changed, 13 insertions(+), 4 deletions(-)
--- a/fs/reiserfs/super.c
+++ b/fs/reiserfs/super.c
@@ -1309,6 +1309,18 @@ out_err:
return err;
}
+static inline loff_t
+reiserfs_max_file_offset(struct super_block *sb)
+{
+ /* Limited by stat_data->sd_blocks, 2^32-1 blocks */
+ loff_t fs_max = ((u64)sb->s_blocksize << 32) - sb->s_blocksize;
+
+ /* Limited by 32-bit MAX_LFS_FILESIZE */
+ loff_t page_cache_max = (((u64)PAGE_CACHE_SIZE << 31)-1);
+
+ return min(fs_max, page_cache_max);
+}
+
static int read_super_block(struct super_block *s, int offset)
{
struct buffer_head *bh;
@@ -1398,10 +1410,7 @@ static int read_super_block(struct super
s->dq_op = &reiserfs_quota_operations;
#endif
- /* new format is limited by the 32 bit wide i_blocks field, want to
- ** be one full block below that.
- */
- s->s_maxbytes = (512LL << 32) - s->s_blocksize;
+ s->s_maxbytes = reiserfs_max_file_offset(s);
return 0;
}
--
Jeff Mahoney
SUSE Labs
next reply other threads:[~2010-04-22 19:12 UTC|newest]
Thread overview: 10+ messages / expand[flat|nested] mbox.gz Atom feed top
2010-04-22 19:12 Jeff Mahoney [this message]
[not found] <4BF43A65.405@suse.com>
2010-05-19 19:46 ` [PATCH RESUBMIT] reiserfs: Remove 2 TB file size limit Leonardo Chiquitto
2010-05-19 22:00 ` Edward Shishkin
2010-05-20 19:10 ` Jeff Mahoney
2010-05-21 13:17 ` Tim Shearouse
2010-06-15 15:26 ` Leonardo Chiquitto
2010-06-15 21:00 ` Edward Shishkin
2010-11-01 13:58 ` Jeff Mahoney
2010-11-01 16:04 ` Edward Shishkin
2010-11-02 12:43 ` Jeff Mahoney
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=4BD09F9F.6010801@suse.com \
--to=jeffm@suse.com \
--cc=edward.shishkin@gmail.com \
--cc=reiserfs-devel@vger.kernel.org \
/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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.