aboutsummaryrefslogtreecommitdiffstats
path: root/fs/xfs/quota
diff options
context:
space:
mode:
authorChristoph Hellwig <hch@infradead.org>2010-06-23 04:11:15 -0400
committerAlex Elder <aelder@sgi.com>2010-07-26 14:16:34 -0400
commite98c414f9a3134fe7efc56ef8f1d394b54bfd40e (patch)
treeb3d4696cfb4875af39041f9ddcd642bd1cd90a29 /fs/xfs/quota
parent3400777ff03a3cd4fdbc6cb15676fc7e7ceefc00 (diff)
xfs: simplify log item descriptor tracking
Currently we track log item descriptor belonging to a transaction using a complex opencoded chunk allocator. This code has been there since day one and seems to work around the lack of an efficient slab allocator. This patch replaces it with dynamically allocated log item descriptors from a dedicated slab pool, linked to the transaction by a linked list. This allows to greatly simplify the log item descriptor tracking to the point where it's just a couple hundred lines in xfs_trans.c instead of a separate file. The external API has also been simplified while we're at it - the xfs_trans_add_item and xfs_trans_del_item functions to add/ delete items from a transaction have been simplified to the bare minium, and the xfs_trans_find_item function is replaced with a direct dereference of the li_desc field. All debug code walking the list of log items in a transaction is down to a simple list_for_each_entry. Note that we could easily use a singly linked list here instead of the double linked list from list.h as the fastpath only does deletion from sequential traversal. But given that we don't have one available as a library function yet I use the list.h functions for simplicity. Signed-off-by: Christoph Hellwig <hch@lst.de> Reviewed-by: Dave Chinner <dchinner@redhat.com>
Diffstat (limited to 'fs/xfs/quota')
-rw-r--r--fs/xfs/quota/xfs_trans_dquot.c25
1 files changed, 6 insertions, 19 deletions
diff --git a/fs/xfs/quota/xfs_trans_dquot.c b/fs/xfs/quota/xfs_trans_dquot.c
index 08f5604d092f..7de91d1b75c0 100644
--- a/fs/xfs/quota/xfs_trans_dquot.c
+++ b/fs/xfs/quota/xfs_trans_dquot.c
@@ -49,16 +49,14 @@ xfs_trans_dqjoin(
49 xfs_trans_t *tp, 49 xfs_trans_t *tp,
50 xfs_dquot_t *dqp) 50 xfs_dquot_t *dqp)
51{ 51{
52 xfs_dq_logitem_t *lp = &dqp->q_logitem;
53
54 ASSERT(dqp->q_transp != tp); 52 ASSERT(dqp->q_transp != tp);
55 ASSERT(XFS_DQ_IS_LOCKED(dqp)); 53 ASSERT(XFS_DQ_IS_LOCKED(dqp));
56 ASSERT(lp->qli_dquot == dqp); 54 ASSERT(dqp->q_logitem.qli_dquot == dqp);
57 55
58 /* 56 /*
59 * Get a log_item_desc to point at the new item. 57 * Get a log_item_desc to point at the new item.
60 */ 58 */
61 (void) xfs_trans_add_item(tp, (xfs_log_item_t*)(lp)); 59 xfs_trans_add_item(tp, &dqp->q_logitem.qli_item);
62 60
63 /* 61 /*
64 * Initialize i_transp so we can later determine if this dquot is 62 * Initialize i_transp so we can later determine if this dquot is
@@ -83,16 +81,11 @@ xfs_trans_log_dquot(
83 xfs_trans_t *tp, 81 xfs_trans_t *tp,
84 xfs_dquot_t *dqp) 82 xfs_dquot_t *dqp)
85{ 83{
86 xfs_log_item_desc_t *lidp;
87
88 ASSERT(dqp->q_transp == tp); 84 ASSERT(dqp->q_transp == tp);
89 ASSERT(XFS_DQ_IS_LOCKED(dqp)); 85 ASSERT(XFS_DQ_IS_LOCKED(dqp));
90 86
91 lidp = xfs_trans_find_item(tp, (xfs_log_item_t*)(&dqp->q_logitem));
92 ASSERT(lidp != NULL);
93
94 tp->t_flags |= XFS_TRANS_DIRTY; 87 tp->t_flags |= XFS_TRANS_DIRTY;
95 lidp->lid_flags |= XFS_LID_DIRTY; 88 dqp->q_logitem.qli_item.li_desc->lid_flags |= XFS_LID_DIRTY;
96} 89}
97 90
98/* 91/*
@@ -864,9 +857,8 @@ xfs_trans_get_qoff_item(
864 /* 857 /*
865 * Get a log_item_desc to point at the new item. 858 * Get a log_item_desc to point at the new item.
866 */ 859 */
867 (void) xfs_trans_add_item(tp, (xfs_log_item_t*)q); 860 xfs_trans_add_item(tp, &q->qql_item);
868 861 return q;
869 return (q);
870} 862}
871 863
872 864
@@ -880,13 +872,8 @@ xfs_trans_log_quotaoff_item(
880 xfs_trans_t *tp, 872 xfs_trans_t *tp,
881 xfs_qoff_logitem_t *qlp) 873 xfs_qoff_logitem_t *qlp)
882{ 874{
883 xfs_log_item_desc_t *lidp;
884
885 lidp = xfs_trans_find_item(tp, (xfs_log_item_t *)qlp);
886 ASSERT(lidp != NULL);
887
888 tp->t_flags |= XFS_TRANS_DIRTY; 875 tp->t_flags |= XFS_TRANS_DIRTY;
889 lidp->lid_flags |= XFS_LID_DIRTY; 876 qlp->qql_item.li_desc->lid_flags |= XFS_LID_DIRTY;
890} 877}
891 878
892STATIC void 879STATIC void