From: Jeff Liu <jeff.liu@oracle.com>
To: xfs@oss.sgi.com
Subject: [PATCH 05/15] xfs: Teach inode/space allocator aware of XFS_AG_STATE_ALLOC_DENY
Date: Fri, 16 Nov 2012 14:45:31 +0800 [thread overview]
Message-ID: <50A5E10B.5010109@oracle.com> (raw)
Teach inode/space allocators aware of the new AG state(XFS_AG_STATE_ALLOC_DENY).
- Don't chose an AG with this state.
- Don't mark pagi_inodeok upon an AG for xfs_set_inode32/64 mount options if the
given AG incore object has this state.
Signed-off-by: Jie Liu <jeff.liu@oracle.com>
---
fs/xfs/xfs_alloc.c | 15 ++++++++++++++-
fs/xfs/xfs_ialloc.c | 6 +++++-
fs/xfs/xfs_super.c | 10 ++++++++++
3 files changed, 29 insertions(+), 2 deletions(-)
diff --git a/fs/xfs/xfs_alloc.c b/fs/xfs/xfs_alloc.c
index bd9cc41..d2eb856 100644
--- a/fs/xfs/xfs_alloc.c
+++ b/fs/xfs/xfs_alloc.c
@@ -493,6 +493,7 @@ STATIC int /* error */
xfs_alloc_ag_vextent(
xfs_alloc_arg_t *args) /* argument structure for allocation */
{
+ xfs_perag_t *pag = args->pag;
int error=0;
ASSERT(args->minlen > 0);
@@ -500,6 +501,18 @@ xfs_alloc_ag_vextent(
ASSERT(args->minlen <= args->maxlen);
ASSERT(args->mod < args->prod);
ASSERT(args->alignment > 0);
+
+ /*
+ * Return NULLAGBLOCK if the a.g. state is set to offline.
+ * i.e. deny allocation.
+ * FIXME: how about replacing XFS_AG_STATE_ALLOC_DENY to
+ * XFS_AG_STATE_OFFLINE? maybe looks a bit more reasonable.
+ */
+ if (unlikely(pag->pag_state & XFS_AG_STATE_ALLOC_DENY)) {
+ args->agbno = NULLAGBLOCK;
+ return 0;
+ }
+
/*
* Branch to correct routine based on the type.
*/
@@ -1893,7 +1906,7 @@ xfs_alloc_fix_freelist(
/*
* Stop if we run out. Won't happen if callers are obeying
* the restrictions correctly. Can happen for free calls
- * on a completely full ag.
+ * on a completely full ag, or an ag is set to offline.
*/
if (targs.agbno == NULLAGBLOCK) {
if (flags & XFS_ALLOC_FLAG_FREEING)
diff --git a/fs/xfs/xfs_ialloc.c b/fs/xfs/xfs_ialloc.c
index 445bf1a..04fbb49 100644
--- a/fs/xfs/xfs_ialloc.c
+++ b/fs/xfs/xfs_ialloc.c
@@ -488,7 +488,11 @@ xfs_ialloc_ag_select(
flags = XFS_ALLOC_FLAG_TRYLOCK;
for (;;) {
pag = xfs_perag_get(mp, agno);
- if (!pag->pagi_inodeok) {
+ /*
+ * Skip the current AG if it's state is set to offline.
+ */
+ if (!pag->pagi_inodeok ||
+ unlikely(pag->pag_state & XFS_AG_STATE_ALLOC_DENY)) {
xfs_ialloc_next_ag(mp);
goto nextag;
}
diff --git a/fs/xfs/xfs_super.c b/fs/xfs/xfs_super.c
index 26a09bd..e01f64c 100644
--- a/fs/xfs/xfs_super.c
+++ b/fs/xfs/xfs_super.c
@@ -642,6 +642,11 @@ xfs_set_inode32(struct xfs_mount *mp)
}
pag = xfs_perag_get(mp, index);
+ if (unlikely(pag->pag_state & XFS_AG_STATE_ALLOC_DENY)) {
+ xfs_perag_put(pag);
+ continue;
+ }
+
pag->pagi_inodeok = 1;
maxagi++;
if (index < max_metadata)
@@ -663,6 +668,11 @@ xfs_set_inode64(struct xfs_mount *mp)
struct xfs_perag *pag;
pag = xfs_perag_get(mp, index);
+ if (unlikely(pag->pag_state & XFS_AG_STATE_ALLOC_DENY)) {
+ xfs_perag_put(pag);
+ continue;
+ }
+
pag->pagi_inodeok = 1;
pag->pagf_metadata = 0;
xfs_perag_put(pag);
--
1.7.4.1
_______________________________________________
xfs mailing list
xfs@oss.sgi.com
http://oss.sgi.com/mailman/listinfo/xfs
reply other threads:[~2012-11-16 6:43 UTC|newest]
Thread overview: [no followups] expand[flat|nested] mbox.gz Atom feed
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=50A5E10B.5010109@oracle.com \
--to=jeff.liu@oracle.com \
--cc=xfs@oss.sgi.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