Commit 885bceca authored by Steven Whitehouse's avatar Steven Whitehouse

GFS2: Plug on AIL flush

When we do a flush of the AIL list, we are writing out what is
likely to be a lot of small I/Os, which are possibly in an order
which is not ideal performance-wise. Since this is done by calling
filemap_fdatatwrite for each individual inode's address space there
is no overall plugging going on.

In addition to that, we do not always wait for AIL i/o when we flush
it, so that it is possible for things to get left behind on the queue.
By adding explicit plugging here, we reduce the chances of this
being an issues. A quick test using the AIL flush tracepoint shows a
small, but measurable improvement.
Signed-off-by: default avatarSteven Whitehouse <swhiteho@redhat.com>
parent 38dbfb59
...@@ -18,6 +18,7 @@ ...@@ -18,6 +18,7 @@
#include <linux/kthread.h> #include <linux/kthread.h>
#include <linux/freezer.h> #include <linux/freezer.h>
#include <linux/bio.h> #include <linux/bio.h>
#include <linux/blkdev.h>
#include <linux/writeback.h> #include <linux/writeback.h>
#include <linux/list_sort.h> #include <linux/list_sort.h>
...@@ -145,8 +146,10 @@ void gfs2_ail1_flush(struct gfs2_sbd *sdp, struct writeback_control *wbc) ...@@ -145,8 +146,10 @@ void gfs2_ail1_flush(struct gfs2_sbd *sdp, struct writeback_control *wbc)
{ {
struct list_head *head = &sdp->sd_ail1_list; struct list_head *head = &sdp->sd_ail1_list;
struct gfs2_trans *tr; struct gfs2_trans *tr;
struct blk_plug plug;
trace_gfs2_ail_flush(sdp, wbc, 1); trace_gfs2_ail_flush(sdp, wbc, 1);
blk_start_plug(&plug);
spin_lock(&sdp->sd_ail_lock); spin_lock(&sdp->sd_ail_lock);
restart: restart:
list_for_each_entry_reverse(tr, head, tr_list) { list_for_each_entry_reverse(tr, head, tr_list) {
...@@ -156,6 +159,7 @@ void gfs2_ail1_flush(struct gfs2_sbd *sdp, struct writeback_control *wbc) ...@@ -156,6 +159,7 @@ void gfs2_ail1_flush(struct gfs2_sbd *sdp, struct writeback_control *wbc)
goto restart; goto restart;
} }
spin_unlock(&sdp->sd_ail_lock); spin_unlock(&sdp->sd_ail_lock);
blk_finish_plug(&plug);
trace_gfs2_ail_flush(sdp, wbc, 0); trace_gfs2_ail_flush(sdp, wbc, 0);
} }
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment