Re: Filesize limitation

Chel van Gennip (linux@vangennip.nl)
Wed, 5 Nov 1997 0:00:11 +0000 (WET)


"H. Peter Anvin" <hpa@transmeta.com> wrote:>
>Actually, Linux *does* have a 2 GB (2^31-1 bytes) filesize limit in
>the current incarnation. For one thing, the file length field in the
>ext2 inode is 32 bits.
>
>There has been a lot of talk about supporting a new set of 64-bit
>system calls and I think some of the latest experimental kernels do
>support them.

I think there is a real need for files > 2GB.

There is a limit in:
/usr/include/gnu/types.h:typedef long __off_t; /* Type of file sizes and offsets. */
/usr/include/unistd.h:extern __off_t lseek __P ((int __fd, __off_t __offset, int __whence));

But not in:
/usr/include/gnu/types.h:typedef long long __loff_t; /* Type of long file sizes and offsets. */
/usr/include/unistd.h:extern __loff_t llseek __P ((int __fd, __loff_t __offset, int __whence));

So interfaces with a minimal support for files > 2GB are available.

A real problem is in the ext2 filesystem:
/*
* Structure of an inode on the disk
*/
struct ext2_inode {
__u16 i_mode; /* File mode */
__u16 i_uid; /* Owner Uid */
__u32 i_size; /* Size in bytes */
__u32 i_atime; /* Access time */
__u32 i_ctime; /* Creation time */
__u32 i_mtime; /* Modification time */
__u32 i_dtime; /* Deletion Time */
__u16 i_gid; /* Group Id */
__u16 i_links_count; /* Links count */
__u32 i_blocks; /* Blocks count */
__u32 i_flags; /* File flags */

How difficult would it be to upgrade this to a ext3 filesystem with
32 bits reserved for gid and uid, and 64 bits for length and block count?:
/*
* Structure of an inode on the disk
*/
struct ext2_inode {
__u16 i_mode; /* File mode */
__u16 i_links_count; /* Links count */
__u32 i_uid; /* Owner Uid */
__u64 i_size; /* Size in bytes */
__u32 i_atime; /* Access time */
__u32 i_ctime; /* Creation time */
__u32 i_mtime; /* Modification time */
__u32 i_dtime; /* Deletion Time */
__u64 i_blocks; /* Blocks count */
__u32 i_gid; /* Group Id */
__u32 i_flags; /* File flags */

Chel