From: Eric Sandeen <sandeen@redhat.com>
To: ext4 development <linux-ext4@vger.kernel.org>
Subject: [PATCH 1/2] e2fsprogs: turn off enforced fsck intervals by default
Date: Wed, 16 Feb 2011 12:14:33 -0600 [thread overview]
Message-ID: <4D5C1409.1030203@redhat.com> (raw)
In-Reply-To: <4D5C1380.2020602@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. Patch #1 disables the
intervals by default, and I've added a new mkfs option (-C) 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/ext2fs.h b/lib/ext2fs/ext2fs.h
index a204eb7..37584aa 100644
--- a/lib/ext2fs/ext2fs.h
+++ b/lib/ext2fs/ext2fs.h
@@ -184,6 +184,7 @@ typedef struct ext2_file *ext2_file_t;
#define EXT2_FLAG_64BITS 0x20000
#define EXT2_FLAG_PRINT_PROGRESS 0x40000
#define EXT2_FLAG_DIRECT_IO 0x80000
+#define EXT2_FLAG_MOUNT_FSCK_CHECK 0x100000
/*
* Special flag in the ext2 inode i_flag field that means that this is
diff --git a/lib/ext2fs/initialize.c b/lib/ext2fs/initialize.c
index 7c38975..ff63a92 100644
--- a/lib/ext2fs/initialize.c
+++ b/lib/ext2fs/initialize.c
@@ -155,7 +155,6 @@ 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_errors, EXT2_ERRORS_DEFAULT);
set_field(s_feature_compat, 0);
set_field(s_feature_incompat, 0);
@@ -189,7 +188,10 @@ 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);
+ if (flags & EXT2_FLAG_MOUNT_FSCK_CHECK) {
+ set_field(s_max_mnt_count, EXT2_DFL_MAX_MNT_COUNT);
+ set_field(s_checkinterval, EXT2_DFL_CHECKINTERVAL);
+ }
super->s_mkfs_time = super->s_lastcheck = fs->now ? fs->now : time(NULL);
super->s_creator_os = CREATOR_OS;
diff --git a/misc/mke2fs.8.in b/misc/mke2fs.8.in
index 2eead17..758307f 100644
--- a/misc/mke2fs.8.in
+++ b/misc/mke2fs.8.in
@@ -18,6 +18,9 @@ mke2fs \- create an ext2/ext3/ext4 filesystem
.I block-size
]
[
+.B \-C
+]
+[
.B \-f
.I fragment-size
]
@@ -184,6 +187,10 @@ Check the device for bad blocks before creating the file system. If
this option is specified twice, then a slower read-write
test is used instead of a fast read-only test.
.TP
+.B \-C
+Set maximum mount count and interval between checks, so that a full fsck
+will be enforced when these counts are exceeded.
+.TP
.BI \-E " extended-options"
Set extended options for the filesystem. Extended options are comma
separated, and may take an argument using the equals ('=') sign. The
diff --git a/misc/mke2fs.c b/misc/mke2fs.c
index 0ba4a4c..fdeafe3 100644
--- a/misc/mke2fs.c
+++ b/misc/mke2fs.c
@@ -80,6 +80,7 @@ const char * device_name /* = NULL */;
/* Command line options */
int cflag;
+int Cflag;
int verbose;
int quiet;
int super_only;
@@ -1228,7 +1229,7 @@ profile_error:
}
while ((c = getopt (argc, argv,
- "b:cf:g:G:i:jl:m:no:qr:s:t:vE:FI:J:KL:M:N:O:R:ST:U:V")) != EOF) {
+ "b:cf:g:G:i:jl:m:no:qr:s:t:vCE:FI:J:KL:M:N:O:R:ST:U:V")) != EOF) {
switch (c) {
case 'b':
blocksize = strtol(optarg, &tmp, 0);
@@ -1251,6 +1252,9 @@ profile_error:
case 'c': /* Check for bad blocks */
cflag++;
break;
+ case 'C': /* Set default check/fsck intervals */
+ Cflag++;
+ break;
case 'f':
size = strtoul(optarg, &tmp, 0);
if (size < EXT2_MIN_BLOCK_SIZE ||
@@ -2030,6 +2034,8 @@ int main (int argc, char *argv[])
*/
if (!quiet)
flags |= EXT2_FLAG_PRINT_PROGRESS;
+ if (Cflag)
+ flags |= EXT2_FLAG_MOUNT_FSCK_CHECK;
retval = ext2fs_initialize(device_name, flags, &fs_param, io_ptr, &fs);
if (retval) {
com_err(device_name, retval, _("while setting up superblock"));
@@ -2109,9 +2115,11 @@ int main (int argc, char *argv[])
* 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;
+ if (Cflag) {
+ 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
next prev parent reply other threads:[~2011-02-16 18:14 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 ` Eric Sandeen [this message]
2011-02-16 18:24 ` [PATCH 1/2] e2fsprogs: turn off enforced fsck intervals by default Lukas Czerner
2011-02-16 19:12 ` Amir Goldstein
2011-02-16 22:55 ` Ted Ts'o
2011-02-17 21:55 ` [PATCH 1/2 V2] " Eric Sandeen
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=4D5C1409.1030203@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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.