Whamcloud - gitweb
Only use blocksizes > 4k on Linux 2.6 and newer systems.
authorTheodore Ts'o <tytso@mit.edu>
Sat, 25 Sep 2004 11:40:12 +0000 (07:40 -0400)
committerTheodore Ts'o <tytso@mit.edu>
Sat, 25 Sep 2004 11:40:12 +0000 (07:40 -0400)
(Addresses Debian Bug #271064)

debian/changelog
misc/ChangeLog
misc/mke2fs.c

index 3da4cf5..1448660 100644 (file)
@@ -5,10 +5,11 @@ e2fsprogs (1.35-8) unstable; urgency=low
   * Make sure the configure files are newer than configure.in the
        debian/rules file so that a dpkg-source created patch won't
        trigger an attempt rebuild of the configure script.  (Closes: #272558)
-  * Make sure /usr/lib/e2initrd_helper is in the e2fsprogs package.  
-       (Closes: #272698)
+  * Make sure /usr/lib/e2initrd_helper is in the e2fsprogs package.
+       (Closes: #272698, #272728, #273161, #273163)
+  * Only use blocksizes > 4k on Linux 2.6 and newer systems.  (Closes: #271064)
 
- -- Theodore Y. Ts'o <tytso@mit.edu>  Fri, 24 Sep 2004 12:12:44 -0400
+ -- Theodore Y. Ts'o <tytso@mit.edu>  Sat, 25 Sep 2004 07:37:52 -0400
 
 e2fsprogs (1.35-7) unstable; urgency=low
 
index f35d5a8..82579c3 100644 (file)
@@ -1,3 +1,8 @@
+2004-09-25  Theodore Ts'o  <tytso@mit.edu>
+
+       * mke2fs.c (set_fs_defaults): Only use blocksizes > 4k on Linux
+               2.6 and newer systems.  (Addresses Debian Bug #271064)
+
 2004-09-24  Theodore Ts'o  <tytso@mit.edu>
 
        * lsattr.c (lsattr_dir_proc): Avoid double // when listing the
index fd912c9..fcc9eec 100644 (file)
@@ -85,6 +85,7 @@ char *journal_device;
 int sync_kludge;       /* Set using the MKE2FS_SYNC env. option */
 
 int sys_page_size = 4096;
+int linux_version_code = 0;
 
 static void usage(void)
 {
@@ -119,6 +120,30 @@ static int int_log10(unsigned int arg)
        return l;
 }
 
+static int parse_version_number(const char *s)
+{
+       int     major, minor, rev;
+       char    *endptr;
+       const char *cp = s;
+
+       if (!s)
+               return 0;
+       major = strtol(cp, &endptr, 10);
+       if (cp == endptr || *endptr != '.')
+               return 0;
+       cp = endptr + 1;
+       minor = strtol(cp, &endptr, 10);
+       if (cp == endptr || *endptr != '.')
+               return 0;
+       cp = endptr + 1;
+       rev = strtol(cp, &endptr, 10);
+       if (cp == endptr)
+               return 0;
+       return ((((major * 256) + minor) * 256) + rev);
+}
+
+
+
 /*
  * This function sets the default parameters for a filesystem
  *
@@ -172,8 +197,12 @@ static void set_fs_defaults(const char *fs_type,
                use_bsize = p->blocksize;
        }
        if (blocksize <= 0) {
-               if (use_bsize == DEF_MAX_BLOCKSIZE)
+               if (use_bsize == DEF_MAX_BLOCKSIZE) {
                        use_bsize = sys_page_size;
+                       if ((linux_version_code < (2*65536 + 6*256)) &&
+                           (use_bsize > 4096))
+                               use_bsize = 4096;
+               }
                if (sector_size && use_bsize < sector_size)
                        use_bsize = sector_size;
                if ((blocksize < 0) && (use_bsize < (-blocksize)))
@@ -868,9 +897,8 @@ static void PRS(int argc, char *argv[])
                perror("uname");
                exit(1);
        }
-       if ((ut.release[0] == '1') ||
-           (ut.release[0] == '2' && ut.release[1] == '.' &&
-            ut.release[2] < '2' && ut.release[3] == '.')) {
+       linux_version_code = parse_version_number(ut.release);
+       if (linux_version_code && linux_version_code < (2*65536 + 2*256)) {
                param.s_rev_level = 0;
                param.s_feature_incompat = 0;
                param.s_feature_compat = 0;