Whamcloud - gitweb
Fix up Andreas's 8k blocksize changes to fix a number of bugs,
authorTheodore Ts'o <tytso@mit.edu>
Fri, 17 May 2002 14:53:07 +0000 (10:53 -0400)
committerTheodore Ts'o <tytso@mit.edu>
Fri, 17 May 2002 14:53:07 +0000 (10:53 -0400)
and to make the page size determined at run-time instead of
compile time.

ChangeLog
configure
configure.in
e2fsck/ChangeLog
e2fsck/pass1.c
e2fsck/super.c
lib/ext2fs/ChangeLog
misc/ChangeLog
misc/mke2fs.c

index 6bab07a..3a550fa 100644 (file)
--- a/ChangeLog
+++ b/ChangeLog
@@ -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
index f42d35a..e242e42 100644 (file)
--- a/configure
+++ b/configure
@@ -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
index 6bcc570..4670cc8 100644 (file)
@@ -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
index 9e2474b..f8795d9 100644 (file)
@@ -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
index 9d04114..8e04846 100644 (file)
@@ -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
index e57fd8b..c880a9a 100644 (file)
@@ -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,
index eda86e7..7569f2b 100644 (file)
@@ -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
index 3feabce..6bcf531 100644 (file)
@@ -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.
 
index 89b4f6b..3b44015 100644 (file)
@@ -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) {