Messages in this thread Patch in this message | | | Date | Fri, 4 Feb 2000 14:38:20 -0500 (EST) | From | Ben LaHaise <> | Subject | Re: LFS (2+GB) problems. |
| |
On Fri, 4 Feb 2000, Andreas Dilger wrote:
> You write: > > Just resently I have started messing with the lfs facilities now > > in place in the devel kernels and I have run into a few problems. > > > > Here are my problems: > > > > o I can create files larger than 4GB BUT I cannot remove them cleanly.
Can you elaborate on this point? Last time I checked it worked here. What size of file are you creating? Looking through trunc_tindirect, it operates on block sizes. It's using an int, so if the file is incredibly large, there will be a sign problem.
> > o On a reboot e2fsck truncates any file larger than 4GB to 4GB. > > > > Also... the first time I ran e2fsck it complained to me about having a large > > file on the FS... It said I needed to turn on some flag in the superblock > > (I cant remember the name) to enable LFS support... How do I turn it on > > if e2fsck didnt already? What is the flag named? Is there any real docs > > on how to set up LFS in linux? I cant seem to find any.
To use lfs you really just need a new glibc that knows about stat64 -- recent versions of most utilities compile themselves to use the 64 bit loff_t.
> You didn't mention if you installed a new e2fsprogs. The latest version > is 1.18 I believe. However, looking through the ext2 code that I have > (2.3.34 only), it does not set the EXT2_FEATURE_RO_COMPAT_LARGE_FILE flag > in the superblock as far as I can see, so e2fsck probably has no chance to > get it right anyways. If it isn't already in the recent kernel, you need > something like the following in fs/ext2/inode.c:ext2_update_inode():
Actually you probably want the patch below -- only mark the super block dirty if the bit wasn't already set. This is what's done in 2.2, I'm not sure how I missed this -- probably because my superblock already had the compat bit set... =)
-ben
Index: linux/fs/ext2/inode.c =================================================================== RCS file: /home/bcrl/CVSROOT/kernel/linux/fs/ext2/inode.c,v retrieving revision 1.1.1.1 diff -u -u -r1.1.1.1 inode.c --- linux/fs/ext2/inode.c 2000/01/11 02:15:58 1.1.1.1 +++ linux/fs/ext2/inode.c 2000/02/04 19:25:59 @@ -699,7 +699,7 @@ else { inode->u.ext2_i.i_dir_acl = 0; inode->u.ext2_i.i_high_size = le32_to_cpu(raw_inode->i_size_high); - inode->i_size |= ((__u64)le32_to_cpu(raw_inode->i_size_high)) << 32; + inode->i_size |= ((__u64)inode->u.ext2_i.i_high_size) << 32; } inode->i_generation = le32_to_cpu(raw_inode->i_generation); inode->u.ext2_i.i_block_group = block_group; @@ -840,8 +840,22 @@ raw_inode->i_file_acl = cpu_to_le32(inode->u.ext2_i.i_file_acl); if (S_ISDIR(inode->i_mode)) raw_inode->i_dir_acl = cpu_to_le32(inode->u.ext2_i.i_dir_acl); - else + else { raw_inode->i_size_high = cpu_to_le32(inode->i_size >> 32); + if (raw_inode->i_size_high) { + struct super_block *sb = inode->i_sb; + struct ext2_super_block *es = sb->u.ext2_sb.s_es; + if (!(es->s_feature_ro_compat & + cpu_to_le32(EXT2_FEATURE_RO_COMPAT_LARGE_FILE))){ + /* If this is the first large file + * created, add a flag to the superblock */ + es->s_feature_ro_compat |= + cpu_to_le32(EXT2_FEATURE_RO_COMPAT_LARGE_FILE); + mark_buffer_dirty(sb->u.ext2_sb.s_sbh, 1); + } + } + + } raw_inode->i_generation = cpu_to_le32(inode->i_generation); if (S_ISCHR(inode->i_mode) || S_ISBLK(inode->i_mode))
- To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to majordomo@vger.rutgers.edu Please read the FAQ at http://www.tux.org/lkml/
| |