From: Alun <alun.linux@ty-penguin.org.uk>
To: Alexander Viro <viro@zeniv.linux.org.uk>
Cc: linux-fsdevel@vger.kernel.org, linux-kernel@vger.kernel.org
Subject: PATCH reduce impact of FIFREEZE on userland processes
Date: Wed, 5 Dec 2012 21:17:07 +0000 [thread overview]
Message-ID: <20121205211707.7ca3b94b@aspire.ty-penguin.org.uk> (raw)
This patch is against kernel version 3.7-rc7.
The FIFREEZE ioctl blocks userland writes, then calls sync_filesystem.
If there is a large amount of dirty data, this sync can take a
substantial time to complete, with corresponding loss of responsiveness
to any userland processes wishing to write.
This patch simply adds an extra call to sync_filesystem prior to
blocking writes, so that (hopefully) the majority of outstanding dirty
data has been flushed before we impact on userland.
I'm a complete kernel newbie and have only done some pretty minimal
testing on my own machine, but with the patch in place the impact of
running "fsfreeze -f" immediately followed by "fsfreeze -u" on a
moderately loaded filesystem (as measured by time taken for a write()
to complete) was reduced from 2.5 to 0.2 seconds. Hopefully there's no
subtlety in how all this works, and that adding the extra call has no
scary implications...
Signed-off-by: Alun Jones <alun.linux@ty-penguin.org.uk>
--- linux-3.7-rc7/fs/super.c.orig 2012-11-29 17:35:37.000000000
+0000 +++ linux-3.7-rc7/fs/super.c 2012-12-05 20:56:38.730631855
+0000 @@ -1314,6 +1314,11 @@ int freeze_super(struct super_block *sb)
return 0;
}
+ /* Sync before we block writes to reduce the amount of
+ * work that has to be done afterwards.
+ */
+ sync_filesystem(sb);
+
/* From now on, no new normal writers can start */
sb->s_writers.frozen = SB_FREEZE_WRITE;
smp_wmb();
next reply other threads:[~2012-12-05 22:26 UTC|newest]
Thread overview: 8+ messages / expand[flat|nested] mbox.gz Atom feed top
2012-12-05 21:17 Alun [this message]
2012-12-07 0:42 ` Dave Chinner
2012-12-07 8:59 ` Alun
2012-12-08 1:20 ` Dave Chinner
2012-12-08 8:47 ` Alun
2012-12-10 2:44 ` Dave Chinner
2012-12-08 12:12 ` Christoph Hellwig
2012-12-10 2:28 ` Dave Chinner
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=20121205211707.7ca3b94b@aspire.ty-penguin.org.uk \
--to=alun.linux@ty-penguin.org.uk \
--cc=linux-fsdevel@vger.kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=viro@zeniv.linux.org.uk \
/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
all inboxes | Powered by JetHome®