From: Olaf Kirch <okir@suse.de>
Subject: Do not call shrink_dcache_sb when remounting procfs etc
Patch-mainline: Not yet
References: 165672
Patch-mainline: not yet
Avoid calls to shrink_dcache_sb when mounting a file system that
uses get_sb_single. shrink_dcache_sb is costly. On large ia64
systems, this will keep the dcache lock for > 60 seconds at
a stretch.
Signed-off-by: Olaf Kirch <okir@suse.de>
fs/super.c | 38 ++++++++++++++++++++++++--------------
1 file changed, 24 insertions(+), 14 deletions(-)
--- a/fs/super.c
+++ b/fs/super.c
@@ -687,16 +687,10 @@ rescan:
return NULL;
}
-/**
- * do_remount_sb - asks filesystem to change mount options.
- * @sb: superblock in question
- * @flags: numeric part of options
- * @data: the rest of options
- * @force: whether or not to force the change
- *
- * Alters the mount options of a mounted file system.
- */
-int do_remount_sb(struct super_block *sb, int flags, void *data, int force)
+#define REMOUNT_FORCE 1
+#define REMOUNT_SHRINK_DCACHE 2
+
+static int __do_remount_sb(struct super_block *sb, int flags, void *data, int rflags)
{
int retval;
int remount_ro;
@@ -711,7 +705,8 @@ int do_remount_sb(struct super_block *sb
if (flags & MS_RDONLY)
acct_auto_close(sb);
- shrink_dcache_sb(sb);
+ if (rflags & REMOUNT_SHRINK_DCACHE)
+ shrink_dcache_sb(sb);
sync_filesystem(sb);
remount_ro = (flags & MS_RDONLY) && !(sb->s_flags & MS_RDONLY);
@@ -719,7 +714,7 @@ int do_remount_sb(struct super_block *sb
/* If we are remounting RDONLY and current sb is read/write,
make sure there are no rw files opened */
if (remount_ro) {
- if (force) {
+ if (rflags & REMOUNT_FORCE) {
mark_files_ro(sb);
} else {
retval = sb_prepare_remount_readonly(sb);
@@ -728,7 +723,7 @@ int do_remount_sb(struct super_block *sb
if (sb->s_op->remount_fs) {
retval = sb->s_op->remount_fs(sb, &flags, data);
if (retval) {
- if (!force)
+ if (!(rflags & REMOUNT_FORCE))
goto cancel_readonly;
/* If forced remount, go ahead despite any errors */
WARN(1, "forced remount of a %s fs returned %i\n",
@@ -750,6 +745,21 @@ int do_remount_sb(struct super_block *sb
return retval;
}
+/**
+ * do_remount_sb - asks filesystem to change mount options.
+ * @sb: superblock in question
+ * @flags: numeric part of options
+ * @data: the rest of options
+ * @force: whether or not to force the change
+ *
+ * Alters the mount options of a mounted file system.
+ */
+int do_remount_sb(struct super_block *sb, int flags, void *data, int force)
+{
+ return __do_remount_sb(sb, flags, data,
+ REMOUNT_SHRINK_DCACHE|(force? REMOUNT_FORCE : 0));
+}
+
static void do_emergency_remount(struct work_struct *work)
{
struct super_block *sb, *p = NULL;
@@ -1065,7 +1075,7 @@ struct dentry *mount_single(struct file_
}
s->s_flags |= MS_ACTIVE;
} else {
- do_remount_sb(s, flags, data, 0);
+ __do_remount_sb(s, flags, data, 0);
}
return dget(s->s_root);
}