aboutsummaryrefslogtreecommitdiffstats
path: root/fs
diff options
context:
space:
mode:
Diffstat (limited to 'fs')
-rw-r--r--fs/gfs2/log.c16
1 files changed, 16 insertions, 0 deletions
diff --git a/fs/gfs2/log.c b/fs/gfs2/log.c
index 4d31379265cb..b8fe7b739c27 100644
--- a/fs/gfs2/log.c
+++ b/fs/gfs2/log.c
@@ -19,6 +19,7 @@
19#include <linux/freezer.h> 19#include <linux/freezer.h>
20#include <linux/bio.h> 20#include <linux/bio.h>
21#include <linux/writeback.h> 21#include <linux/writeback.h>
22#include <linux/list_sort.h>
22 23
23#include "gfs2.h" 24#include "gfs2.h"
24#include "incore.h" 25#include "incore.h"
@@ -566,6 +567,20 @@ static void log_flush_commit(struct gfs2_sbd *sdp)
566 log_write_header(sdp, 0, 0); 567 log_write_header(sdp, 0, 0);
567} 568}
568 569
570int bd_cmp(void *priv, struct list_head *a, struct list_head *b)
571{
572 struct gfs2_bufdata *bda, *bdb;
573
574 bda = list_entry(a, struct gfs2_bufdata, bd_le.le_list);
575 bdb = list_entry(b, struct gfs2_bufdata, bd_le.le_list);
576
577 if (bda->bd_bh->b_blocknr < bdb->bd_bh->b_blocknr)
578 return -1;
579 if (bda->bd_bh->b_blocknr > bdb->bd_bh->b_blocknr)
580 return 1;
581 return 0;
582}
583
569static void gfs2_ordered_write(struct gfs2_sbd *sdp) 584static void gfs2_ordered_write(struct gfs2_sbd *sdp)
570{ 585{
571 struct gfs2_bufdata *bd; 586 struct gfs2_bufdata *bd;
@@ -573,6 +588,7 @@ static void gfs2_ordered_write(struct gfs2_sbd *sdp)
573 LIST_HEAD(written); 588 LIST_HEAD(written);
574 589
575 gfs2_log_lock(sdp); 590 gfs2_log_lock(sdp);
591 list_sort(NULL, &sdp->sd_log_le_ordered, &bd_cmp);
576 while (!list_empty(&sdp->sd_log_le_ordered)) { 592 while (!list_empty(&sdp->sd_log_le_ordered)) {
577 bd = list_entry(sdp->sd_log_le_ordered.next, struct gfs2_bufdata, bd_le.le_list); 593 bd = list_entry(sdp->sd_log_le_ordered.next, struct gfs2_bufdata, bd_le.le_list);
578 list_move(&bd->bd_le.le_list, &written); 594 list_move(&bd->bd_le.le_list, &written);