diff options
author | Theodore Ts'o <tytso@mit.edu> | 2002-05-17 10:53:07 -0400 |
---|---|---|
committer | Theodore Ts'o <tytso@mit.edu> | 2002-05-17 10:53:07 -0400 |
commit | 31e29a12d1e22745c74afe47bf172a3c73280dd9 (patch) | |
tree | 3dec5b739625cf38944053d66dd07fd558a9ca2d | |
parent | 932a489cdf6bc83d69e59d3f8e0a57b733799ce1 (diff) | |
download | e2fsprogs-31e29a12d1e22745c74afe47bf172a3c73280dd9.tar.gz |
Fix up Andreas's 8k blocksize changes to fix a number of bugs,
and to make the page size determined at run-time instead of
compile time.
-rw-r--r-- | ChangeLog | 10 | ||||
-rw-r--r-- | configure | 2 | ||||
-rw-r--r-- | configure.in | 4 | ||||
-rw-r--r-- | e2fsck/ChangeLog | 27 | ||||
-rw-r--r-- | e2fsck/pass1.c | 7 | ||||
-rw-r--r-- | e2fsck/super.c | 3 | ||||
-rw-r--r-- | lib/ext2fs/ChangeLog | 11 | ||||
-rw-r--r-- | misc/ChangeLog | 17 | ||||
-rw-r--r-- | misc/mke2fs.c | 35 |
9 files changed, 91 insertions, 25 deletions
@@ -1,4 +1,12 @@ -2002-05-11 <tytso@snap.thunk.org> +2002-05-17 Theodore Ts'o <tytso@mit.edu> + + * Remove check for asm/page.h, and add check for sysconf() + +2002-05-16 Andreas Dilger <adilger@clusterfs.com> + + * Add check for asm/page.h + +2002-05-11 Theodore Tso <tytso@mit.edu> * configure.in, MCONFIG.in: Add new makefile variables, $datadir and $root_sysconfdir, which are normally /usr/share and @@ -4619,7 +4619,7 @@ EOF fi fi -for ac_func in chflags getrusage llseek lseek64 open64 getmntinfo strcasecmp srandom fchown mallinfo fdatasync strnlen +for ac_func in chflags getrusage llseek lseek64 open64 getmntinfo strcasecmp srandom fchown mallinfo fdatasync strnlen sysconf do echo $ac_n "checking for $ac_func""... $ac_c" 1>&6 echo "configure:4626: checking for $ac_func" >&5 diff --git a/configure.in b/configure.in index 6bcc570a..4670cc8d 100644 --- a/configure.in +++ b/configure.in @@ -437,7 +437,7 @@ if test $cross_compiling = no; then else AC_CHECK_PROGS(BUILD_CC, gcc cc) fi -AC_CHECK_HEADERS(stdlib.h unistd.h stdarg.h errno.h malloc.h mntent.h paths.h dirent.h getopt.h setjmp.h signal.h termios.h linux/fd.h linux/major.h sys/disklabel.h sys/ioctl.h sys/mkdev.h sys/mount.h sys/sockio.h sys/sysmacros.h sys/time.h sys/stat.h sys/types.h net/if.h netinet/in.h asm/page.h) +AC_CHECK_HEADERS(stdlib.h unistd.h stdarg.h errno.h malloc.h mntent.h paths.h dirent.h getopt.h setjmp.h signal.h termios.h linux/fd.h linux/major.h sys/disklabel.h sys/ioctl.h sys/mkdev.h sys/mount.h sys/sockio.h sys/sysmacros.h sys/time.h sys/stat.h sys/types.h net/if.h netinet/in.h) AC_FUNC_VPRINTF dnl dnl See if struct dirent has a d_namlen field (like bsd systems), implying @@ -541,7 +541,7 @@ if test "$e2fsprogs_cv_struct_st_flags" = yes; then AC_DEFINE(HAVE_STAT_FLAGS) fi fi -AC_CHECK_FUNCS(chflags getrusage llseek lseek64 open64 getmntinfo strcasecmp srandom fchown mallinfo fdatasync strnlen) +AC_CHECK_FUNCS(chflags getrusage llseek lseek64 open64 getmntinfo strcasecmp srandom fchown mallinfo fdatasync strnlen sysconf) dnl dnl Check to see if -lsocket is required (solaris) to make something dnl that uses socket() to compile; this is needed for the UUID library diff --git a/e2fsck/ChangeLog b/e2fsck/ChangeLog index 9e2474be..f8795d9e 100644 --- a/e2fsck/ChangeLog +++ b/e2fsck/ChangeLog @@ -1,3 +1,30 @@ +2002-05-17 Theodore Ts'o <tytso@mit.edu> + + * pass1.c (e2fsck_pass1): When calculating max_sizes, omit capping + this value by the calculated value of max_sect_sizes. + The inode may be a sparse inode, and the limit of + max_sect_sizes assumed a non-sparse inode and a limit + based on a 32-bit i_blocks field measured in 512 sectors. + + * super.c (check_super_block): Fix check for s_log_block_size so + that takes into account fact that there is an offset of + EXT2_MIN_BLOCK_LOG_SIZE. + + * pass1.c: Allocate max_sizes array to be big enough to support + the larger block sizes. + +2002-05-16 Andreas Dilger <adilger@clusterfs.com> + + * unix.c (main), util.c (get_backup_sb): Use EXT2_MAX_BLOCK_SIZE + instead of using a hardcoded value of 4096. + + * super.c (check_super_block): Change checks for s_log_block_size + s_log_frag_size so they support the larger block sizes. + + * pass1.c (e2fsck_pass1): Calculate max_sizes array for block + sizes up to EXT2_MAX_BLOCK_SIZE (to support block sizes + greater than 4k). + 2002-03-08 Theodore Tso <tytso@mit.edu> * Release of E2fsprogs 1.27 diff --git a/e2fsck/pass1.c b/e2fsck/pass1.c index 9d041148..8e048465 100644 --- a/e2fsck/pass1.c +++ b/e2fsck/pass1.c @@ -103,7 +103,7 @@ struct scan_callback_struct { static struct process_inode_block *inodes_to_process; static int process_inode_count; -static __u64 ext2_max_sizes[4]; +static __u64 ext2_max_sizes[EXT2_MAX_BLOCK_LOG_SIZE - EXT2_MIN_BLOCK_LOG_SIZE]; /* * Free all memory allocated by pass1 in preparation for restarting @@ -239,7 +239,7 @@ static void check_size(e2fsck_t ctx, struct problem_context *pctx) void e2fsck_pass1(e2fsck_t ctx) { int i; - __u64 max_sizes, max_sect_limit; + __u64 max_sizes; ext2_filsys fs = ctx->fs; ext2_ino_t ino; struct ext2_inode inode; @@ -273,9 +273,6 @@ void e2fsck_pass1(e2fsck_t ctx) max_sizes = max_sizes + EXT2_BPP(i) * EXT2_BPP(i); max_sizes = max_sizes + EXT2_BPP(i) * EXT2_BPP(i) * EXT2_BPP(i); max_sizes = (max_sizes * (1UL << i)) - 1; - max_sect_limit = 512ULL * ((1LL << 32) - (1 << i)); - if (max_sizes > max_sect_limit) - max_sizes = max_sect_limit; ext2_max_sizes[i - 10] = max_sizes; } #undef EXT2_BPP diff --git a/e2fsck/super.c b/e2fsck/super.c index e57fd8b7..c880a9ad 100644 --- a/e2fsck/super.c +++ b/e2fsck/super.c @@ -335,7 +335,8 @@ void check_super_block(e2fsck_t ctx) check_super_value(ctx, "first_data_block", sb->s_first_data_block, MAX_CHECK, 0, sb->s_blocks_count); check_super_value(ctx, "log_block_size", sb->s_log_block_size, - MIN_CHECK | MAX_CHECK, 0, EXT2_MAX_BLOCK_LOG_SIZE); + MIN_CHECK | MAX_CHECK, 0, + EXT2_MAX_BLOCK_LOG_SIZE - EXT2_MIN_BLOCK_LOG_SIZE); check_super_value(ctx, "log_frag_size", sb->s_log_frag_size, MIN_CHECK | MAX_CHECK, 0, sb->s_log_block_size); check_super_value(ctx, "frags_per_group", sb->s_frags_per_group, diff --git a/lib/ext2fs/ChangeLog b/lib/ext2fs/ChangeLog index eda86e7e..7569f2b6 100644 --- a/lib/ext2fs/ChangeLog +++ b/lib/ext2fs/ChangeLog @@ -1,10 +1,17 @@ -2002-05-11 <tytso@snap.thunk.org> +2002-05-16 Andreas Dilger <adilger@clusterfs.com> + + * ext2_fs.h: Change limits to support filesystems with 8k blocks. + + * initialize.c (ext2fs_initialize): Remove assumption that + blocksizes are always <= 4k. + +2002-05-11 Theodore Ts'o <tytso@mit.edu> * bmap.c (ext2fs_bmap): Fix bug which caused ext2fs_bmap to fail silently if inode pointer is NULL (and ext2fs_bmap is expected to read the inode itself). -2002-04-27 <tytso@snap.thunk.org> +2002-04-27 Theodore Ts'o <tytso@mit.edu> * ismounted.c (check_mntent_file, is_swap_device): Verify that the file we are checking is a block device file before looking diff --git a/misc/ChangeLog b/misc/ChangeLog index 3feabcea..6bcf5312 100644 --- a/misc/ChangeLog +++ b/misc/ChangeLog @@ -1,4 +1,19 @@ -2002-04-30 <tytso@snap.thunk.org> +2002-05-17 Theodore Ts'o <tytso@mit.edu> + + * mke2fs.c (PRS): Determine the page size using sysconf() at + runtime, instead of using the Linux system header files. + +2002-05-16 Andreas Dilger <adilger@clusterfs.com> + + * mke2fs.c (PRS): Allow blocksizes larger than 4k to be specified, + with warning printed and the user questioned if blocksize + is larger than the system's page size according to the + Linux kernel header files. Added better checking for + valid inode sizes, and again print a warning message if + using a large inode size (since most kernels today don't + support this yet). + +2002-04-30 Theodore Ts'o <tytso@mit.edu> * fsck.8.in: Fix typo in man page. diff --git a/misc/mke2fs.c b/misc/mke2fs.c index 89b4f6b4..3b440151 100644 --- a/misc/mke2fs.c +++ b/misc/mke2fs.c @@ -44,13 +44,6 @@ extern int optind; #include <sys/ioctl.h> #include <sys/types.h> -#ifdef HAVE_ASM_PAGE_H -#include <asm/page.h> -#define SYS_MAX_BLOCKSIZE PAGE_SIZE -#else -#define SYS_MAX_BLOCKSIZE 4096 -#endif - #include "ext2fs/ext2_fs.h" #include "et/com_err.h" #include "uuid/uuid.h" @@ -91,6 +84,8 @@ char *mount_dir; char *journal_device; int sync_kludge; /* Set using the MKE2FS_SYNC env. option */ +int sys_page_size = 4096; + static void usage(void) { fprintf(stderr, _("Usage: %s [-c|-t|-l filename] [-b block-size] " @@ -132,6 +127,7 @@ static int int_log10(unsigned int arg) * of zero meaning that it is the default parameter for the type. * Note that order is important in the table below. */ +#define DEF_MAX_BLOCKSIZE -1 static char default_str[] = "default"; struct mke2fs_defaults { const char *type; @@ -144,8 +140,8 @@ struct mke2fs_defaults { { default_str, 3, 1024, 8192 }, { "journal", 0, 4096, 8192 }, { "news", 0, 4096, 4096 }, - { "largefile", 0, SYS_MAX_BLOCKSIZE, 1024 * 1024 }, - { "largefile4", 0, SYS_MAX_BLOCKSIZE, 4096 * 1024 }, + { "largefile", 0, DEF_MAX_BLOCKSIZE, 1024 * 1024 }, + { "largefile4", 0, DEF_MAX_BLOCKSIZE, 4096 * 1024 }, { 0, 0, 0, 0}, }; @@ -172,6 +168,8 @@ static void set_fs_defaults(const char *fs_type, if (ratio == 0) *inode_ratio = p->inode_ratio; if (blocksize == 0) { + if (p->blocksize == DEF_MAX_BLOCKSIZE) + p->blocksize = sys_page_size; super->s_log_frag_size = super->s_log_block_size = int_log2(p->blocksize >> EXT2_MIN_BLOCK_LOG_SIZE); } @@ -806,6 +804,7 @@ static void PRS(int argc, char *argv[]) #ifdef __linux__ struct utsname ut; #endif + long sysval; /* Update our PATH to include /sbin */ if (oldpath) { @@ -822,6 +821,18 @@ static void PRS(int argc, char *argv[]) tmp = getenv("MKE2FS_SYNC"); if (tmp) sync_kludge = atoi(tmp); + + /* Determine the system page size if possible */ +#ifdef HAVE_SYSCONF +#if (!defined(_SC_PAGESIZE) && defined(_SC_PAGE_SIZE)) +#define _SC_PAGESIZE _SC_PAGE_SIZE +#endif +#ifdef _SC_PAGESIZE + sysval = sysconf(_SC_PAGESIZE); + if (sysconf > 0) + sys_page_size = sysval; +#endif /* _SC_PAGESIZE */ +#endif /* HAVE_SYSCONF */ setbuf(stdout, NULL); setbuf(stderr, NULL); @@ -1071,16 +1082,16 @@ static void PRS(int argc, char *argv[]) ext2fs_close(jfs); } - if (blocksize > SYS_MAX_BLOCKSIZE) { + if (blocksize > sys_page_size) { if (!force) { com_err(program_name, 0, _("%d-byte blocks too big for system (max %d)"), - blocksize, SYS_MAX_BLOCKSIZE); + blocksize, sys_page_size); proceed_question(); } fprintf(stderr, _("Warning: %d-byte blocks too big for system " "(max %d), forced to continue\n"), - blocksize, SYS_MAX_BLOCKSIZE); + blocksize, sys_page_size); } if (param.s_feature_incompat & EXT3_FEATURE_INCOMPAT_JOURNAL_DEV) { |