summaryrefslogtreecommitdiff
path: root/misc/mke2fs.c
diff options
context:
space:
mode:
authorTheodore Ts'o <tytso@mit.edu>2011-02-20 21:54:43 -0500
committerTheodore Ts'o <tytso@mit.edu>2011-02-20 21:54:43 -0500
commit214580a339a18b0539b5998d3b47934956a30a1c (patch)
treee32d439027d14735d44372e01450e6d02e9c6447 /misc/mke2fs.c
parent175d43beada4f5c971fa4b495380620644705282 (diff)
parent855a77a19704ef7e0acd542cce19a6e8ee07582d (diff)
downloade2fsprogs-214580a339a18b0539b5998d3b47934956a30a1c.tar.gz
Merge branch 'maint' into next
Conflicts: misc/mke2fs.conf.5.in
Diffstat (limited to 'misc/mke2fs.c')
-rw-r--r--misc/mke2fs.c49
1 files changed, 43 insertions, 6 deletions
diff --git a/misc/mke2fs.c b/misc/mke2fs.c
index 0ba4a4ce..2978b028 100644
--- a/misc/mke2fs.c
+++ b/misc/mke2fs.c
@@ -829,6 +829,18 @@ static void edit_feature(const char *str, __u32 *compat_array)
}
}
+static void edit_mntopts(const char *str, __u32 *mntopts)
+{
+ if (!str)
+ return;
+
+ if (e2p_edit_mntopts(str, mntopts, ~0)) {
+ fprintf(stderr, _("Invalid mount option set: %s\n"),
+ str);
+ exit(1);
+ }
+}
+
struct str_list {
char **list;
int num;
@@ -1562,6 +1574,13 @@ profile_error:
edit_feature(tmp, &fs_param.s_feature_compat);
free(tmp);
+ /* And which mount options as well */
+ tmp = get_string_from_profile(fs_types, "default_mntopts",
+ "acl,user_xattr");
+ edit_mntopts(tmp, &fs_param.s_default_mount_opts);
+ if (tmp)
+ free(tmp);
+
for (cpp = fs_types; *cpp; cpp++) {
tmp = NULL;
profile_get_string(profile, "fs_types", *cpp,
@@ -2105,13 +2124,31 @@ int main (int argc, char *argv[])
uuid_generate((unsigned char *) fs->super->s_hash_seed);
/*
- * Add "jitter" to the superblock's check interval so that we
- * don't check all the filesystems at the same time. We use a
- * kludgy hack of using the UUID to derive a random jitter value.
+ * Periodic checks can be enabled/disabled via config file.
+ * Note we override the kernel include file's idea of what the default
+ * check interval (never) should be. It's a good idea to check at
+ * least *occasionally*, specially since servers will never rarely get
+ * to reboot, since Linux is so robust these days. :-)
+ *
+ * 180 days (six months) seems like a good value.
*/
- for (i = 0, val = 0 ; i < sizeof(fs->super->s_uuid); i++)
- val += fs->super->s_uuid[i];
- fs->super->s_max_mnt_count += val % EXT2_DFL_MAX_MNT_COUNT;
+#ifdef EXT2_DFL_CHECKINTERVAL
+#undef EXT2_DFL_CHECKINTERVAL
+#endif
+#define EXT2_DFL_CHECKINTERVAL (86400L * 180L)
+
+ if (get_bool_from_profile(fs_types, "enable_periodic_fsck", 0)) {
+ fs->super->s_checkinterval = EXT2_DFL_CHECKINTERVAL;
+ fs->super->s_max_mnt_count = EXT2_DFL_MAX_MNT_COUNT;
+ /*
+ * Add "jitter" to the superblock's check interval so that we
+ * don't check all the filesystems at the same time. We use a
+ * kludgy hack of using the UUID to derive a random jitter value
+ */
+ for (i = 0, val = 0 ; i < sizeof(fs->super->s_uuid); i++)
+ val += fs->super->s_uuid[i];
+ fs->super->s_max_mnt_count += val % EXT2_DFL_MAX_MNT_COUNT;
+ }
/*
* Override the creator OS, if applicable