ext3 enlarge blocksize
PATCH 12/24 ext3 enlarge blocksize
Summary of this patch:
[12/24] enlarge block size(ext3)
- Add an incompat flag "EXT3_FEATURE_INCOMPAT_LARGE_BLOCK" which indicates that the filesystem is extended.
- Allow block size till pagesize in ext3.
---
fs/ext3/super.c +10 -4
@@ -1463,11 +1463,17 @@ static int ext3_fill_super (struct super } blocksize =BLOCK_SIZE <<le32_to_cpu (es->s_log_block_size); +if (blocksize >PAGE_SIZE ) { +printk (KERN_ERR "EXT3-fs: cannot mount filesystem with " +"blocksize %u larger than PAGE_SIZE %u on %s\n" , + blocksize,PAGE_SIZE , sb->s_id); + goto failed_mount; + } +if (blocksize <EXT3_MIN_BLOCK_SIZE || - blocksize >EXT3_MAX_BLOCK_SIZE ) { -printk (KERN_ERR -"EXT3-fs: Unsupported filesystem blocksize %d on %s.\n" , - blocksize, sb->s_id); + blocksize >EXT3_EXTENDED_MAX_BLOCK_SIZE ) { +printk (KERN_ERR "EXT3-fs: Unsupported filesystem blocksize %d on %s.\n" , + blocksize, sb->s_id); goto failed_mount; }
include/linux/ext2_fs.h +4 -1
@@ -91,6 +91,7 @@ static inline struct ext2_sb_info *EXT2_*/ #define EXT2_MIN_BLOCK_SIZE 1024#define EXT2_MAX_BLOCK_SIZE 4096 +#define EXT2_EXTENDED_MAX_BLOCK_SIZE 65536#define EXT2_MIN_BLOCK_LOG_SIZE 10#ifdef __KERNEL__# define EXT2_BLOCK_SIZE (s) ((s)->s_blocksize)
@@ -471,11 +472,13 @@ struct ext2_super_block {#define EXT3_FEATURE_INCOMPAT_RECOVER 0x0004#define EXT3_FEATURE_INCOMPAT_JOURNAL_DEV 0x0008#define EXT2_FEATURE_INCOMPAT_META_BG 0x0010 +#define EXT2_FEATURE_INCOMPAT_HUGE_FS 0x0080#define EXT2_FEATURE_INCOMPAT_ANY 0xffffffff#define EXT2_FEATURE_COMPAT_SUPP EXT2_FEATURE_COMPAT_EXT_ATTR#define EXT2_FEATURE_INCOMPAT_SUPP (EXT2_FEATURE_INCOMPAT_FILETYPE| \ - EXT2_FEATURE_INCOMPAT_META_BG) + EXT2_FEATURE_INCOMPAT_META_BG| \ + EXT2_FEATURE_INCOMPAT_HUGE_FS)#define EXT2_FEATURE_RO_COMPAT_SUPP (EXT2_FEATURE_RO_COMPAT_SPARSE_SUPER| \ EXT2_FEATURE_RO_COMPAT_LARGE_FILE| \ EXT2_FEATURE_RO_COMPAT_BTREE_DIR)
include/linux/ext3_fs.h +4 -1
@@ -86,6 +86,7 @@ struct statfs;*/ #define EXT3_MIN_BLOCK_SIZE 1024#define EXT3_MAX_BLOCK_SIZE 4096 +#define EXT3_EXTENDED_MAX_BLOCK_SIZE 65536#define EXT3_MIN_BLOCK_LOG_SIZE 10#ifdef __KERNEL__# define EXT3_BLOCK_SIZE (s) ((s)->s_blocksize)
@@ -563,11 +564,13 @@ static inline struct ext3_inode_info *EX#define EXT3_FEATURE_INCOMPAT_RECOVER 0x0004/* Needs recovery */ #define EXT3_FEATURE_INCOMPAT_JOURNAL_DEV 0x0008/* Journal device */ #define EXT3_FEATURE_INCOMPAT_META_BG 0x0010 +#define EXT3_FEATURE_INCOMPAT_HUGE_FS 0x0080#define EXT3_FEATURE_COMPAT_SUPP EXT2_FEATURE_COMPAT_EXT_ATTR#define EXT3_FEATURE_INCOMPAT_SUPP (EXT3_FEATURE_INCOMPAT_FILETYPE| \ EXT3_FEATURE_INCOMPAT_RECOVER| \ - EXT3_FEATURE_INCOMPAT_META_BG) + EXT3_FEATURE_INCOMPAT_META_BG| \ + EXT3_FEATURE_INCOMPAT_HUGE_FS)#define EXT3_FEATURE_RO_COMPAT_SUPP (EXT3_FEATURE_RO_COMPAT_SPARSE_SUPER| \ EXT3_FEATURE_RO_COMPAT_LARGE_FILE| \ EXT3_FEATURE_RO_COMPAT_BTREE_DIR)
At least part of this patch can be included into the patch series that Mingming has posted to allow larger block sizes on architectures that support it. This doesn't need a separate COMPAT flag itself, since older kernels will already refuse to mount a filesystem with large blocks.
fs/ext3/super.c static int ext3_fill_super (struct super · line 1471
Quoted 11 lines · On May 25, 2006 21:49 +0900, [email protected] wrote:
fs/ext3/super.c +8
-1@@ -1463,11 +1463,17 @@ static int ext3_fill_super (struct super +if (blocksize >PAGE_SIZE ) { +printk (KERN_ERR "EXT3-fs: cannot mount filesystem with " +"blocksize %u larger than PAGE_SIZE %u on %s\n" , + blocksize,PAGE_SIZE , sb->s_id); + goto failed_mount; + } +if (blocksize <EXT3_MIN_BLOCK_SIZE || - blocksize >EXT3_MAX_BLOCK_SIZE ) { + blocksize >EXT3_EXTENDED_MAX_BLOCK_SIZE ) {
We may as well just change EXT3_MAX_BLOCK_SIZE to be 65536, because no other code uses this value. It is already 65536 in the e2fsprogs.
fs/ext3/super.c static int ext3_fill_super (struct super · line 1476
Quoted 5 lines
fs/ext3/super.c +2
-3-printk (KERN_ERR -"EXT3-fs: Unsupported filesystem blocksize %d on %s.\n" , - blocksize, sb->s_id); +printk (KERN_ERR "EXT3-fs: Unsupported filesystem blocksize %d on %s.\n" , + blocksize, sb->s_id);
I'm not sure why you changed the formatting of this message to now be longer than 80 columns.
include/linux/ext3_fs.h struct statfs; · line 92
Quoted 11 lines
diff -upNr -X linux-2.6.17-rc4/Documentation/dontdiff
linux-2.6.17-rc4/include/linux/ext3_fs.hlinux-2.6.17-rc4.tmp/include/linux/ext3_fs.hinclude/linux/ext3_fs.h +1
-0@@ -86,6 +86,7 @@ struct statfs;*/ #define EXT3_MIN_BLOCK_SIZE 1024#define EXT3_MAX_BLOCK_SIZE 4096 +#define EXT3_EXTENDED_MAX_BLOCK_SIZE 65536#define EXT3_MIN_BLOCK_LOG_SIZE 10#ifdef __KERNEL__# define EXT3_BLOCK_SIZE (s) ((s)->s_blocksize)
Cheers, Andreas
--
Andreas Dilger
Principal Software Engineer
Cluster File Systems, Inc.
Quoted 15 lines · Andreas Dilger
fs/ext3/super.c static int ext3_fill_super (struct super · line 1471
Quoted 11 lines · On May 25, 2006 21:49 +0900, [email protected] wrote:
fs/ext3/super.c +8
-1@@ -1463,11 +1463,17 @@ static int ext3_fill_super (struct super +if (blocksize >PAGE_SIZE ) { +printk (KERN_ERR "EXT3-fs: cannot mount filesystem with " +"blocksize %u larger than PAGE_SIZE %u on %s\n" , + blocksize,PAGE_SIZE , sb->s_id); + goto failed_mount; + } +if (blocksize <EXT3_MIN_BLOCK_SIZE || - blocksize >EXT3_MAX_BLOCK_SIZE ) { + blocksize >EXT3_EXTENDED_MAX_BLOCK_SIZE ) {We may as well just change
EXT3_MAX_BLOCK_SIZEto be 65536, because no other code uses this value. It is already 65536 in the e2fsprogs.
AFAICS, ext3_dir_entry_2->rec_len will overflow with a 64kB blocksize. Do you know how ext2 handles this?
Cheers,
Johann
Quoted 17 lines · Johann Lombardi
Quoted 15 lines · Andreas Dilger
fs/ext3/super.c static int ext3_fill_super (struct super · line 1471
Quoted 11 lines · On May 25, 2006 21:49 +0900, [email protected] wrote:
fs/ext3/super.c +8
-1@@ -1463,11 +1463,17 @@ static int ext3_fill_super (struct super +if (blocksize >PAGE_SIZE ) { +printk (KERN_ERR "EXT3-fs: cannot mount filesystem with " +"blocksize %u larger than PAGE_SIZE %u on %s\n" , + blocksize,PAGE_SIZE , sb->s_id); + goto failed_mount; + } +if (blocksize <EXT3_MIN_BLOCK_SIZE || - blocksize >EXT3_MAX_BLOCK_SIZE ) { + blocksize >EXT3_EXTENDED_MAX_BLOCK_SIZE ) {We may as well just change
EXT3_MAX_BLOCK_SIZEto be 65536, because no other code uses this value. It is already 65536 in the e2fsprogs.
Quoted 2 lines
AFAICS,
ext3_dir_entry_2->rec_lenwill overflow with a 64kB blocksize. Do you know how ext2 handles this?
Hmm, good question, I hadn't considered this. One option is to just limit rec_len to 32768 or less (16k, 8k, 4k?), and require that there be multiple such records in a directory block. We could additionally require that the records don't span such a boundary, which would potentially make it easier to validate broken entries themselves, but would slightly hurt the case where there are many large filenames.
I suppose the reason this wasn't hit during previous 64kB block testing is that this has always been tested in relation to IO performance and not with metadata, so the directories were probably all single-block dirs with a "." and ".." entry at the beginning and a 65512-byte rec_len for the rest.
Cheers, Andreas
--
Andreas Dilger
Principal Software Engineer
Cluster File Systems, Inc.