aboutsummaryrefslogtreecommitdiffstats
path: root/fs/xfs/xfs_trans_extfree.c
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/xfs_trans_extfree.c
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/xfs_trans_extfree.c')
-rw-r--r--fs/xfs/xfs_trans_extfree.c22
1 files changed, 6 insertions, 16 deletions
diff --git a/fs/xfs/xfs_trans_extfree.c b/fs/xfs/xfs_trans_extfree.c
index dfb6a0fdcf9c..f783d5e9fa70 100644
--- a/fs/xfs/xfs_trans_extfree.c
+++ b/fs/xfs/xfs_trans_extfree.c
@@ -48,9 +48,8 @@ xfs_trans_get_efi(xfs_trans_t *tp,
48 /* 48 /*
49 * Get a log_item_desc to point at the new item. 49 * Get a log_item_desc to point at the new item.
50 */ 50 */
51 (void) xfs_trans_add_item(tp, (xfs_log_item_t*)efip); 51 xfs_trans_add_item(tp, &efip->efi_item);
52 52 return efip;
53 return (efip);
54} 53}
55 54
56/* 55/*
@@ -64,15 +63,11 @@ xfs_trans_log_efi_extent(xfs_trans_t *tp,
64 xfs_fsblock_t start_block, 63 xfs_fsblock_t start_block,
65 xfs_extlen_t ext_len) 64 xfs_extlen_t ext_len)
66{ 65{
67 xfs_log_item_desc_t *lidp;
68 uint next_extent; 66 uint next_extent;
69 xfs_extent_t *extp; 67 xfs_extent_t *extp;
70 68
71 lidp = xfs_trans_find_item(tp, (xfs_log_item_t*)efip);
72 ASSERT(lidp != NULL);
73
74 tp->t_flags |= XFS_TRANS_DIRTY; 69 tp->t_flags |= XFS_TRANS_DIRTY;
75 lidp->lid_flags |= XFS_LID_DIRTY; 70 efip->efi_item.li_desc->lid_flags |= XFS_LID_DIRTY;
76 71
77 next_extent = efip->efi_next_extent; 72 next_extent = efip->efi_next_extent;
78 ASSERT(next_extent < efip->efi_format.efi_nextents); 73 ASSERT(next_extent < efip->efi_format.efi_nextents);
@@ -105,9 +100,8 @@ xfs_trans_get_efd(xfs_trans_t *tp,
105 /* 100 /*
106 * Get a log_item_desc to point at the new item. 101 * Get a log_item_desc to point at the new item.
107 */ 102 */
108 (void) xfs_trans_add_item(tp, (xfs_log_item_t*)efdp); 103 xfs_trans_add_item(tp, &efdp->efd_item);
109 104 return efdp;
110 return (efdp);
111} 105}
112 106
113/* 107/*
@@ -121,15 +115,11 @@ xfs_trans_log_efd_extent(xfs_trans_t *tp,
121 xfs_fsblock_t start_block, 115 xfs_fsblock_t start_block,
122 xfs_extlen_t ext_len) 116 xfs_extlen_t ext_len)
123{ 117{
124 xfs_log_item_desc_t *lidp;
125 uint next_extent; 118 uint next_extent;
126 xfs_extent_t *extp; 119 xfs_extent_t *extp;
127 120
128 lidp = xfs_trans_find_item(tp, (xfs_log_item_t*)efdp);
129 ASSERT(lidp != NULL);
130
131 tp->t_flags |= XFS_TRANS_DIRTY; 121 tp->t_flags |= XFS_TRANS_DIRTY;
132 lidp->lid_flags |= XFS_LID_DIRTY; 122 efdp->efd_item.li_desc->lid_flags |= XFS_LID_DIRTY;
133 123
134 next_extent = efdp->efd_next_extent; 124 next_extent = efdp->efd_next_extent;
135 ASSERT(next_extent < efdp->efd_format.efd_nextents); 125 ASSERT(next_extent < efdp->efd_format.efd_nextents);