Linux Archive

Linux Archive (http://www.linux-archive.org/)
-   Cluster Development (http://www.linux-archive.org/cluster-development/)
-   -   GFS2: Sort the ordered write list (http://www.linux-archive.org/cluster-development/632963-gfs2-sort-ordered-write-list.html)

Bob Peterson 02-14-2012 06:49 PM

GFS2: Sort the ordered write list
 
Hi,

This patch sorts the ordered write list for GFS2 writes.
This increases the throughput for simultaneous writes.
For example, if you have ten processes, all doing:
dd if=/dev/zero of=/mnt/gfs2/fileX
on different files, the throughput will be much better.

Regards,

Bob Peterson
Red Hat File Systems

Signed-off-by: Bob Peterson <rpeterso@redhat.com>
--
GFS2: Sort the ordered write list

This patch sorts the ordered write list by block number to speed up
writes.

diff --git a/fs/gfs2/log.c b/fs/gfs2/log.c
index 4d31379..b8fe7b7 100644
--- a/fs/gfs2/log.c
+++ b/fs/gfs2/log.c
@@ -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"
@@ -566,6 +567,20 @@ 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;
@@ -573,6 +588,7 @@ static void gfs2_ordered_write(struct gfs2_sbd *sdp)
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);

Steven Whitehouse 02-14-2012 07:00 PM

GFS2: Sort the ordered write list
 
Hi,

Now in the -nmw git tree. Thanks,

Steve.

On Tue, 2012-02-14 at 14:49 -0500, Bob Peterson wrote:
> Hi,
>
> This patch sorts the ordered write list for GFS2 writes.
> This increases the throughput for simultaneous writes.
> For example, if you have ten processes, all doing:
> dd if=/dev/zero of=/mnt/gfs2/fileX
> on different files, the throughput will be much better.
>
> Regards,
>
> Bob Peterson
> Red Hat File Systems
>
> Signed-off-by: Bob Peterson <rpeterso@redhat.com>
> --
> GFS2: Sort the ordered write list
>
> This patch sorts the ordered write list by block number to speed up
> writes.
>
> diff --git a/fs/gfs2/log.c b/fs/gfs2/log.c
> index 4d31379..b8fe7b7 100644
> --- a/fs/gfs2/log.c
> +++ b/fs/gfs2/log.c
> @@ -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"
> @@ -566,6 +567,20 @@ 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;
> @@ -573,6 +588,7 @@ static void gfs2_ordered_write(struct gfs2_sbd *sdp)
> 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);

Steven Whitehouse 03-19-2012 09:25 AM

GFS2: Sort the ordered write list
 
From: Bob Peterson <rpeterso@redhat.com>

This patch sorts the ordered write list for GFS2 writes.
This increases the throughput for simultaneous writes.
For example, if you have ten processes, all doing:
dd if=/dev/zero of=/mnt/gfs2/fileX
on different files, the throughput will be much better.

Signed-off-by: Bob Peterson <rpeterso@redhat.com>
Signed-off-by: Steven Whitehouse <swhiteho@redhat.com>

diff --git a/fs/gfs2/log.c b/fs/gfs2/log.c
index 4d31379..b8fe7b7 100644
--- a/fs/gfs2/log.c
+++ b/fs/gfs2/log.c
@@ -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"
@@ -566,6 +567,20 @@ 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;
@@ -573,6 +588,7 @@ static void gfs2_ordered_write(struct gfs2_sbd *sdp)
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);
--
1.7.4


All times are GMT. The time now is 03:16 AM.

VBulletin, Copyright ©2000 - 2014, Jelsoft Enterprises Ltd.
Content Relevant URLs by vBSEO ©2007, Crawlability, Inc.