aboutsummaryrefslogtreecommitdiffstats
path: root/fs/gfs2
diff options
context:
space:
mode:
authorBenjamin Marzinski <bmarzins@redhat.com>2013-05-07 10:58:49 -0400
committerSteven Whitehouse <swhiteho@redhat.com>2013-06-05 04:50:20 -0400
commit7f63257da1aeea9b2ee68f469b0f9f4a39e5dff8 (patch)
tree1280ffbf443083b54e197163b1fe7102a7102bd6 /fs/gfs2
parent844ce9f2044723a9da0f4bce588cca410e774d24 (diff)
GFS2: Sort buffer lists by inplace block number
This patch simply sort the data and metadata buffer lists by their inplace block number. This makes gfs2_log_flush issue the inplace IO in sequential order, which will hopefully speed up writing the IO out to disk. Signed-off-by: Benjamin Marzinski <bmarzins@redhat.com> Signed-off-by: Steven Whitehouse <swhiteho@redhat.com>
Diffstat (limited to 'fs/gfs2')
-rw-r--r--fs/gfs2/lops.c16
1 files changed, 16 insertions, 0 deletions
diff --git a/fs/gfs2/lops.c b/fs/gfs2/lops.c
index 6c33d7b6e0c4..cb017a692fe6 100644
--- a/fs/gfs2/lops.c
+++ b/fs/gfs2/lops.c
@@ -16,6 +16,7 @@
16#include <linux/gfs2_ondisk.h> 16#include <linux/gfs2_ondisk.h>
17#include <linux/bio.h> 17#include <linux/bio.h>
18#include <linux/fs.h> 18#include <linux/fs.h>
19#include <linux/list_sort.h>
19 20
20#include "gfs2.h" 21#include "gfs2.h"
21#include "incore.h" 22#include "incore.h"
@@ -401,6 +402,20 @@ static void gfs2_check_magic(struct buffer_head *bh)
401 kunmap_atomic(kaddr); 402 kunmap_atomic(kaddr);
402} 403}
403 404
405static int blocknr_cmp(void *priv, struct list_head *a, struct list_head *b)
406{
407 struct gfs2_bufdata *bda, *bdb;
408
409 bda = list_entry(a, struct gfs2_bufdata, bd_list);
410 bdb = list_entry(b, struct gfs2_bufdata, bd_list);
411
412 if (bda->bd_bh->b_blocknr < bdb->bd_bh->b_blocknr)
413 return -1;
414 if (bda->bd_bh->b_blocknr > bdb->bd_bh->b_blocknr)
415 return 1;
416 return 0;
417}
418
404static void gfs2_before_commit(struct gfs2_sbd *sdp, unsigned int limit, 419static void gfs2_before_commit(struct gfs2_sbd *sdp, unsigned int limit,
405 unsigned int total, struct list_head *blist, 420 unsigned int total, struct list_head *blist,
406 bool is_databuf) 421 bool is_databuf)
@@ -413,6 +428,7 @@ static void gfs2_before_commit(struct gfs2_sbd *sdp, unsigned int limit,
413 __be64 *ptr; 428 __be64 *ptr;
414 429
415 gfs2_log_lock(sdp); 430 gfs2_log_lock(sdp);
431 list_sort(NULL, blist, blocknr_cmp);
416 bd1 = bd2 = list_prepare_entry(bd1, blist, bd_list); 432 bd1 = bd2 = list_prepare_entry(bd1, blist, bd_list);
417 while(total) { 433 while(total) {
418 num = total; 434 num = total;