linux-xfs.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Christoph Hellwig <hch@lst.de>
To: linux-xfs@vger.kernel.org
Subject: [PATCH 4/5] xfs: improve busy extent sorting
Date: Tue,  7 Feb 2017 18:15:00 +0100	[thread overview]
Message-ID: <20170207171501.4268-5-hch@lst.de> (raw)
In-Reply-To: <20170207171501.4268-1-hch@lst.de>

Sort busy extents by the full block number instead of just the AGNO so
that we can issue consecutive discard requests that the block layer could
merge (although we'll need additional block layer fixes for fast devices).

Signed-off-by: Christoph Hellwig <hch@lst.de>
---
 fs/xfs/xfs_extent_busy.c | 16 ++++++++++++----
 1 file changed, 12 insertions(+), 4 deletions(-)

diff --git a/fs/xfs/xfs_extent_busy.c b/fs/xfs/xfs_extent_busy.c
index 4d850e27095e..ab062610234e 100644
--- a/fs/xfs/xfs_extent_busy.c
+++ b/fs/xfs/xfs_extent_busy.c
@@ -656,9 +656,17 @@ xfs_extent_busy_wait_all(
 int
 xfs_extent_busy_ag_cmp(
 	void			*priv,
-	struct list_head	*a,
-	struct list_head	*b)
+	struct list_head	*l1,
+	struct list_head	*l2)
 {
-	return container_of(a, struct xfs_extent_busy, list)->agno -
-		container_of(b, struct xfs_extent_busy, list)->agno;
+	struct xfs_extent_busy	*b1 =
+		container_of(l1, struct xfs_extent_busy, list);
+	struct xfs_extent_busy	*b2 =
+		container_of(l2, struct xfs_extent_busy, list);
+	s32 diff;
+
+	diff = b1->agno - b2->agno;
+	if (!diff)
+		diff = b1->bno - b2->bno;
+	return diff;
 }
-- 
2.11.0


  parent reply	other threads:[~2017-02-07 17:16 UTC|newest]

Thread overview: 9+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2017-02-07 17:14 improve busy extent handling and add async discard support V3 Christoph Hellwig
2017-02-07 17:14 ` [PATCH 1/5] xfs: don't fail xfs_extent_busy allocation Christoph Hellwig
2017-02-07 17:14 ` [PATCH 2/5] xfs: improve handling of busy extents in the low-level allocator Christoph Hellwig
2017-02-07 17:14 ` [PATCH 3/5] " Christoph Hellwig
2017-02-07 21:51   ` Darrick J. Wong
2017-02-07 22:21     ` Christoph Hellwig
2017-02-07 17:15 ` Christoph Hellwig [this message]
2017-02-07 22:01   ` [PATCH 4/5] xfs: improve busy extent sorting Darrick J. Wong
2017-02-07 17:15 ` [PATCH 5/5] xfs: don't block the log commit handler for discards Christoph Hellwig

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=20170207171501.4268-5-hch@lst.de \
    --to=hch@lst.de \
    --cc=linux-xfs@vger.kernel.org \
    /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).