From: Steven Whitehouse <swhiteho@redhat.com>
To: cluster-devel.redhat.com
Subject: [Cluster-devel] [GFS2 Patch] GFS2: Sort the ordered write list
Date: Tue, 14 Feb 2012 20:00:34 +0000 [thread overview]
Message-ID: <1329249634.2702.20.camel@menhir> (raw)
In-Reply-To: <a04f2bca-a32c-4865-a935-a7db4a01f96b@zmail12.collab.prod.int.phx2.redhat.com>
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);
prev parent reply other threads:[~2012-02-14 20:00 UTC|newest]
Thread overview: 2+ messages / expand[flat|nested] mbox.gz Atom feed top
[not found] <48b5faec-d650-4157-a59d-a5125256a771@zmail12.collab.prod.int.phx2.redhat.com>
2012-02-14 19:49 ` [Cluster-devel] [GFS2 Patch] GFS2: Sort the ordered write list Bob Peterson
2012-02-14 20:00 ` Steven Whitehouse [this message]
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=1329249634.2702.20.camel@menhir \
--to=swhiteho@redhat.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).