aboutsummaryrefslogtreecommitdiffstats
path: root/fs/ext4
diff options
context:
space:
mode:
authorEric Sandeen <sandeen@redhat.com>2008-01-28 23:58:27 -0500
committerTheodore Ts'o <tytso@mit.edu>2008-01-28 23:58:27 -0500
commitcd2291a463c26f60b18e0d9b1901be236dd7f402 (patch)
tree832f5f030a59c72f62e16292006becaddb630059 /fs/ext4
parent8180a5627d126362c2f64e4fa886d6f608d9632a (diff)
ext4: different maxbytes functions for bitmap & extent files
use 2 different maxbytes functions for bitmapped & extent-based files. Signed-off-by: Eric Sandeen <sandeen@redhat.com>
Diffstat (limited to 'fs/ext4')
-rw-r--r--fs/ext4/super.c45
1 files changed, 42 insertions, 3 deletions
diff --git a/fs/ext4/super.c b/fs/ext4/super.c
index 64067de70c6f..c79e46b7f159 100644
--- a/fs/ext4/super.c
+++ b/fs/ext4/super.c
@@ -1600,19 +1600,58 @@ static void ext4_orphan_cleanup (struct super_block * sb,
1600#endif 1600#endif
1601 sb->s_flags = s_flags; /* Restore MS_RDONLY status */ 1601 sb->s_flags = s_flags; /* Restore MS_RDONLY status */
1602} 1602}
1603/*
1604 * Maximal extent format file size.
1605 * Resulting logical blkno at s_maxbytes must fit in our on-disk
1606 * extent format containers, within a sector_t, and within i_blocks
1607 * in the vfs. ext4 inode has 48 bits of i_block in fsblock units,
1608 * so that won't be a limiting factor.
1609 *
1610 * Note, this does *not* consider any metadata overhead for vfs i_blocks.
1611 */
1612static loff_t ext4_max_size(int blkbits)
1613{
1614 loff_t res;
1615 loff_t upper_limit = MAX_LFS_FILESIZE;
1616
1617 /* small i_blocks in vfs inode? */
1618 if (sizeof(blkcnt_t) < sizeof(u64)) {
1619 /*
1620 * CONFIG_LSF is not enabled implies the inode
1621 * i_block represent total blocks in 512 bytes
1622 * 32 == size of vfs inode i_blocks * 8
1623 */
1624 upper_limit = (1LL << 32) - 1;
1625
1626 /* total blocks in file system block size */
1627 upper_limit >>= (blkbits - 9);
1628 upper_limit <<= blkbits;
1629 }
1630
1631 /* 32-bit extent-start container, ee_block */
1632 res = 1LL << 32;
1633 res <<= blkbits;
1634 res -= 1;
1635
1636 /* Sanity check against vm- & vfs- imposed limits */
1637 if (res > upper_limit)
1638 res = upper_limit;
1639
1640 return res;
1641}
1603 1642
1604/* 1643/*
1605 * Maximal file size. There is a direct, and {,double-,triple-}indirect 1644 * Maximal bitmap file size. There is a direct, and {,double-,triple-}indirect
1606 * block limit, and also a limit of (2^48 - 1) 512-byte sectors in i_blocks. 1645 * block limit, and also a limit of (2^48 - 1) 512-byte sectors in i_blocks.
1607 * We need to be 1 filesystem block less than the 2^48 sector limit. 1646 * We need to be 1 filesystem block less than the 2^48 sector limit.
1608 */ 1647 */
1609static loff_t ext4_max_size(int bits) 1648static loff_t ext4_max_bitmap_size(int bits)
1610{ 1649{
1611 loff_t res = EXT4_NDIR_BLOCKS; 1650 loff_t res = EXT4_NDIR_BLOCKS;
1612 int meta_blocks; 1651 int meta_blocks;
1613 loff_t upper_limit; 1652 loff_t upper_limit;
1614 /* This is calculated to be the largest file size for a 1653 /* This is calculated to be the largest file size for a
1615 * dense, file such that the total number of 1654 * dense, bitmapped file such that the total number of
1616 * sectors in the file, including data and all indirect blocks, 1655 * sectors in the file, including data and all indirect blocks,
1617 * does not exceed 2^48 -1 1656 * does not exceed 2^48 -1
1618 * __u32 i_blocks_lo and _u16 i_blocks_high representing the 1657 * __u32 i_blocks_lo and _u16 i_blocks_high representing the