From owner-freebsd-fs@FreeBSD.ORG Mon Oct 31 08:53:55 2005 Return-Path: X-Original-To: freebsd-fs@freebsd.org Delivered-To: freebsd-fs@freebsd.org Received: from mx1.FreeBSD.org (mx1.freebsd.org [216.136.204.125]) by hub.freebsd.org (Postfix) with ESMTP id 09BBF16A41F for ; Mon, 31 Oct 2005 08:53:55 +0000 (GMT) (envelope-from bde@zeta.org.au) Received: from mailout1.pacific.net.au (mailout1.pacific.net.au [61.8.0.84]) by mx1.FreeBSD.org (Postfix) with ESMTP id 58F5543D48 for ; Mon, 31 Oct 2005 08:53:54 +0000 (GMT) (envelope-from bde@zeta.org.au) Received: from mailproxy1.pacific.net.au (mailproxy1.pacific.net.au [61.8.0.86]) by mailout1.pacific.net.au (8.13.4/8.13.4/Debian-3) with ESMTP id j9V8rhvM013085; Mon, 31 Oct 2005 19:53:43 +1100 Received: from katana.zip.com.au (katana.zip.com.au [61.8.7.246]) by mailproxy1.pacific.net.au (8.13.4/8.13.4/Debian-3) with ESMTP id j9V8re3A011815; Mon, 31 Oct 2005 19:53:41 +1100 Date: Mon, 31 Oct 2005 19:53:40 +1100 (EST) From: Bruce Evans X-X-Sender: bde@delplex.bde.org To: Brian Bergstrand In-Reply-To: <46D894BD-16E0-4CBA-B40A-EEBAAC2547D2@classicalguitar.net> Message-ID: <20051031191139.J38757@delplex.bde.org> References: <20051030183340.B19470@geri.cc.fer.hr> <46D894BD-16E0-4CBA-B40A-EEBAAC2547D2@classicalguitar.net> MIME-Version: 1.0 Content-Type: TEXT/PLAIN; charset=US-ASCII; format=flowed Cc: freebsd-fs@freebsd.org, Ivan Voras Subject: Re: ext2 large_file X-BeenThere: freebsd-fs@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: Filesystems List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 31 Oct 2005 08:53:55 -0000 On Sun, 30 Oct 2005, Brian Bergstrand wrote: > I ported the FreeBSD driver to Mac OS X / Darwin a few years ago and added > large file support in the process. Here's the patch, as you can see it's a > rather simple patch (as long as the in core i_size member is 64bit which I > think is true for FreeBSD): tjr implemented it in FreeBSD almost 2 years ago: % RCS file: /home/ncvs/src/sys/gnu/ext2fs/ext2_fs.h,v % Working file: ext2_fs.h % head: 1.13 % ... % ---------------------------- % revision 1.13 % date: 2004/02/18 14:08:25; author: tjr; state: Exp; lines: +2 -1 % Add partial support for large (>4GB) files on ext2 filesystems. This % support is partial in that it will refuse to create large files on % filesystems that haven't been upgraded to EXT2_DYN_REV or that don't % have the EXT2_FEATURE_RO_COMPAT_LARGE_FILE flag set in the superblock. % % MFC after: 2 weeks % ---------------------------- I don't don't know if block allocation actually works for large files. > I doubt this patch will apply cleanly as my tree has diverged from FreeBSD in > a non-compatible way quite a while ago -- but it should give you a start: I prefer tjr's version. > Index: ext2_inode_cnv.c > =================================================================== > RCS file: /cvsroot/ext2fsx/src/gnu/ext2fs/ext2_inode_cnv.c,v > retrieving revision 1.6 > retrieving revision 1.7 > diff -u -b -r1.6 -r1.7 > - --- ext2_inode_cnv.c 3 May 2003 23:54:39 -0000 1.6 > +++ ext2_inode_cnv.c 9 Jul 2003 23:09:24 -0000 1.7 > ... > @@ -182,6 +214,31 @@ > raw_inode->i_uid_high = 0; > raw_inode->i_gid_high = 0; > }*/ > + if (S_ISREG(ip->i_mode)) { > + ei->i_size_high = cpu_to_le32(ip->i_size >> 32); > + if (ip->i_size > 0x7fffffffULL) { > + struct ext2_sb_info *sb = ip->i_e2fs; > + if (!EXT2_HAS_RO_COMPAT_FEATURE(sb, > + EXT2_FEATURE_RO_COMPAT_LARGE_FILE) || > + EXT2_SB(sb)->s_es->s_rev_level == cpu_to_le32 > (EXT2_GOOD_OLD_REV)) { > + /* First large file, add the flag to the superblock. */ Compatibility flags shouldn't be forced on IMO. Linux does it for this flag, but this is a bug IMO. It breaks subsequent remounting r/w on old or other kernels that don't support large files. Changes are also needed to at least ext2_fs.h (to indicate that the kernel supports large files), ext2_vfsops.c (to set fs_maxfilesize according to the compatibility flag), and ext2_readwrite.c (to actually use the ifdefed out code that checks fs_maxfilesize, and fix minor bitrot in that code). > On Oct 30, 2005, at 11:37 AM, Ivan Voras wrote: > >> I recently tried to use ext2 on FreeBSD but have decided not to when I saw >> that the support for large files is missing (and went with msdosfs >> instead). msdosfs is physically incapable of supporting large files. Its maximum file size is the constant 0xffffffff. >> Now I accidentaly noticed that large_file support is present in latest >> NetBSD (and maybe OpenBSD). Is anyone interested in porting the support to >> FreeBSD? :) I prefer FreeBSD's version. NetBSD got it 9 months ago, only a year after FreeBSD. It refuses to create files larger than 2G-1 if the ext2fs rev number is old, and says in a comment that Linux silently upgrades the rev number. It silently clobbers the compat flag like Linux. Someone has an off-by-power-of-2 error -- the corresponding limit in FreeBSD is 4G-1. Bruce