Skip to content

Commit

Permalink
---
Browse files Browse the repository at this point in the history
yaml
---
r: 292390
b: refs/heads/master
c: 4a36d08
h: refs/heads/master
v: v3
  • Loading branch information
Bob Peterson authored and Steven Whitehouse committed Feb 28, 2012
1 parent 3cad7d9 commit a5e969f
Show file tree
Hide file tree
Showing 2 changed files with 17 additions and 1 deletion.
2 changes: 1 addition & 1 deletion [refs]
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
---
refs/heads/master: 66fc061bda3526650328b73f69985da3518c4256
refs/heads/master: 4a36d08d0d1cba0581d1656739102ce936f26557
16 changes: 16 additions & 0 deletions trunk/fs/gfs2/log.c
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@
#include <linux/freezer.h>
#include <linux/bio.h>
#include <linux/writeback.h>
#include <linux/list_sort.h>

#include "gfs2.h"
#include "incore.h"
Expand Down Expand Up @@ -566,13 +567,28 @@ static void log_flush_commit(struct gfs2_sbd *sdp)
log_write_header(sdp, 0, 0);
}

int bd_cmp(void *priv, struct list_head *a, struct list_head *b)
{
struct gfs2_bufdata *bda, *bdb;

bda = list_entry(a, struct gfs2_bufdata, bd_le.le_list);
bdb = list_entry(b, struct gfs2_bufdata, bd_le.le_list);

if (bda->bd_bh->b_blocknr < bdb->bd_bh->b_blocknr)
return -1;
if (bda->bd_bh->b_blocknr > bdb->bd_bh->b_blocknr)
return 1;
return 0;
}

static void gfs2_ordered_write(struct gfs2_sbd *sdp)
{
struct gfs2_bufdata *bd;
struct buffer_head *bh;
LIST_HEAD(written);

gfs2_log_lock(sdp);
list_sort(NULL, &sdp->sd_log_le_ordered, &bd_cmp);
while (!list_empty(&sdp->sd_log_le_ordered)) {
bd = list_entry(sdp->sd_log_le_ordered.next, struct gfs2_bufdata, bd_le.le_list);
list_move(&bd->bd_le.le_list, &written);
Expand Down

0 comments on commit a5e969f

Please sign in to comment.