From: Christoph Hellwig <hch@infradead.org>
To: Dave Chinner <david@fromorbit.com>
Cc: linux-xfs@vger.kernel.org, john.g.garry@oracle.com
Subject: Re: [PATCH 4/9] xfs: push the perag outwards in initial allocation
Date: Thu, 5 Oct 2023 04:57:01 -0700 [thread overview]
Message-ID: <ZR6kjTYPBtJNSLHy@infradead.org> (raw)
In-Reply-To: <20231004001943.349265-5-david@fromorbit.com>
The logic looks good, and really helps to distinguis the lowspace
case:
Reviewed-by: Christoph Hellwig <hch@lst.de>
However I stll find the loop in xfs_bmap_btalloc_select_lengths a little
suboptimal. I'd go for something like this incremental patch:
diff --git a/fs/xfs/libxfs/xfs_bmap.c b/fs/xfs/libxfs/xfs_bmap.c
index 3c250c89f42e92..c1da9e9cfe05f2 100644
--- a/fs/xfs/libxfs/xfs_bmap.c
+++ b/fs/xfs/libxfs/xfs_bmap.c
@@ -3268,35 +3268,31 @@ xfs_bmap_btalloc_select_lengths(
xfs_perag_rele(pag);
return error;
}
- if (*blen >= args->maxlen + stripe_align) {
- /*
- * We are going to target a different AG than the
- * incoming target, so we need to reset the target and
- * skip exact EOF allocation attempts.
- */
- if (agno != startag) {
- ap->blkno = XFS_AGB_TO_FSB(mp, agno, 0);
- ap->aeof = false;
- }
- args->pag = pag;
- break;
- }
+
if (*blen > max_blen) {
max_blen = *blen;
max_blen_agno = agno;
+ if (*blen >= args->maxlen + stripe_align)
+ goto out;
}
}
- if (max_blen >= *blen) {
- ASSERT(args->pag == NULL);
- if (max_blen_agno != startag) {
- ap->blkno = XFS_AGB_TO_FSB(mp, max_blen_agno, 0);
- ap->aeof = false;
- }
- *blen = max_blen;
- args->pag = xfs_perag_grab(mp, max_blen_agno);
+ /*
+ * We did not find a perfect fit, so pick the AG with the longest
+ * available free space.
+ */
+ *blen = max_blen;
+ pag = xfs_perag_grab(mp, max_blen_agno);
+out:
+ /*
+ * If we are going to target a different AG than the incoming target,
+ * reset the target and skip exact EOF allocation attempts.
+ */
+ if (max_blen_agno != startag) {
+ ap->blkno = XFS_AGB_TO_FSB(mp, max_blen_agno, 0);
+ ap->aeof = false;
}
-
+ args->pag = pag;
args->minlen = xfs_bmap_select_minlen(ap, args, *blen);
return 0;
}
next prev parent reply other threads:[~2023-10-05 14:05 UTC|newest]
Thread overview: 27+ messages / expand[flat|nested] mbox.gz Atom feed top
2023-10-04 0:19 [RFC PATCH 0/9] xfs: push perags further into allocation routines Dave Chinner
2023-10-04 0:19 ` [PATCH 1/9] xfs: split xfs_bmap_btalloc_at_eof() Dave Chinner
2023-10-04 23:41 ` Darrick J. Wong
2023-10-05 9:41 ` Christoph Hellwig
2023-10-04 0:19 ` [PATCH 2/9] xfs: contiguous EOF allocation across AGs Dave Chinner
2023-10-05 9:43 ` Christoph Hellwig
2023-10-06 5:27 ` Darrick J. Wong
2023-10-04 0:19 ` [PATCH 3/9] xfs: select the AG with the largest contiguous space Dave Chinner
2023-10-05 9:45 ` Christoph Hellwig
2023-10-05 9:46 ` Christoph Hellwig
2023-10-24 16:25 ` Darrick J. Wong
2023-10-04 0:19 ` [PATCH 4/9] xfs: push the perag outwards in initial allocation Dave Chinner
2023-10-05 11:57 ` Christoph Hellwig [this message]
2023-10-04 0:19 ` [PATCH 5/9] xfs: aligned EOF allocations don't need to scan AGs anymore Dave Chinner
2023-10-05 11:59 ` Christoph Hellwig
2023-10-06 5:55 ` Darrick J. Wong
2023-10-04 0:19 ` [PATCH 6/9] xfs: use agno/agbno in xfs_alloc_vextent functions Dave Chinner
2023-10-05 12:02 ` Christoph Hellwig
2023-10-06 5:56 ` Darrick J. Wong
2023-10-04 0:19 ` [PATCH 7/9] xfs: caller perag always supplied to xfs_alloc_vextent_near_bno Dave Chinner
2023-10-05 12:02 ` Christoph Hellwig
2023-10-06 5:59 ` Darrick J. Wong
2023-10-04 0:19 ` [PATCH 8/9] xfs: collapse near and exact bno allocation Dave Chinner
2023-10-05 12:03 ` Christoph Hellwig
2023-10-06 6:01 ` Darrick J. Wong
2023-10-04 0:19 ` [PATCH 9/9] xfs: return -ENOSPC rather than NULLFSBLOCK from allocation functions Dave Chinner
2023-10-05 12:21 ` 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=ZR6kjTYPBtJNSLHy@infradead.org \
--to=hch@infradead.org \
--cc=david@fromorbit.com \
--cc=john.g.garry@oracle.com \
--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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.