lkml.org 
[lkml]   [2012]   [Dec]   [5]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
Patch in this message
/
Date
From
SubjectPATCH reduce impact of FIFREEZE on userland processes

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();

\
 
 \ /
  Last update: 2012-12-06 00:01    [W:0.083 / U:0.540 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site