From: Dave Chinner <david@fromorbit.com>
To: xfs@oss.sgi.com
Subject: [PATCH 10/10] xfs: embed the pagb_list array in the perag structure
Date: Mon, 11 Jan 2010 22:47:49 +1100 [thread overview]
Message-ID: <1263210469-22171-11-git-send-email-david@fromorbit.com> (raw)
In-Reply-To: <1263210469-22171-1-git-send-email-david@fromorbit.com>
Now that the perag structure is allocated memory rather than held in
an array, we don't need to have the busy extent array external to
the structure. Embed it into the perag structure to avoid needing an
extra allocation when setting up.
Signed-off-by: Dave Chinner <david@fromorbit.com>
---
fs/xfs/xfs_ag.h | 10 ++--------
fs/xfs/xfs_alloc.c | 4 ++--
fs/xfs/xfs_mount.c | 3 +--
3 files changed, 5 insertions(+), 12 deletions(-)
diff --git a/fs/xfs/xfs_ag.h b/fs/xfs/xfs_ag.h
index 963bc27..b1a5a1f 100644
--- a/fs/xfs/xfs_ag.h
+++ b/fs/xfs/xfs_ag.h
@@ -187,14 +187,8 @@ typedef struct xfs_perag_busy {
/*
* Per-ag incore structure, copies of information in agf and agi,
* to improve the performance of allocation group selection.
- *
- * pick sizes which fit in allocation buckets well
*/
-#if (BITS_PER_LONG == 32)
-#define XFS_PAGB_NUM_SLOTS 84
-#elif (BITS_PER_LONG == 64)
#define XFS_PAGB_NUM_SLOTS 128
-#endif
typedef struct xfs_perag {
struct xfs_mount *pag_mount; /* owner filesystem */
@@ -212,8 +206,6 @@ typedef struct xfs_perag {
__uint32_t pagf_btreeblks; /* # of blocks held in AGF btrees */
xfs_agino_t pagi_freecount; /* number of free inodes */
xfs_agino_t pagi_count; /* number of allocated inodes */
- int pagb_count; /* pagb slots in use */
- xfs_perag_busy_t *pagb_list; /* unstable blocks */
/*
* Inode allocation search lookup optimisation.
@@ -232,6 +224,8 @@ typedef struct xfs_perag {
rwlock_t pag_ici_lock; /* incore inode lock */
struct radix_tree_root pag_ici_root; /* incore inode cache root */
#endif
+ int pagb_count; /* pagb slots in use */
+ xfs_perag_busy_t pagb_list[XFS_PAGB_NUM_SLOTS]; /* unstable blocks */
} xfs_perag_t;
/*
diff --git a/fs/xfs/xfs_alloc.c b/fs/xfs/xfs_alloc.c
index 4d66bb7..8aa181d 100644
--- a/fs/xfs/xfs_alloc.c
+++ b/fs/xfs/xfs_alloc.c
@@ -2200,8 +2200,8 @@ xfs_alloc_read_agf(
pag->pagf_levels[XFS_BTNUM_CNTi] =
be32_to_cpu(agf->agf_levels[XFS_BTNUM_CNTi]);
spin_lock_init(&pag->pagb_lock);
- pag->pagb_list = kmem_zalloc(XFS_PAGB_NUM_SLOTS *
- sizeof(xfs_perag_busy_t), KM_SLEEP);
+ pag->pagb_count = 0;
+ memset(pag->pagb_list, 0, sizeof(pag->pagb_list));
pag->pagf_init = 1;
}
#ifdef DEBUG
diff --git a/fs/xfs/xfs_mount.c b/fs/xfs/xfs_mount.c
index be643e5..0df5045 100644
--- a/fs/xfs/xfs_mount.c
+++ b/fs/xfs/xfs_mount.c
@@ -247,10 +247,9 @@ xfs_free_perag(
for (agno = 0; agno < mp->m_sb.sb_agcount; agno++) {
spin_lock(&mp->m_perag_lock);
pag = radix_tree_delete(&mp->m_perag_tree, agno);
+ ASSERT(pag);
ASSERT(atomic_read(&pag->pag_ref) == 0);
spin_unlock(&mp->m_perag_lock);
- ASSERT(pag);
- kmem_free(pag->pagb_list);
kmem_free(pag);
}
}
--
1.6.5
_______________________________________________
xfs mailing list
xfs@oss.sgi.com
http://oss.sgi.com/mailman/listinfo/xfs
next prev parent reply other threads:[~2010-01-11 11:51 UTC|newest]
Thread overview: 15+ messages / expand[flat|nested] mbox.gz Atom feed top
2010-01-11 11:47 [PATCH 0/10] Perag lookup rework Dave Chinner
2010-01-11 11:47 ` [PATCH 01/10] XFS: rename xfs_get_perag Dave Chinner
2010-01-11 11:47 ` [PATCH 02/10] XFS: Don't directly reference m_perag in allocation code Dave Chinner
2010-01-11 11:47 ` [PATCH 03/10] XFS: Convert filestreams code to use per-ag get/put routines Dave Chinner
2010-01-11 11:47 ` [PATCH 04/10] XFS: convert remaining direct references to m_perag Dave Chinner
2010-01-11 11:47 ` [PATCH 05/10] XFS: Replace per-ag array with a radix tree Dave Chinner
2010-01-11 11:47 ` [PATCH 06/10] XFS: Reference count per-ag structures Dave Chinner
2010-01-11 11:47 ` [PATCH 07/10] XFS: Add trace points for per-ag refcount debugging Dave Chinner
2010-01-11 11:47 ` [PATCH 08/10] XFS: Kill filestreams cache flush Dave Chinner
2010-01-11 11:47 ` [PATCH 09/10] xfs: handle ENOMEM correctly during initialisation of perag structures Dave Chinner
2010-01-11 11:47 ` Dave Chinner [this message]
2010-01-11 22:33 ` [PATCH 0/10] Perag lookup rework Christoph Hellwig
2010-01-11 22:34 ` Christoph Hellwig
2010-01-14 18:42 ` Alex Elder
2010-01-14 22:37 ` Dave Chinner
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=1263210469-22171-11-git-send-email-david@fromorbit.com \
--to=david@fromorbit.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