From 067911ae734bb5fef7c5780a639533847b5b578c Mon Sep 17 00:00:00 2001 From: Andreas Dilger Date: Sat, 15 Jul 2006 22:08:20 -0400 Subject: [PATCH] Allow default inode_size to be specified in mke2fs.conf and document mke2fs -I This patch allows "inode_size" to be specified in the mke2fs.conf file, and always compiles in the "-I" option. In addition, it disallows specifying the inode size on rev 0 filesystems, though I don't think this was much of a danger anyways. Clean up dead lines in ext2fs.h. Signed-off-by: Andreas Dilger Signed-off-by: "Theodore Ts'o" --- lib/ext2fs/ChangeLog | 5 +++++ lib/ext2fs/ext2fs.h | 8 ++------ misc/ChangeLog | 8 ++++++++ misc/mke2fs.8.in | 21 +++++++++++++++++++++ misc/mke2fs.c | 25 ++++++++++++++++--------- misc/mke2fs.conf.5.in | 10 ++++++++++ 6 files changed, 62 insertions(+), 15 deletions(-) diff --git a/lib/ext2fs/ChangeLog b/lib/ext2fs/ChangeLog index 09a79b4..1ac7e23 100644 --- a/lib/ext2fs/ChangeLog +++ b/lib/ext2fs/ChangeLog @@ -1,3 +1,8 @@ +2006-07-15 Theodore Tso + + * ext2fs.h: Remove unneeded #ifdef since EXT2_DYNAMIC_REV is + always defined in the e2fsprogs-provided ext2_fs.h + 2006-05-21 Theodore Tso * openfs.c (ext2fs_open2): Fix type warning problem with sizeof() diff --git a/lib/ext2fs/ext2fs.h b/lib/ext2fs/ext2fs.h index 8618fe2..b3c2f65 100644 --- a/lib/ext2fs/ext2fs.h +++ b/lib/ext2fs/ext2fs.h @@ -117,15 +117,11 @@ typedef struct ext2fs_struct_generic_bitmap *ext2fs_generic_bitmap; typedef struct ext2fs_struct_generic_bitmap *ext2fs_inode_bitmap; typedef struct ext2fs_struct_generic_bitmap *ext2fs_block_bitmap; -#ifdef EXT2_DYNAMIC_REV #define EXT2_FIRST_INODE(s) EXT2_FIRST_INO(s) -#else -#define EXT2_FIRST_INODE(s) EXT2_FIRST_INO -#define EXT2_INODE_SIZE(s) sizeof(struct ext2_inode) -#endif + /* - * badblocks list definitions + * Badblocks list definitions */ typedef struct ext2_struct_u32_list *ext2_badblocks_list; diff --git a/misc/ChangeLog b/misc/ChangeLog index 55b47ff..2d57d56 100644 --- a/misc/ChangeLog +++ b/misc/ChangeLog @@ -1,5 +1,13 @@ 2006-07-15 Theodore Tso + * mke2fs.c (PRS): Look up the default inode size in the + mke2fs.conf file. + + * mke2fs.8.in, mke2fs.c(usage): Document the -I option. + + * mke2fs.conf.5.in: Document the inode_size relation in [defaults] + and [fs_types]. + * chattr.1.in: Fix spelling typo 2006-05-29 Theodore Tso diff --git a/misc/mke2fs.8.in b/misc/mke2fs.8.in index dcec552..390bb88 100644 --- a/misc/mke2fs.8.in +++ b/misc/mke2fs.8.in @@ -30,6 +30,10 @@ mke2fs \- create an ext2/ext3 filesystem .I bytes-per-inode ] [ +.B \-I +.I inode-size +] +[ .B \-j ] [ @@ -218,6 +222,23 @@ be smaller than the blocksize of the filesystem, since then too many inodes will be made. Be warned that is not possible to expand the number of inodes on a filesystem after it is created, so be careful deciding the correct value for this parameter. +.TP +.BI \-I " inode-size" +Specify the size of each inode in bytes. +.B mke2fs +creates 128-byte inodes by default. In kernels after 2.6.10 and some +earlier vendor kernels it is possible to utilize larger inodes to store +extended attributes for improved performance. The +.I inode-size +value must be a power of two larger or equal to 128. The larger the +.I inode-size +the more space the inode table will consume, and this reduces the usable +space in the filesystem and can also negatively impact performance. Using +the default value is always safe, though it may be desirable to use 256-byte +inodes if full backward compatibility is not a concern. Extended attributes +stored in large inodes are not visible with older kernels, and such +filesystems will not be mountable with 2.4 kernels at all. It is not +possible to change this value after the filesystem is created. .TP .B \-j Create the filesystem with an ext3 journal. If the diff --git a/misc/mke2fs.c b/misc/mke2fs.c index 0004c01..2686d72 100644 --- a/misc/mke2fs.c +++ b/misc/mke2fs.c @@ -94,11 +94,12 @@ int linux_version_code = 0; static void usage(void) { fprintf(stderr, _("Usage: %s [-c|-t|-l filename] [-b block-size] " - "[-f fragment-size]\n\t[-i bytes-per-inode] [-j] [-J journal-options]" - " [-N number-of-inodes]\n\t[-m reserved-blocks-percentage] " - "[-o creator-os] [-g blocks-per-group]\n\t[-L volume-label] " - "[-M last-mounted-directory] [-O feature[,...]]\n\t" - "[-r fs-revision] [-R options] [-qvSV] device [blocks-count]\n"), + "[-f fragment-size]\n\t[-i bytes-per-inode] [-I inode-size] " + "[-j] [-J journal-options]\n" + "\t[-N number-of-inodes] [-m reserved-blocks-percentage] " + "[-o creator-os]\n\t[-g blocks-per-group] [-L volume-label] " + "[-M last-mounted-directory]\n\t[-O feature[,...]] " + "[-r fs-revision] [-R options] [-qvSV]\n\tdevice [blocks-count]\n"), program_name); exit(1); } @@ -1076,7 +1077,6 @@ static void PRS(int argc, char *argv[]) case 's': /* deprecated */ s_opt = atoi(optarg); break; -#ifdef EXT2_DYNAMIC_REV case 'I': inode_size = strtoul(optarg, &tmp, 0); if (*tmp) { @@ -1085,7 +1085,6 @@ static void PRS(int argc, char *argv[]) exit(1); } break; -#endif case 'v': verbose = 1; break; @@ -1413,7 +1412,15 @@ static void PRS(int argc, char *argv[]) "blocksizes greater than 4096\n\tusing ext3. " "Use -b 4096 if this is an issue for you.\n\n")); - if (inode_size) { + if (inode_size == 0) { + profile_get_integer(profile, "defaults", "inode_size", NULL, + 0, &inode_size); + profile_get_integer(profile, "fs_types", fs_type, + "inode_size", inode_size, + &inode_size); + } + + if (inode_size && fs_param.s_rev_level >= EXT2_DYNAMIC_REV) { if (inode_size < EXT2_GOOD_OLD_INODE_SIZE || inode_size > EXT2_BLOCK_SIZE(&fs_param) || inode_size & (inode_size - 1)) { @@ -1425,7 +1432,7 @@ static void PRS(int argc, char *argv[]) } if (inode_size != EXT2_GOOD_OLD_INODE_SIZE) fprintf(stderr, _("Warning: %d-byte inodes not usable " - "on most systems\n"), + "on older systems\n"), inode_size); fs_param.s_inode_size = inode_size; } diff --git a/misc/mke2fs.conf.5.in b/misc/mke2fs.conf.5.in index 70cfdc6..6089031 100644 --- a/misc/mke2fs.conf.5.in +++ b/misc/mke2fs.conf.5.in @@ -131,6 +131,12 @@ This relation specifies the default inode ratio if the user does not specify one on the command line, and the filesystem-type specific section of the configuration file does not specify a default inode ratio. +.TP +.I inode_size +This relation specifies the default inode size if the user does not +specify one on the command line, and the filesystem-type +specific section of the configuration file does not specify a default +inode size. .SH THE [fs_types] STANZA Each tag in the .I [fs_types] @@ -181,6 +187,10 @@ specify a blocksize on the command line. .I inode_ratio This relation specifies the default inode ratio if the user does not specify one on the command line. +.TP +.I inode_size +This relation specifies the default inode size if the user does not +specify one on the command line. .SH FILES .TP .I /etc/mke2fs.conf -- 1.8.3.1