]> git.ipfire.org Git - thirdparty/e2fsprogs.git/commitdiff
mke2fs: use io_channel_flush() instead of sync() for sync_kludge
authorTheodore Ts'o <tytso@mit.edu>
Tue, 27 Feb 2018 02:54:42 +0000 (21:54 -0500)
committerTheodore Ts'o <tytso@mit.edu>
Tue, 27 Feb 2018 02:54:42 +0000 (21:54 -0500)
Also add support so that sync_kludge can be set via /etc/mke2fs.conf.

Signed-off-by: Theodore Ts'o <tytso@mit.edu>
misc/mke2fs.c
misc/mke2fs.conf.5.in

index 8e13a95dc0345aa1911f822e9c99bfc5507a87d7..3fb5cc49b1d25d44f2824329a3fa6919a0088bb6 100644 (file)
@@ -441,9 +441,9 @@ static void write_inode_tables(ext2_filsys fs, int lazy_flag, int itable_zeroed)
                }
                if (sync_kludge) {
                        if (sync_kludge == 1)
-                               sync();
+                               io_channel_flush(fs->io);
                        else if ((i % sync_kludge) == 0)
-                               sync();
+                               io_channel_flush(fs->io);
                }
        }
        ext2fs_numeric_progress_close(fs, &progress,
@@ -1526,10 +1526,6 @@ static void PRS(int argc, char *argv[])
        }
        putenv (newpath);
 
-       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))
@@ -1892,6 +1888,12 @@ profile_error:
        if (optind < argc)
                usage();
 
+       profile_get_integer(profile, "options", "sync_kludge", 0, 0,
+                           &sync_kludge);
+       tmp = getenv("MKE2FS_SYNC");
+       if (tmp)
+               sync_kludge = atoi(tmp);
+
        profile_get_integer(profile, "options", "proceed_delay", 0, 0,
                            &proceed_delay);
 
index cbd1700a2372a9b6f44f9904a5f11f4ba24be973..c086b4113b50a729069b3af8a4a90f29e0700272 100644 (file)
@@ -98,12 +98,21 @@ The following relations are defined in the
 stanza.
 .TP
 .I proceed_delay
-If this relation is set to a positive integer, then if mke2fs will
-proceed after waiting
+If this relation is set to a positive integer, then mke2fs will
+wait
 .I proceed_delay
-seconds, after asking the user for permission to proceed, even if the
+seconds after asking the user for permission to proceed and
+then continue, even if the
 user has not answered the question.  Defaults to 0, which means to wait
 until the user answers the question one way or another.
+.TP
+.I sync_kludge
+If this relation is set to a positive integer, then while writing the
+inode table, mke2fs will request the operating system flush out pending
+writes to initialize the inode table every
+.I sync_kludge
+block groups.   This is needed to work around buggy kernels that don't
+handle writeback throttling correctly.
 .SH THE [defaults] STANZA
 The following relations are defined in the
 .I [defaults]