linux-ext4.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Eric Sandeen <sandeen@redhat.com>
To: ext4 development <linux-ext4@vger.kernel.org>
Subject: [PATCH 1/2 V2] e2fsprogs: turn off enforced fsck intervals by default
Date: Thu, 17 Feb 2011 15:55:15 -0600	[thread overview]
Message-ID: <4D5D9943.70901@redhat.com> (raw)
In-Reply-To: <4D5C1409.1030203@redhat.com>

The forced fsck often comes at unexpected and inopportune moments,
and even enterprise customers are often caught by surprise when 
this happens.  Because a filesystem with an error condition will 
be marked as requiring fsck anyway, I submit that the time-based 
and mount-based checks are not particularly useful, and that 
administrators can schedule fscks on their own time, or tune2fs 
the enforced intervals if they so choose.  This patch disables the 
intervals by default, and I've added a new mkfs.conf option to 
turn on the old behavior of random, unexpected, time-consuming
fscks at boot time.  ;)

Signed-off-by: Eric Sandeen <sandeen@redhat.com>
---

diff --git a/lib/ext2fs/initialize.c b/lib/ext2fs/initialize.c
index 7c38975..1d2927c 100644
--- a/lib/ext2fs/initialize.c
+++ b/lib/ext2fs/initialize.c
@@ -46,19 +46,6 @@
 #endif /* defined(__linux__)   && defined(EXT2_OS_LINUX) */
 
 /*
- * 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.
- */
-#ifdef EXT2_DFL_CHECKINTERVAL
-#undef EXT2_DFL_CHECKINTERVAL
-#endif
-#define EXT2_DFL_CHECKINTERVAL (86400L * 180L)
-
-/*
  * Calculate the number of GDT blocks to reserve for online filesystem growth.
  * The absolute maximum number of GDT blocks we can reserve is determined by
  * the number of block pointers that can fit into a single block.
@@ -155,7 +142,7 @@ errcode_t ext2fs_initialize(const char *name, int flags,
 	set_field(s_log_block_size, 0);	/* default blocksize: 1024 bytes */
 	set_field(s_log_frag_size, 0); /* default fragsize: 1024 bytes */
 	set_field(s_first_data_block, super->s_log_block_size ? 0 : 1);
-	set_field(s_max_mnt_count, EXT2_DFL_MAX_MNT_COUNT);
+	set_field(s_max_mnt_count, 0);
 	set_field(s_errors, EXT2_ERRORS_DEFAULT);
 	set_field(s_feature_compat, 0);
 	set_field(s_feature_incompat, 0);
@@ -189,7 +176,7 @@ errcode_t ext2fs_initialize(const char *name, int flags,
 		super->s_inode_size = EXT2_GOOD_OLD_INODE_SIZE;
 	}
 
-	set_field(s_checkinterval, EXT2_DFL_CHECKINTERVAL);
+	set_field(s_checkinterval, 0);
 	super->s_mkfs_time = super->s_lastcheck = fs->now ? fs->now : time(NULL);
 
 	super->s_creator_os = CREATOR_OS;
diff --git a/misc/mke2fs.c b/misc/mke2fs.c
index 0ba4a4c..2910e6e 100644
--- a/misc/mke2fs.c
+++ b/misc/mke2fs.c
@@ -2105,13 +2105,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
diff --git a/misc/mke2fs.conf b/misc/mke2fs.conf
index a7dd1c7..a96251e 100644
--- a/misc/mke2fs.conf
+++ b/misc/mke2fs.conf
@@ -1,5 +1,6 @@
 [defaults]
 	base_features = sparse_super,filetype,resize_inode,dir_index,ext_attr
+	enable_periodic_fsck = 0
 	blocksize = 4096
 	inode_size = 256
 	inode_ratio = 16384
diff --git a/misc/mke2fs.conf.5.in b/misc/mke2fs.conf.5.in
index e9913cb..1e777cd 100644
--- a/misc/mke2fs.conf.5.in
+++ b/misc/mke2fs.conf.5.in
@@ -107,6 +107,17 @@ command-line option
 to 
 .BR mke2fs (8).
 .TP
+.I enable_periodic_fsck
+This relation specifies whether periodic filesystem checks should be
+enforced at boot time.  If enabled, checks will be forced every
+180 days, or after a random number of mounts.  These values may
+be changed later via the
+.B -i
+and
+.B -c
+command-line options to
+.BR tune2fs (8).
+.TP
 .I force_undo
 This relation, if set to a boolean value of true, forces
 .B mke2fs


  parent reply	other threads:[~2011-02-17 21:55 UTC|newest]

Thread overview: 19+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2011-02-16 18:12 [PATCH 0/2] e2fsprogs: update mkfs defaults Eric Sandeen
2011-02-16 18:14 ` [PATCH 1/2] e2fsprogs: turn off enforced fsck intervals by default Eric Sandeen
2011-02-16 18:24   ` Lukas Czerner
2011-02-16 19:12     ` Amir Goldstein
2011-02-16 22:55   ` Ted Ts'o
2011-02-17 21:55   ` Eric Sandeen [this message]
2011-02-16 18:21 ` [PATCH 2/2] e2fsprogs: enable user namespace xattrs " Eric Sandeen
2011-02-16 19:15   ` Andreas Dilger
2011-02-16 19:27     ` Eric Sandeen
2011-02-16 21:49       ` Ted Ts'o
2011-02-16 21:53         ` Eric Sandeen
2011-02-16 22:56           ` Ted Ts'o
2011-02-16 22:58             ` Eric Sandeen
2011-02-16 23:01               ` Ted Ts'o
2011-02-17 21:56   ` [PATCH 2/2 V2] " Eric Sandeen
2011-02-20 23:31     ` Ted Ts'o
2011-02-21 17:00       ` Eric Sandeen
2011-02-16 22:12 ` [PATCH 0/2] e2fsprogs: update mkfs defaults Andreas Dilger
2011-02-16 22:37   ` Eric Sandeen

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=4D5D9943.70901@redhat.com \
    --to=sandeen@redhat.com \
    --cc=linux-ext4@vger.kernel.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).