summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorDave Chinner <dchinner@redhat.com>2018-05-09 10:49:37 -0400
committerDarrick J. Wong <darrick.wong@oracle.com>2018-05-10 11:56:46 -0400
commite6631f85546c8ff8842f62c73be44ff502d4287a (patch)
tree23d3a8cc1c0a452442c53adefd990bfc81e970c0
parent1a2ebf835a3c23e0491e3279959cfb6c65a6ebbb (diff)
xfs: get rid of the log item descriptor
It's just a connector between a transaction and a log item. There's a 1:1 relationship between a log item descriptor and a log item, and a 1:1 relationship between a log item descriptor and a transaction. Both relationships are created and terminated at the same time, so why do we even have the descriptor? Replace it with a specific list_head in the log item and a new log item dirtied flag to replace the XFS_LID_DIRTY flag. Signed-Off-By: Dave Chinner <dchinner@redhat.com> Reviewed-by: Brian Foster <bfoster@redhat.com> Reviewed-by: Christoph Hellwig <hch@lst.de> [darrick: fix up deferred agfl intent finish_item use of LID_DIRTY] Reviewed-by: Darrick J. Wong <darrick.wong@oracle.com> Signed-off-by: Darrick J. Wong <darrick.wong@oracle.com>
-rw-r--r--fs/xfs/libxfs/xfs_bmap.c8
-rw-r--r--fs/xfs/libxfs/xfs_shared.h15
-rw-r--r--fs/xfs/xfs_buf_item.c2
-rw-r--r--fs/xfs/xfs_icreate_item.c2
-rw-r--r--fs/xfs/xfs_log.c10
-rw-r--r--fs/xfs/xfs_log_cil.c21
-rw-r--r--fs/xfs/xfs_super.c10
-rw-r--r--fs/xfs/xfs_trace.h5
-rw-r--r--fs/xfs/xfs_trans.c58
-rw-r--r--fs/xfs/xfs_trans.h8
-rw-r--r--fs/xfs/xfs_trans_bmap.c4
-rw-r--r--fs/xfs/xfs_trans_buf.c22
-rw-r--r--fs/xfs/xfs_trans_dquot.c4
-rw-r--r--fs/xfs/xfs_trans_extfree.c6
-rw-r--r--fs/xfs/xfs_trans_inode.c3
-rw-r--r--fs/xfs/xfs_trans_priv.h1
-rw-r--r--fs/xfs/xfs_trans_refcount.c4
-rw-r--r--fs/xfs/xfs_trans_rmap.c4
18 files changed, 63 insertions, 124 deletions
diff --git a/fs/xfs/libxfs/xfs_bmap.c b/fs/xfs/libxfs/xfs_bmap.c
index ddb5f5336ecf..3e5e9a667bc8 100644
--- a/fs/xfs/libxfs/xfs_bmap.c
+++ b/fs/xfs/libxfs/xfs_bmap.c
@@ -246,7 +246,7 @@ xfs_bmap_get_bp(
246 struct xfs_btree_cur *cur, 246 struct xfs_btree_cur *cur,
247 xfs_fsblock_t bno) 247 xfs_fsblock_t bno)
248{ 248{
249 struct xfs_log_item_desc *lidp; 249 struct xfs_log_item *lip;
250 int i; 250 int i;
251 251
252 if (!cur) 252 if (!cur)
@@ -260,9 +260,9 @@ xfs_bmap_get_bp(
260 } 260 }
261 261
262 /* Chase down all the log items to see if the bp is there */ 262 /* Chase down all the log items to see if the bp is there */
263 list_for_each_entry(lidp, &cur->bc_tp->t_items, lid_trans) { 263 list_for_each_entry(lip, &cur->bc_tp->t_items, li_trans) {
264 struct xfs_buf_log_item *bip; 264 struct xfs_buf_log_item *bip = (struct xfs_buf_log_item *)lip;
265 bip = (struct xfs_buf_log_item *)lidp->lid_item; 265
266 if (bip->bli_item.li_type == XFS_LI_BUF && 266 if (bip->bli_item.li_type == XFS_LI_BUF &&
267 XFS_BUF_ADDR(bip->bli_buf) == bno) 267 XFS_BUF_ADDR(bip->bli_buf) == bno)
268 return bip->bli_buf; 268 return bip->bli_buf;
diff --git a/fs/xfs/libxfs/xfs_shared.h b/fs/xfs/libxfs/xfs_shared.h
index d0b84da0cb1e..8efc06e62b13 100644
--- a/fs/xfs/libxfs/xfs_shared.h
+++ b/fs/xfs/libxfs/xfs_shared.h
@@ -57,21 +57,6 @@ extern const struct xfs_buf_ops xfs_sb_quiet_buf_ops;
57extern const struct xfs_buf_ops xfs_symlink_buf_ops; 57extern const struct xfs_buf_ops xfs_symlink_buf_ops;
58extern const struct xfs_buf_ops xfs_rtbuf_ops; 58extern const struct xfs_buf_ops xfs_rtbuf_ops;
59 59
60/*
61 * This structure is used to track log items associated with
62 * a transaction. It points to the log item and keeps some
63 * flags to track the state of the log item. It also tracks
64 * the amount of space needed to log the item it describes
65 * once we get to commit processing (see xfs_trans_commit()).
66 */
67struct xfs_log_item_desc {
68 struct xfs_log_item *lid_item;
69 struct list_head lid_trans;
70 unsigned char lid_flags;
71};
72
73#define XFS_LID_DIRTY 0x1
74
75/* log size calculation functions */ 60/* log size calculation functions */
76int xfs_log_calc_unit_res(struct xfs_mount *mp, int unit_bytes); 61int xfs_log_calc_unit_res(struct xfs_mount *mp, int unit_bytes);
77int xfs_log_calc_minimum_size(struct xfs_mount *); 62int xfs_log_calc_minimum_size(struct xfs_mount *);
diff --git a/fs/xfs/xfs_buf_item.c b/fs/xfs/xfs_buf_item.c
index 8d6ed045b643..c2311379d1c3 100644
--- a/fs/xfs/xfs_buf_item.c
+++ b/fs/xfs/xfs_buf_item.c
@@ -438,7 +438,7 @@ xfs_buf_item_unpin(
438 * xfs_trans_uncommit() will try to reference the 438 * xfs_trans_uncommit() will try to reference the
439 * buffer which we no longer have a hold on. 439 * buffer which we no longer have a hold on.
440 */ 440 */
441 if (lip->li_desc) 441 if (!list_empty(&lip->li_trans))
442 xfs_trans_del_item(lip); 442 xfs_trans_del_item(lip);
443 443
444 /* 444 /*
diff --git a/fs/xfs/xfs_icreate_item.c b/fs/xfs/xfs_icreate_item.c
index a99a0f8aa528..5da9599156ed 100644
--- a/fs/xfs/xfs_icreate_item.c
+++ b/fs/xfs/xfs_icreate_item.c
@@ -184,5 +184,5 @@ xfs_icreate_log(
184 184
185 xfs_trans_add_item(tp, &icp->ic_item); 185 xfs_trans_add_item(tp, &icp->ic_item);
186 tp->t_flags |= XFS_TRANS_DIRTY; 186 tp->t_flags |= XFS_TRANS_DIRTY;
187 icp->ic_item.li_desc->lid_flags |= XFS_LID_DIRTY; 187 set_bit(XFS_LI_DIRTY, &icp->ic_item.li_flags);
188} 188}
diff --git a/fs/xfs/xfs_log.c b/fs/xfs/xfs_log.c
index e427864434c1..c21039f27e39 100644
--- a/fs/xfs/xfs_log.c
+++ b/fs/xfs/xfs_log.c
@@ -1047,6 +1047,7 @@ xfs_log_item_init(
1047 INIT_LIST_HEAD(&item->li_ail); 1047 INIT_LIST_HEAD(&item->li_ail);
1048 INIT_LIST_HEAD(&item->li_cil); 1048 INIT_LIST_HEAD(&item->li_cil);
1049 INIT_LIST_HEAD(&item->li_bio_list); 1049 INIT_LIST_HEAD(&item->li_bio_list);
1050 INIT_LIST_HEAD(&item->li_trans);
1050} 1051}
1051 1052
1052/* 1053/*
@@ -2110,10 +2111,10 @@ xlog_print_tic_res(
2110 */ 2111 */
2111void 2112void
2112xlog_print_trans( 2113xlog_print_trans(
2113 struct xfs_trans *tp) 2114 struct xfs_trans *tp)
2114{ 2115{
2115 struct xfs_mount *mp = tp->t_mountp; 2116 struct xfs_mount *mp = tp->t_mountp;
2116 struct xfs_log_item_desc *lidp; 2117 struct xfs_log_item *lip;
2117 2118
2118 /* dump core transaction and ticket info */ 2119 /* dump core transaction and ticket info */
2119 xfs_warn(mp, "transaction summary:"); 2120 xfs_warn(mp, "transaction summary:");
@@ -2124,8 +2125,7 @@ xlog_print_trans(
2124 xlog_print_tic_res(mp, tp->t_ticket); 2125 xlog_print_tic_res(mp, tp->t_ticket);
2125 2126
2126 /* dump each log item */ 2127 /* dump each log item */
2127 list_for_each_entry(lidp, &tp->t_items, lid_trans) { 2128 list_for_each_entry(lip, &tp->t_items, li_trans) {
2128 struct xfs_log_item *lip = lidp->lid_item;
2129 struct xfs_log_vec *lv = lip->li_lv; 2129 struct xfs_log_vec *lv = lip->li_lv;
2130 struct xfs_log_iovec *vec; 2130 struct xfs_log_iovec *vec;
2131 int i; 2131 int i;
diff --git a/fs/xfs/xfs_log_cil.c b/fs/xfs/xfs_log_cil.c
index a8675c631438..c15687724728 100644
--- a/fs/xfs/xfs_log_cil.c
+++ b/fs/xfs/xfs_log_cil.c
@@ -141,10 +141,9 @@ xlog_cil_alloc_shadow_bufs(
141 struct xlog *log, 141 struct xlog *log,
142 struct xfs_trans *tp) 142 struct xfs_trans *tp)
143{ 143{
144 struct xfs_log_item_desc *lidp; 144 struct xfs_log_item *lip;
145 145
146 list_for_each_entry(lidp, &tp->t_items, lid_trans) { 146 list_for_each_entry(lip, &tp->t_items, li_trans) {
147 struct xfs_log_item *lip = lidp->lid_item;
148 struct xfs_log_vec *lv; 147 struct xfs_log_vec *lv;
149 int niovecs = 0; 148 int niovecs = 0;
150 int nbytes = 0; 149 int nbytes = 0;
@@ -152,7 +151,7 @@ xlog_cil_alloc_shadow_bufs(
152 bool ordered = false; 151 bool ordered = false;
153 152
154 /* Skip items which aren't dirty in this transaction. */ 153 /* Skip items which aren't dirty in this transaction. */
155 if (!(lidp->lid_flags & XFS_LID_DIRTY)) 154 if (!test_bit(XFS_LI_DIRTY, &lip->li_flags))
156 continue; 155 continue;
157 156
158 /* get number of vecs and size of data to be stored */ 157 /* get number of vecs and size of data to be stored */
@@ -317,7 +316,7 @@ xlog_cil_insert_format_items(
317 int *diff_len, 316 int *diff_len,
318 int *diff_iovecs) 317 int *diff_iovecs)
319{ 318{
320 struct xfs_log_item_desc *lidp; 319 struct xfs_log_item *lip;
321 320
322 321
323 /* Bail out if we didn't find a log item. */ 322 /* Bail out if we didn't find a log item. */
@@ -326,15 +325,14 @@ xlog_cil_insert_format_items(
326 return; 325 return;
327 } 326 }
328 327
329 list_for_each_entry(lidp, &tp->t_items, lid_trans) { 328 list_for_each_entry(lip, &tp->t_items, li_trans) {
330 struct xfs_log_item *lip = lidp->lid_item;
331 struct xfs_log_vec *lv; 329 struct xfs_log_vec *lv;
332 struct xfs_log_vec *old_lv = NULL; 330 struct xfs_log_vec *old_lv = NULL;
333 struct xfs_log_vec *shadow; 331 struct xfs_log_vec *shadow;
334 bool ordered = false; 332 bool ordered = false;
335 333
336 /* Skip items which aren't dirty in this transaction. */ 334 /* Skip items which aren't dirty in this transaction. */
337 if (!(lidp->lid_flags & XFS_LID_DIRTY)) 335 if (!test_bit(XFS_LI_DIRTY, &lip->li_flags))
338 continue; 336 continue;
339 337
340 /* 338 /*
@@ -406,7 +404,7 @@ xlog_cil_insert_items(
406{ 404{
407 struct xfs_cil *cil = log->l_cilp; 405 struct xfs_cil *cil = log->l_cilp;
408 struct xfs_cil_ctx *ctx = cil->xc_ctx; 406 struct xfs_cil_ctx *ctx = cil->xc_ctx;
409 struct xfs_log_item_desc *lidp; 407 struct xfs_log_item *lip;
410 int len = 0; 408 int len = 0;
411 int diff_iovecs = 0; 409 int diff_iovecs = 0;
412 int iclog_space; 410 int iclog_space;
@@ -479,11 +477,10 @@ xlog_cil_insert_items(
479 * We do this here so we only need to take the CIL lock once during 477 * We do this here so we only need to take the CIL lock once during
480 * the transaction commit. 478 * the transaction commit.
481 */ 479 */
482 list_for_each_entry(lidp, &tp->t_items, lid_trans) { 480 list_for_each_entry(lip, &tp->t_items, li_trans) {
483 struct xfs_log_item *lip = lidp->lid_item;
484 481
485 /* Skip items which aren't dirty in this transaction. */ 482 /* Skip items which aren't dirty in this transaction. */
486 if (!(lidp->lid_flags & XFS_LID_DIRTY)) 483 if (!test_bit(XFS_LI_DIRTY, &lip->li_flags))
487 continue; 484 continue;
488 485
489 /* 486 /*
diff --git a/fs/xfs/xfs_super.c b/fs/xfs/xfs_super.c
index d71424052917..5726ef496980 100644
--- a/fs/xfs/xfs_super.c
+++ b/fs/xfs/xfs_super.c
@@ -1880,11 +1880,6 @@ xfs_init_zones(void)
1880 if (!xfs_trans_zone) 1880 if (!xfs_trans_zone)
1881 goto out_destroy_ifork_zone; 1881 goto out_destroy_ifork_zone;
1882 1882
1883 xfs_log_item_desc_zone =
1884 kmem_zone_init(sizeof(struct xfs_log_item_desc),
1885 "xfs_log_item_desc");
1886 if (!xfs_log_item_desc_zone)
1887 goto out_destroy_trans_zone;
1888 1883
1889 /* 1884 /*
1890 * The size of the zone allocated buf log item is the maximum 1885 * The size of the zone allocated buf log item is the maximum
@@ -1894,7 +1889,7 @@ xfs_init_zones(void)
1894 xfs_buf_item_zone = kmem_zone_init(sizeof(struct xfs_buf_log_item), 1889 xfs_buf_item_zone = kmem_zone_init(sizeof(struct xfs_buf_log_item),
1895 "xfs_buf_item"); 1890 "xfs_buf_item");
1896 if (!xfs_buf_item_zone) 1891 if (!xfs_buf_item_zone)
1897 goto out_destroy_log_item_desc_zone; 1892 goto out_destroy_trans_zone;
1898 1893
1899 xfs_efd_zone = kmem_zone_init((sizeof(xfs_efd_log_item_t) + 1894 xfs_efd_zone = kmem_zone_init((sizeof(xfs_efd_log_item_t) +
1900 ((XFS_EFD_MAX_FAST_EXTENTS - 1) * 1895 ((XFS_EFD_MAX_FAST_EXTENTS - 1) *
@@ -1982,8 +1977,6 @@ xfs_init_zones(void)
1982 kmem_zone_destroy(xfs_efd_zone); 1977 kmem_zone_destroy(xfs_efd_zone);
1983 out_destroy_buf_item_zone: 1978 out_destroy_buf_item_zone:
1984 kmem_zone_destroy(xfs_buf_item_zone); 1979 kmem_zone_destroy(xfs_buf_item_zone);
1985 out_destroy_log_item_desc_zone:
1986 kmem_zone_destroy(xfs_log_item_desc_zone);
1987 out_destroy_trans_zone: 1980 out_destroy_trans_zone:
1988 kmem_zone_destroy(xfs_trans_zone); 1981 kmem_zone_destroy(xfs_trans_zone);
1989 out_destroy_ifork_zone: 1982 out_destroy_ifork_zone:
@@ -2022,7 +2015,6 @@ xfs_destroy_zones(void)
2022 kmem_zone_destroy(xfs_efi_zone); 2015 kmem_zone_destroy(xfs_efi_zone);
2023 kmem_zone_destroy(xfs_efd_zone); 2016 kmem_zone_destroy(xfs_efd_zone);
2024 kmem_zone_destroy(xfs_buf_item_zone); 2017 kmem_zone_destroy(xfs_buf_item_zone);
2025 kmem_zone_destroy(xfs_log_item_desc_zone);
2026 kmem_zone_destroy(xfs_trans_zone); 2018 kmem_zone_destroy(xfs_trans_zone);
2027 kmem_zone_destroy(xfs_ifork_zone); 2019 kmem_zone_destroy(xfs_ifork_zone);
2028 kmem_zone_destroy(xfs_da_state_zone); 2020 kmem_zone_destroy(xfs_da_state_zone);
diff --git a/fs/xfs/xfs_trace.h b/fs/xfs/xfs_trace.h
index e2ffc1e01bd8..9d4c4ca24fe6 100644
--- a/fs/xfs/xfs_trace.h
+++ b/fs/xfs/xfs_trace.h
@@ -441,7 +441,6 @@ DECLARE_EVENT_CLASS(xfs_buf_item_class,
441 __field(unsigned, bli_recur) 441 __field(unsigned, bli_recur)
442 __field(int, bli_refcount) 442 __field(int, bli_refcount)
443 __field(unsigned, bli_flags) 443 __field(unsigned, bli_flags)
444 __field(void *, li_desc)
445 __field(unsigned long, li_flags) 444 __field(unsigned long, li_flags)
446 ), 445 ),
447 TP_fast_assign( 446 TP_fast_assign(
@@ -455,12 +454,11 @@ DECLARE_EVENT_CLASS(xfs_buf_item_class,
455 __entry->buf_hold = atomic_read(&bip->bli_buf->b_hold); 454 __entry->buf_hold = atomic_read(&bip->bli_buf->b_hold);
456 __entry->buf_pincount = atomic_read(&bip->bli_buf->b_pin_count); 455 __entry->buf_pincount = atomic_read(&bip->bli_buf->b_pin_count);
457 __entry->buf_lockval = bip->bli_buf->b_sema.count; 456 __entry->buf_lockval = bip->bli_buf->b_sema.count;
458 __entry->li_desc = bip->bli_item.li_desc;
459 __entry->li_flags = bip->bli_item.li_flags; 457 __entry->li_flags = bip->bli_item.li_flags;
460 ), 458 ),
461 TP_printk("dev %d:%d bno 0x%llx len 0x%zx hold %d pincount %d " 459 TP_printk("dev %d:%d bno 0x%llx len 0x%zx hold %d pincount %d "
462 "lock %d flags %s recur %d refcount %d bliflags %s " 460 "lock %d flags %s recur %d refcount %d bliflags %s "
463 "lidesc %p liflags %s", 461 "liflags %s",
464 MAJOR(__entry->dev), MINOR(__entry->dev), 462 MAJOR(__entry->dev), MINOR(__entry->dev),
465 (unsigned long long)__entry->buf_bno, 463 (unsigned long long)__entry->buf_bno,
466 __entry->buf_len, 464 __entry->buf_len,
@@ -471,7 +469,6 @@ DECLARE_EVENT_CLASS(xfs_buf_item_class,
471 __entry->bli_recur, 469 __entry->bli_recur,
472 __entry->bli_refcount, 470 __entry->bli_refcount,
473 __print_flags(__entry->bli_flags, "|", XFS_BLI_FLAGS), 471 __print_flags(__entry->bli_flags, "|", XFS_BLI_FLAGS),
474 __entry->li_desc,
475 __print_flags(__entry->li_flags, "|", XFS_LI_FLAGS)) 472 __print_flags(__entry->li_flags, "|", XFS_LI_FLAGS))
476) 473)
477 474
diff --git a/fs/xfs/xfs_trans.c b/fs/xfs/xfs_trans.c
index 4bbdb6faec30..fc7ba75b8b69 100644
--- a/fs/xfs/xfs_trans.c
+++ b/fs/xfs/xfs_trans.c
@@ -34,7 +34,6 @@
34#include "xfs_defer.h" 34#include "xfs_defer.h"
35 35
36kmem_zone_t *xfs_trans_zone; 36kmem_zone_t *xfs_trans_zone;
37kmem_zone_t *xfs_log_item_desc_zone;
38 37
39#if defined(CONFIG_TRACEPOINTS) 38#if defined(CONFIG_TRACEPOINTS)
40static void 39static void
@@ -734,77 +733,52 @@ out:
734 return; 733 return;
735} 734}
736 735
737/* 736/* Add the given log item to the transaction's list of log items. */
738 * Add the given log item to the transaction's list of log items.
739 *
740 * The log item will now point to its new descriptor with its li_desc field.
741 */
742void 737void
743xfs_trans_add_item( 738xfs_trans_add_item(
744 struct xfs_trans *tp, 739 struct xfs_trans *tp,
745 struct xfs_log_item *lip) 740 struct xfs_log_item *lip)
746{ 741{
747 struct xfs_log_item_desc *lidp;
748
749 ASSERT(lip->li_mountp == tp->t_mountp); 742 ASSERT(lip->li_mountp == tp->t_mountp);
750 ASSERT(lip->li_ailp == tp->t_mountp->m_ail); 743 ASSERT(lip->li_ailp == tp->t_mountp->m_ail);
744 ASSERT(list_empty(&lip->li_trans));
745 ASSERT(!test_bit(XFS_LI_DIRTY, &lip->li_flags));
751 746
752 lidp = kmem_zone_zalloc(xfs_log_item_desc_zone, KM_SLEEP | KM_NOFS); 747 list_add_tail(&lip->li_trans, &tp->t_items);
753
754 lidp->lid_item = lip;
755 lidp->lid_flags = 0;
756 list_add_tail(&lidp->lid_trans, &tp->t_items);
757
758 lip->li_desc = lidp;
759
760 trace_xfs_trans_add_item(tp, _RET_IP_); 748 trace_xfs_trans_add_item(tp, _RET_IP_);
761} 749}
762 750
763STATIC void
764xfs_trans_free_item_desc(
765 struct xfs_log_item_desc *lidp)
766{
767 list_del_init(&lidp->lid_trans);
768 kmem_zone_free(xfs_log_item_desc_zone, lidp);
769}
770
771/* 751/*
772 * Unlink and free the given descriptor. 752 * Unlink the log item from the transaction. the log item is no longer
753 * considered dirty in this transaction, as the linked transaction has
754 * finished, either by abort or commit completion.
773 */ 755 */
774void 756void
775xfs_trans_del_item( 757xfs_trans_del_item(
776 struct xfs_log_item *lip) 758 struct xfs_log_item *lip)
777{ 759{
778 xfs_trans_free_item_desc(lip->li_desc); 760 clear_bit(XFS_LI_DIRTY, &lip->li_flags);
779 lip->li_desc = NULL; 761 list_del_init(&lip->li_trans);
780} 762}
781 763
782/* 764/* Detach and unlock all of the items in a transaction */
783 * Unlock all of the items of a transaction and free all the descriptors
784 * of that transaction.
785 */
786void 765void
787xfs_trans_free_items( 766xfs_trans_free_items(
788 struct xfs_trans *tp, 767 struct xfs_trans *tp,
789 xfs_lsn_t commit_lsn, 768 xfs_lsn_t commit_lsn,
790 bool abort) 769 bool abort)
791{ 770{
792 struct xfs_log_item_desc *lidp, *next; 771 struct xfs_log_item *lip, *next;
793 772
794 trace_xfs_trans_free_items(tp, _RET_IP_); 773 trace_xfs_trans_free_items(tp, _RET_IP_);
795 774
796 list_for_each_entry_safe(lidp, next, &tp->t_items, lid_trans) { 775 list_for_each_entry_safe(lip, next, &tp->t_items, li_trans) {
797 struct xfs_log_item *lip = lidp->lid_item; 776 xfs_trans_del_item(lip);
798
799 lip->li_desc = NULL;
800
801 if (commit_lsn != NULLCOMMITLSN) 777 if (commit_lsn != NULLCOMMITLSN)
802 lip->li_ops->iop_committing(lip, commit_lsn); 778 lip->li_ops->iop_committing(lip, commit_lsn);
803 if (abort) 779 if (abort)
804 set_bit(XFS_LI_ABORTED, &lip->li_flags); 780 set_bit(XFS_LI_ABORTED, &lip->li_flags);
805 lip->li_ops->iop_unlock(lip); 781 lip->li_ops->iop_unlock(lip);
806
807 xfs_trans_free_item_desc(lidp);
808 } 782 }
809} 783}
810 784
@@ -1052,10 +1026,10 @@ xfs_trans_cancel(
1052 } 1026 }
1053#ifdef DEBUG 1027#ifdef DEBUG
1054 if (!dirty && !XFS_FORCED_SHUTDOWN(mp)) { 1028 if (!dirty && !XFS_FORCED_SHUTDOWN(mp)) {
1055 struct xfs_log_item_desc *lidp; 1029 struct xfs_log_item *lip;
1056 1030
1057 list_for_each_entry(lidp, &tp->t_items, lid_trans) 1031 list_for_each_entry(lip, &tp->t_items, li_trans)
1058 ASSERT(!(lidp->lid_item->li_type == XFS_LI_EFD)); 1032 ASSERT(!(lip->li_type == XFS_LI_EFD));
1059 } 1033 }
1060#endif 1034#endif
1061 xfs_trans_unreserve_and_mod_sb(tp); 1035 xfs_trans_unreserve_and_mod_sb(tp);
diff --git a/fs/xfs/xfs_trans.h b/fs/xfs/xfs_trans.h
index ca449036f820..a386d8af56d2 100644
--- a/fs/xfs/xfs_trans.h
+++ b/fs/xfs/xfs_trans.h
@@ -27,7 +27,6 @@ struct xfs_efi_log_item;
27struct xfs_inode; 27struct xfs_inode;
28struct xfs_item_ops; 28struct xfs_item_ops;
29struct xfs_log_iovec; 29struct xfs_log_iovec;
30struct xfs_log_item_desc;
31struct xfs_mount; 30struct xfs_mount;
32struct xfs_trans; 31struct xfs_trans;
33struct xfs_trans_res; 32struct xfs_trans_res;
@@ -43,8 +42,8 @@ struct xfs_bud_log_item;
43 42
44typedef struct xfs_log_item { 43typedef struct xfs_log_item {
45 struct list_head li_ail; /* AIL pointers */ 44 struct list_head li_ail; /* AIL pointers */
45 struct list_head li_trans; /* transaction list */
46 xfs_lsn_t li_lsn; /* last on-disk lsn */ 46 xfs_lsn_t li_lsn; /* last on-disk lsn */
47 struct xfs_log_item_desc *li_desc; /* ptr to current desc*/
48 struct xfs_mount *li_mountp; /* ptr to fs mount */ 47 struct xfs_mount *li_mountp; /* ptr to fs mount */
49 struct xfs_ail *li_ailp; /* ptr to AIL */ 48 struct xfs_ail *li_ailp; /* ptr to AIL */
50 uint li_type; /* item type */ 49 uint li_type; /* item type */
@@ -72,11 +71,13 @@ typedef struct xfs_log_item {
72#define XFS_LI_IN_AIL 0 71#define XFS_LI_IN_AIL 0
73#define XFS_LI_ABORTED 1 72#define XFS_LI_ABORTED 1
74#define XFS_LI_FAILED 2 73#define XFS_LI_FAILED 2
74#define XFS_LI_DIRTY 3 /* log item dirty in transaction */
75 75
76#define XFS_LI_FLAGS \ 76#define XFS_LI_FLAGS \
77 { (1 << XFS_LI_IN_AIL), "IN_AIL" }, \ 77 { (1 << XFS_LI_IN_AIL), "IN_AIL" }, \
78 { (1 << XFS_LI_ABORTED), "ABORTED" }, \ 78 { (1 << XFS_LI_ABORTED), "ABORTED" }, \
79 { (1 << XFS_LI_FAILED), "FAILED" } 79 { (1 << XFS_LI_FAILED), "FAILED" }, \
80 { (1 << XFS_LI_DIRTY), "DIRTY" }
80 81
81struct xfs_item_ops { 82struct xfs_item_ops {
82 void (*iop_size)(xfs_log_item_t *, int *, int *); 83 void (*iop_size)(xfs_log_item_t *, int *, int *);
@@ -248,7 +249,6 @@ void xfs_trans_buf_copy_type(struct xfs_buf *dst_bp,
248 struct xfs_buf *src_bp); 249 struct xfs_buf *src_bp);
249 250
250extern kmem_zone_t *xfs_trans_zone; 251extern kmem_zone_t *xfs_trans_zone;
251extern kmem_zone_t *xfs_log_item_desc_zone;
252 252
253/* rmap updates */ 253/* rmap updates */
254enum xfs_rmap_intent_type; 254enum xfs_rmap_intent_type;
diff --git a/fs/xfs/xfs_trans_bmap.c b/fs/xfs/xfs_trans_bmap.c
index 14543d93cd4b..230a21df4b12 100644
--- a/fs/xfs/xfs_trans_bmap.c
+++ b/fs/xfs/xfs_trans_bmap.c
@@ -79,7 +79,7 @@ xfs_trans_log_finish_bmap_update(
79 * 2.) shuts down the filesystem 79 * 2.) shuts down the filesystem
80 */ 80 */
81 tp->t_flags |= XFS_TRANS_DIRTY; 81 tp->t_flags |= XFS_TRANS_DIRTY;
82 budp->bud_item.li_desc->lid_flags |= XFS_LID_DIRTY; 82 set_bit(XFS_LI_DIRTY, &budp->bud_item.li_flags);
83 83
84 return error; 84 return error;
85} 85}
@@ -158,7 +158,7 @@ xfs_bmap_update_log_item(
158 bmap = container_of(item, struct xfs_bmap_intent, bi_list); 158 bmap = container_of(item, struct xfs_bmap_intent, bi_list);
159 159
160 tp->t_flags |= XFS_TRANS_DIRTY; 160 tp->t_flags |= XFS_TRANS_DIRTY;
161 buip->bui_item.li_desc->lid_flags |= XFS_LID_DIRTY; 161 set_bit(XFS_LI_DIRTY, &buip->bui_item.li_flags);
162 162
163 /* 163 /*
164 * atomic_inc_return gives us the value after the increment; 164 * atomic_inc_return gives us the value after the increment;
diff --git a/fs/xfs/xfs_trans_buf.c b/fs/xfs/xfs_trans_buf.c
index 0081e9b3decf..a8ddb4eed279 100644
--- a/fs/xfs/xfs_trans_buf.c
+++ b/fs/xfs/xfs_trans_buf.c
@@ -40,7 +40,7 @@ xfs_trans_buf_item_match(
40 struct xfs_buf_map *map, 40 struct xfs_buf_map *map,
41 int nmaps) 41 int nmaps)
42{ 42{
43 struct xfs_log_item_desc *lidp; 43 struct xfs_log_item *lip;
44 struct xfs_buf_log_item *blip; 44 struct xfs_buf_log_item *blip;
45 int len = 0; 45 int len = 0;
46 int i; 46 int i;
@@ -48,8 +48,8 @@ xfs_trans_buf_item_match(
48 for (i = 0; i < nmaps; i++) 48 for (i = 0; i < nmaps; i++)
49 len += map[i].bm_len; 49 len += map[i].bm_len;
50 50
51 list_for_each_entry(lidp, &tp->t_items, lid_trans) { 51 list_for_each_entry(lip, &tp->t_items, li_trans) {
52 blip = (struct xfs_buf_log_item *)lidp->lid_item; 52 blip = (struct xfs_buf_log_item *)lip;
53 if (blip->bli_item.li_type == XFS_LI_BUF && 53 if (blip->bli_item.li_type == XFS_LI_BUF &&
54 blip->bli_buf->b_target == target && 54 blip->bli_buf->b_target == target &&
55 XFS_BUF_ADDR(blip->bli_buf) == map[0].bm_bn && 55 XFS_BUF_ADDR(blip->bli_buf) == map[0].bm_bn &&
@@ -100,14 +100,10 @@ _xfs_trans_bjoin(
100 atomic_inc(&bip->bli_refcount); 100 atomic_inc(&bip->bli_refcount);
101 101
102 /* 102 /*
103 * Get a log_item_desc to point at the new item. 103 * Attach the item to the transaction so we can find it in
104 * xfs_trans_get_buf() and friends.
104 */ 105 */
105 xfs_trans_add_item(tp, &bip->bli_item); 106 xfs_trans_add_item(tp, &bip->bli_item);
106
107 /*
108 * Initialize b_fsprivate2 so we can find it with incore_match()
109 * in xfs_trans_get_buf() and friends above.
110 */
111 bp->b_transp = tp; 107 bp->b_transp = tp;
112 108
113} 109}
@@ -391,7 +387,7 @@ xfs_trans_brelse(
391 * If the buffer is dirty within this transaction, we can't 387 * If the buffer is dirty within this transaction, we can't
392 * release it until we commit. 388 * release it until we commit.
393 */ 389 */
394 if (bip->bli_item.li_desc->lid_flags & XFS_LID_DIRTY) 390 if (test_bit(XFS_LI_DIRTY, &bip->bli_item.li_flags))
395 return; 391 return;
396 392
397 /* 393 /*
@@ -542,7 +538,7 @@ xfs_trans_dirty_buf(
542 bip->bli_flags |= XFS_BLI_DIRTY | XFS_BLI_LOGGED; 538 bip->bli_flags |= XFS_BLI_DIRTY | XFS_BLI_LOGGED;
543 539
544 tp->t_flags |= XFS_TRANS_DIRTY; 540 tp->t_flags |= XFS_TRANS_DIRTY;
545 bip->bli_item.li_desc->lid_flags |= XFS_LID_DIRTY; 541 set_bit(XFS_LI_DIRTY, &bip->bli_item.li_flags);
546} 542}
547 543
548/* 544/*
@@ -626,7 +622,7 @@ xfs_trans_binval(
626 ASSERT(!(bip->__bli_format.blf_flags & XFS_BLF_INODE_BUF)); 622 ASSERT(!(bip->__bli_format.blf_flags & XFS_BLF_INODE_BUF));
627 ASSERT(!(bip->__bli_format.blf_flags & XFS_BLFT_MASK)); 623 ASSERT(!(bip->__bli_format.blf_flags & XFS_BLFT_MASK));
628 ASSERT(bip->__bli_format.blf_flags & XFS_BLF_CANCEL); 624 ASSERT(bip->__bli_format.blf_flags & XFS_BLF_CANCEL);
629 ASSERT(bip->bli_item.li_desc->lid_flags & XFS_LID_DIRTY); 625 ASSERT(test_bit(XFS_LI_DIRTY, &bip->bli_item.li_flags));
630 ASSERT(tp->t_flags & XFS_TRANS_DIRTY); 626 ASSERT(tp->t_flags & XFS_TRANS_DIRTY);
631 return; 627 return;
632 } 628 }
@@ -642,7 +638,7 @@ xfs_trans_binval(
642 memset(bip->bli_formats[i].blf_data_map, 0, 638 memset(bip->bli_formats[i].blf_data_map, 0,
643 (bip->bli_formats[i].blf_map_size * sizeof(uint))); 639 (bip->bli_formats[i].blf_map_size * sizeof(uint)));
644 } 640 }
645 bip->bli_item.li_desc->lid_flags |= XFS_LID_DIRTY; 641 set_bit(XFS_LI_DIRTY, &bip->bli_item.li_flags);
646 tp->t_flags |= XFS_TRANS_DIRTY; 642 tp->t_flags |= XFS_TRANS_DIRTY;
647} 643}
648 644
diff --git a/fs/xfs/xfs_trans_dquot.c b/fs/xfs/xfs_trans_dquot.c
index c3d547211d16..c381c02cca45 100644
--- a/fs/xfs/xfs_trans_dquot.c
+++ b/fs/xfs/xfs_trans_dquot.c
@@ -77,7 +77,7 @@ xfs_trans_log_dquot(
77 ASSERT(XFS_DQ_IS_LOCKED(dqp)); 77 ASSERT(XFS_DQ_IS_LOCKED(dqp));
78 78
79 tp->t_flags |= XFS_TRANS_DIRTY; 79 tp->t_flags |= XFS_TRANS_DIRTY;
80 dqp->q_logitem.qli_item.li_desc->lid_flags |= XFS_LID_DIRTY; 80 set_bit(XFS_LI_DIRTY, &dqp->q_logitem.qli_item.li_flags);
81} 81}
82 82
83/* 83/*
@@ -879,7 +879,7 @@ xfs_trans_log_quotaoff_item(
879 xfs_qoff_logitem_t *qlp) 879 xfs_qoff_logitem_t *qlp)
880{ 880{
881 tp->t_flags |= XFS_TRANS_DIRTY; 881 tp->t_flags |= XFS_TRANS_DIRTY;
882 qlp->qql_item.li_desc->lid_flags |= XFS_LID_DIRTY; 882 set_bit(XFS_LI_DIRTY, &qlp->qql_item.li_flags);
883} 883}
884 884
885STATIC void 885STATIC void
diff --git a/fs/xfs/xfs_trans_extfree.c b/fs/xfs/xfs_trans_extfree.c
index f5620796ae25..c60395eea21f 100644
--- a/fs/xfs/xfs_trans_extfree.c
+++ b/fs/xfs/xfs_trans_extfree.c
@@ -90,7 +90,7 @@ xfs_trans_free_extent(
90 * 2.) shuts down the filesystem 90 * 2.) shuts down the filesystem
91 */ 91 */
92 tp->t_flags |= XFS_TRANS_DIRTY; 92 tp->t_flags |= XFS_TRANS_DIRTY;
93 efdp->efd_item.li_desc->lid_flags |= XFS_LID_DIRTY; 93 set_bit(XFS_LI_DIRTY, &efdp->efd_item.li_flags);
94 94
95 next_extent = efdp->efd_next_extent; 95 next_extent = efdp->efd_next_extent;
96 ASSERT(next_extent < efdp->efd_format.efd_nextents); 96 ASSERT(next_extent < efdp->efd_format.efd_nextents);
@@ -155,7 +155,7 @@ xfs_extent_free_log_item(
155 free = container_of(item, struct xfs_extent_free_item, xefi_list); 155 free = container_of(item, struct xfs_extent_free_item, xefi_list);
156 156
157 tp->t_flags |= XFS_TRANS_DIRTY; 157 tp->t_flags |= XFS_TRANS_DIRTY;
158 efip->efi_item.li_desc->lid_flags |= XFS_LID_DIRTY; 158 set_bit(XFS_LI_DIRTY, &efip->efi_item.li_flags);
159 159
160 /* 160 /*
161 * atomic_inc_return gives us the value after the increment; 161 * atomic_inc_return gives us the value after the increment;
@@ -273,7 +273,7 @@ xfs_agfl_free_finish_item(
273 * 2.) shuts down the filesystem 273 * 2.) shuts down the filesystem
274 */ 274 */
275 tp->t_flags |= XFS_TRANS_DIRTY; 275 tp->t_flags |= XFS_TRANS_DIRTY;
276 efdp->efd_item.li_desc->lid_flags |= XFS_LID_DIRTY; 276 set_bit(XFS_LI_DIRTY, &efdp->efd_item.li_flags);
277 277
278 next_extent = efdp->efd_next_extent; 278 next_extent = efdp->efd_next_extent;
279 ASSERT(next_extent < efdp->efd_format.efd_nextents); 279 ASSERT(next_extent < efdp->efd_format.efd_nextents);
diff --git a/fs/xfs/xfs_trans_inode.c b/fs/xfs/xfs_trans_inode.c
index 07cea592dc01..f7bd7960a90f 100644
--- a/fs/xfs/xfs_trans_inode.c
+++ b/fs/xfs/xfs_trans_inode.c
@@ -133,14 +133,13 @@ xfs_trans_log_inode(
133 * set however, then go ahead and bump the i_version counter 133 * set however, then go ahead and bump the i_version counter
134 * unconditionally. 134 * unconditionally.
135 */ 135 */
136 if (!(ip->i_itemp->ili_item.li_desc->lid_flags & XFS_LID_DIRTY) && 136 if (!test_and_set_bit(XFS_LI_DIRTY, &ip->i_itemp->ili_item.li_flags) &&
137 IS_I_VERSION(VFS_I(ip))) { 137 IS_I_VERSION(VFS_I(ip))) {
138 if (inode_maybe_inc_iversion(VFS_I(ip), flags & XFS_ILOG_CORE)) 138 if (inode_maybe_inc_iversion(VFS_I(ip), flags & XFS_ILOG_CORE))
139 flags |= XFS_ILOG_CORE; 139 flags |= XFS_ILOG_CORE;
140 } 140 }
141 141
142 tp->t_flags |= XFS_TRANS_DIRTY; 142 tp->t_flags |= XFS_TRANS_DIRTY;
143 ip->i_itemp->ili_item.li_desc->lid_flags |= XFS_LID_DIRTY;
144 143
145 /* 144 /*
146 * Always OR in the bits from the ili_last_fields field. 145 * Always OR in the bits from the ili_last_fields field.
diff --git a/fs/xfs/xfs_trans_priv.h b/fs/xfs/xfs_trans_priv.h
index 43f773297b9d..9717ae74b36d 100644
--- a/fs/xfs/xfs_trans_priv.h
+++ b/fs/xfs/xfs_trans_priv.h
@@ -19,7 +19,6 @@
19#define __XFS_TRANS_PRIV_H__ 19#define __XFS_TRANS_PRIV_H__
20 20
21struct xfs_log_item; 21struct xfs_log_item;
22struct xfs_log_item_desc;
23struct xfs_mount; 22struct xfs_mount;
24struct xfs_trans; 23struct xfs_trans;
25struct xfs_ail; 24struct xfs_ail;
diff --git a/fs/xfs/xfs_trans_refcount.c b/fs/xfs/xfs_trans_refcount.c
index 94c1877af834..c7f8e82f5bda 100644
--- a/fs/xfs/xfs_trans_refcount.c
+++ b/fs/xfs/xfs_trans_refcount.c
@@ -77,7 +77,7 @@ xfs_trans_log_finish_refcount_update(
77 * 2.) shuts down the filesystem 77 * 2.) shuts down the filesystem
78 */ 78 */
79 tp->t_flags |= XFS_TRANS_DIRTY; 79 tp->t_flags |= XFS_TRANS_DIRTY;
80 cudp->cud_item.li_desc->lid_flags |= XFS_LID_DIRTY; 80 set_bit(XFS_LI_DIRTY, &cudp->cud_item.li_flags);
81 81
82 return error; 82 return error;
83} 83}
@@ -154,7 +154,7 @@ xfs_refcount_update_log_item(
154 refc = container_of(item, struct xfs_refcount_intent, ri_list); 154 refc = container_of(item, struct xfs_refcount_intent, ri_list);
155 155
156 tp->t_flags |= XFS_TRANS_DIRTY; 156 tp->t_flags |= XFS_TRANS_DIRTY;
157 cuip->cui_item.li_desc->lid_flags |= XFS_LID_DIRTY; 157 set_bit(XFS_LI_DIRTY, &cuip->cui_item.li_flags);
158 158
159 /* 159 /*
160 * atomic_inc_return gives us the value after the increment; 160 * atomic_inc_return gives us the value after the increment;
diff --git a/fs/xfs/xfs_trans_rmap.c b/fs/xfs/xfs_trans_rmap.c
index 9b577beb43d7..5831ca0c270b 100644
--- a/fs/xfs/xfs_trans_rmap.c
+++ b/fs/xfs/xfs_trans_rmap.c
@@ -117,7 +117,7 @@ xfs_trans_log_finish_rmap_update(
117 * 2.) shuts down the filesystem 117 * 2.) shuts down the filesystem
118 */ 118 */
119 tp->t_flags |= XFS_TRANS_DIRTY; 119 tp->t_flags |= XFS_TRANS_DIRTY;
120 rudp->rud_item.li_desc->lid_flags |= XFS_LID_DIRTY; 120 set_bit(XFS_LI_DIRTY, &rudp->rud_item.li_flags);
121 121
122 return error; 122 return error;
123} 123}
@@ -175,7 +175,7 @@ xfs_rmap_update_log_item(
175 rmap = container_of(item, struct xfs_rmap_intent, ri_list); 175 rmap = container_of(item, struct xfs_rmap_intent, ri_list);
176 176
177 tp->t_flags |= XFS_TRANS_DIRTY; 177 tp->t_flags |= XFS_TRANS_DIRTY;
178 ruip->rui_item.li_desc->lid_flags |= XFS_LID_DIRTY; 178 set_bit(XFS_LI_DIRTY, &ruip->rui_item.li_flags);
179 179
180 /* 180 /*
181 * atomic_inc_return gives us the value after the increment; 181 * atomic_inc_return gives us the value after the increment;