From: Eric Sandeen <sandeen@redhat.com>
To: ext4 development <linux-ext4@vger.kernel.org>
Subject: [PATCH 1/3] ext4: different maxbytes functions for bitmap & extent files
Date: Tue, 04 Dec 2007 09:58:11 -0600 [thread overview]
Message-ID: <47557913.3090208@redhat.com> (raw)
In-Reply-To: <47557870.9060405@redhat.com>
use 2 different maxbytes functions for bitmapped & extent-based
files.
Signed-off-by: Eric Sandeen <sandeen@redhat.com>
---
Index: linux-2.6.24-rc3/fs/ext4/super.c
===================================================================
--- linux-2.6.24-rc3.orig/fs/ext4/super.c
+++ linux-2.6.24-rc3/fs/ext4/super.c
@@ -1656,17 +1656,57 @@ static void ext4_orphan_cleanup (struct
}
/*
- * Maximal file size. There is a direct, and {,double-,triple-}indirect
+ * Maximal extent format file size.
+ * Resulting logical blkno at s_maxbytes must fit in our on-disk
+ * extent format containers, within a sector_t, and within i_blocks
+ * in the vfs. ext4 inode has 48 bits of i_block in fsblock units,
+ * so that won't be a limiting factor.
+ *
+ * Note, this does *not* consider any metadata overhead for vfs i_blocks.
+ */
+static loff_t ext4_max_size(int blkbits)
+{
+ loff_t res;
+ loff_t upper_limit = MAX_LFS_FILESIZE;
+
+ /* small i_blocks in vfs inode? */
+ if (sizeof(blkcnt_t) < sizeof(u64)) {
+ /*
+ * CONFIG_LSF is not enabled implies the inode
+ * i_block represent total blocks in 512 bytes
+ * 32 == size of vfs inode i_blocks * 8
+ */
+ upper_limit = (1LL << 32) - 1;
+
+ /* total blocks in file system block size */
+ upper_limit >>= (blkbits - 9);
+ upper_limit <<= blkbits;
+ }
+
+ /* 32-bit extent-start container, ee_block */
+ res = 1LL << 32;
+ res <<= blkbits;
+ res -= 1;
+
+ /* Sanity check against vm- & vfs- imposed limits */
+ if (res > upper_limit)
+ res = upper_limit;
+
+ return res;
+}
+
+/*
+ * Maximal bitmap file size. There is a direct, and {,double-,triple-}indirect
* block limit, and also a limit of (248 - 1) 512-byte sectors in i_blocks.
* We need to be 1 filesystem block less than the 248 sector limit.
*/
-static loff_t ext4_max_size(int bits)
+static loff_t ext4_max_bitmap_size(int bits)
{
loff_t res = EXT4_NDIR_BLOCKS;
int meta_blocks;
loff_t upper_limit;
/* This is calculated to be the largest file size for a
- * dense, file such that the total number of
+ * dense, bitmapped file such that the total number of
* sectors in the file, including data and all indirect blocks,
* does not exceed 248 -1
* __u32 i_blocks_lo and _u16 i_blocks_high representing the
next prev parent reply other threads:[~2007-12-04 15:58 UTC|newest]
Thread overview: 7+ messages / expand[flat|nested] mbox.gz Atom feed top
2007-12-04 15:55 [PATCH 0/3] ext4: Handle different max offsets for bitmap & extent-based files Eric Sandeen
2007-12-04 15:58 ` Eric Sandeen [this message]
2007-12-05 23:18 ` [PATCH 1/3] ext4: different maxbytes functions for bitmap & extent files Andreas Dilger
2007-12-05 23:22 ` Eric Sandeen
2007-12-04 15:59 ` [PATCH 2/3] ext4: export iov_shorten from kernel for ext4's use Eric Sandeen
2007-12-04 16:00 ` [PATCH 3/3] ext4: store maxbytes for bitmapped files and return EFBIG as appropriate Eric Sandeen
2007-12-04 19:31 ` [PATCH 3/3] ext4: (V2) " Eric Sandeen
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=47557913.3090208@redhat.com \
--to=sandeen@redhat.com \
--cc=linux-ext4@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.