diff options
author | Theodore Ts'o <tytso@mit.edu> | 2018-02-26 21:54:42 -0500 |
---|---|---|
committer | Theodore Ts'o <tytso@mit.edu> | 2018-02-26 21:54:42 -0500 |
commit | fbfe156112b9f7d8a105f45900d0fffb7d5003af (patch) | |
tree | 3436bf1806183223409668444ef47a71fa6d4d36 | |
parent | f5488ffb877713cca25fbfcbb613d32b8d38f85a (diff) | |
download | android_external_e2fsprogs-fbfe156112b9f7d8a105f45900d0fffb7d5003af.tar.gz android_external_e2fsprogs-fbfe156112b9f7d8a105f45900d0fffb7d5003af.tar.bz2 android_external_e2fsprogs-fbfe156112b9f7d8a105f45900d0fffb7d5003af.zip |
mke2fs: use io_channel_flush() instead of sync() for sync_kludge
Also add support so that sync_kludge can be set via /etc/mke2fs.conf.
Signed-off-by: Theodore Ts'o <tytso@mit.edu>
-rw-r--r-- | misc/mke2fs.c | 14 | ||||
-rw-r--r-- | misc/mke2fs.conf.5.in | 15 |
2 files changed, 20 insertions, 9 deletions
diff --git a/misc/mke2fs.c b/misc/mke2fs.c index 8e13a95d..3fb5cc49 100644 --- a/misc/mke2fs.c +++ b/misc/mke2fs.c @@ -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); diff --git a/misc/mke2fs.conf.5.in b/misc/mke2fs.conf.5.in index cbd1700a..c086b411 100644 --- a/misc/mke2fs.conf.5.in +++ b/misc/mke2fs.conf.5.in @@ -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] |