aboutsummaryrefslogtreecommitdiffstats
path: root/fs/xfs
diff options
context:
space:
mode:
authorBrian Foster <bfoster@redhat.com>2018-08-01 10:20:35 -0400
committerDarrick J. Wong <darrick.wong@oracle.com>2018-08-03 02:05:14 -0400
commit9d9e6233859706875c392707efd6d516cfb764fb (patch)
tree5d4ae3417bb8a60eb3ebaf63eaf54f9374498189 /fs/xfs
parentc03edc9e49b6a3c1f4b27f505a04093ab333b245 (diff)
xfs: fold dfops into the transaction
struct xfs_defer_ops has now been reduced to a single list_head. The external dfops mechanism is unused and thus everywhere a (permanent) transaction is accessible the associated dfops structure is as well. Remove the xfs_defer_ops structure and fold the list_head into the transaction. Also remove the last remnant of external dfops in xfs_trans_dup(). Signed-off-by: Brian Foster <bfoster@redhat.com> Reviewed-by: Darrick J. Wong <darrick.wong@oracle.com> Reviewed-by: Christoph Hellwig <hch@lst.de> Signed-off-by: Darrick J. Wong <darrick.wong@oracle.com>
Diffstat (limited to 'fs/xfs')
-rw-r--r--fs/xfs/libxfs/xfs_bmap.c1
-rw-r--r--fs/xfs/libxfs/xfs_btree.h1
-rw-r--r--fs/xfs/libxfs/xfs_da_btree.h1
-rw-r--r--fs/xfs/libxfs/xfs_defer.c67
-rw-r--r--fs/xfs/libxfs/xfs_defer.h2
-rw-r--r--fs/xfs/libxfs/xfs_dir2.c2
-rw-r--r--fs/xfs/libxfs/xfs_dir2.h1
-rw-r--r--fs/xfs/xfs_inode.h1
-rw-r--r--fs/xfs/xfs_reflink.c5
-rw-r--r--fs/xfs/xfs_trace.h40
-rw-r--r--fs/xfs/xfs_trans.c13
-rw-r--r--fs/xfs/xfs_trans.h8
12 files changed, 46 insertions, 96 deletions
diff --git a/fs/xfs/libxfs/xfs_bmap.c b/fs/xfs/libxfs/xfs_bmap.c
index c9fec0443f38..5648a177e0ac 100644
--- a/fs/xfs/libxfs/xfs_bmap.c
+++ b/fs/xfs/libxfs/xfs_bmap.c
@@ -4286,7 +4286,6 @@ xfs_bmapi_write(
4286 bma.ip = ip; 4286 bma.ip = ip;
4287 bma.total = total; 4287 bma.total = total;
4288 bma.datatype = 0; 4288 bma.datatype = 0;
4289 ASSERT(!tp || tp->t_dfops);
4290 4289
4291 while (bno < end && n < *nmap) { 4290 while (bno < end && n < *nmap) {
4292 bool need_alloc = false, wasdelay = false; 4291 bool need_alloc = false, wasdelay = false;
diff --git a/fs/xfs/libxfs/xfs_btree.h b/fs/xfs/libxfs/xfs_btree.h
index 503615f4d729..e3b3e9dce5da 100644
--- a/fs/xfs/libxfs/xfs_btree.h
+++ b/fs/xfs/libxfs/xfs_btree.h
@@ -7,7 +7,6 @@
7#define __XFS_BTREE_H__ 7#define __XFS_BTREE_H__
8 8
9struct xfs_buf; 9struct xfs_buf;
10struct xfs_defer_ops;
11struct xfs_inode; 10struct xfs_inode;
12struct xfs_mount; 11struct xfs_mount;
13struct xfs_trans; 12struct xfs_trans;
diff --git a/fs/xfs/libxfs/xfs_da_btree.h b/fs/xfs/libxfs/xfs_da_btree.h
index 59e290ef334f..84dd865b6c3d 100644
--- a/fs/xfs/libxfs/xfs_da_btree.h
+++ b/fs/xfs/libxfs/xfs_da_btree.h
@@ -7,7 +7,6 @@
7#ifndef __XFS_DA_BTREE_H__ 7#ifndef __XFS_DA_BTREE_H__
8#define __XFS_DA_BTREE_H__ 8#define __XFS_DA_BTREE_H__
9 9
10struct xfs_defer_ops;
11struct xfs_inode; 10struct xfs_inode;
12struct xfs_trans; 11struct xfs_trans;
13struct zone; 12struct zone;
diff --git a/fs/xfs/libxfs/xfs_defer.c b/fs/xfs/libxfs/xfs_defer.c
index ce2286763531..e792b167150a 100644
--- a/fs/xfs/libxfs/xfs_defer.c
+++ b/fs/xfs/libxfs/xfs_defer.c
@@ -183,11 +183,10 @@ STATIC void
183xfs_defer_create_intents( 183xfs_defer_create_intents(
184 struct xfs_trans *tp) 184 struct xfs_trans *tp)
185{ 185{
186 struct xfs_defer_ops *dop = tp->t_dfops;
187 struct list_head *li; 186 struct list_head *li;
188 struct xfs_defer_pending *dfp; 187 struct xfs_defer_pending *dfp;
189 188
190 list_for_each_entry(dfp, &dop->dop_intake, dfp_list) { 189 list_for_each_entry(dfp, &tp->t_dfops, dfp_list) {
191 dfp->dfp_intent = dfp->dfp_type->create_intent(tp, 190 dfp->dfp_intent = dfp->dfp_type->create_intent(tp,
192 dfp->dfp_count); 191 dfp->dfp_count);
193 trace_xfs_defer_create_intent(tp->t_mountp, dfp); 192 trace_xfs_defer_create_intent(tp->t_mountp, dfp);
@@ -204,10 +203,9 @@ xfs_defer_trans_abort(
204 struct xfs_trans *tp, 203 struct xfs_trans *tp,
205 struct list_head *dop_pending) 204 struct list_head *dop_pending)
206{ 205{
207 struct xfs_defer_ops *dop = tp->t_dfops;
208 struct xfs_defer_pending *dfp; 206 struct xfs_defer_pending *dfp;
209 207
210 trace_xfs_defer_trans_abort(tp->t_mountp, dop, _RET_IP_); 208 trace_xfs_defer_trans_abort(tp, _RET_IP_);
211 209
212 /* Abort intent items that don't have a done item. */ 210 /* Abort intent items that don't have a done item. */
213 list_for_each_entry(dfp, dop_pending, dfp_list) { 211 list_for_each_entry(dfp, dop_pending, dfp_list) {
@@ -266,14 +264,13 @@ xfs_defer_trans_roll(
266 } 264 }
267 } 265 }
268 266
269 trace_xfs_defer_trans_roll(tp->t_mountp, tp->t_dfops, _RET_IP_); 267 trace_xfs_defer_trans_roll(tp, _RET_IP_);
270 268
271 /* Roll the transaction. */ 269 /* Roll the transaction. */
272 error = xfs_trans_roll(tpp); 270 error = xfs_trans_roll(tpp);
273 tp = *tpp; 271 tp = *tpp;
274 if (error) { 272 if (error) {
275 trace_xfs_defer_trans_roll_error(tp->t_mountp, 273 trace_xfs_defer_trans_roll_error(tp, error);
276 tp->t_dfops, error);
277 return error; 274 return error;
278 } 275 }
279 276
@@ -297,7 +294,7 @@ static void
297xfs_defer_reset( 294xfs_defer_reset(
298 struct xfs_trans *tp) 295 struct xfs_trans *tp)
299{ 296{
300 ASSERT(list_empty(&tp->t_dfops->dop_intake)); 297 ASSERT(list_empty(&tp->t_dfops));
301 298
302 /* 299 /*
303 * Low mode state transfers across transaction rolls to mirror dfops 300 * Low mode state transfers across transaction rolls to mirror dfops
@@ -358,15 +355,13 @@ xfs_defer_finish_noroll(
358 355
359 ASSERT((*tp)->t_flags & XFS_TRANS_PERM_LOG_RES); 356 ASSERT((*tp)->t_flags & XFS_TRANS_PERM_LOG_RES);
360 357
361 trace_xfs_defer_finish((*tp)->t_mountp, (*tp)->t_dfops, _RET_IP_); 358 trace_xfs_defer_finish(*tp, _RET_IP_);
362 359
363 /* Until we run out of pending work to finish... */ 360 /* Until we run out of pending work to finish... */
364 while (!list_empty(&dop_pending) || 361 while (!list_empty(&dop_pending) || !list_empty(&(*tp)->t_dfops)) {
365 !list_empty(&(*tp)->t_dfops->dop_intake)) {
366 /* log intents and pull in intake items */ 362 /* log intents and pull in intake items */
367 xfs_defer_create_intents(*tp); 363 xfs_defer_create_intents(*tp);
368 list_splice_tail_init(&(*tp)->t_dfops->dop_intake, 364 list_splice_tail_init(&(*tp)->t_dfops, &dop_pending);
369 &dop_pending);
370 365
371 /* 366 /*
372 * Roll the transaction. 367 * Roll the transaction.
@@ -438,14 +433,13 @@ out:
438 if (error) { 433 if (error) {
439 xfs_defer_trans_abort(*tp, &dop_pending); 434 xfs_defer_trans_abort(*tp, &dop_pending);
440 xfs_force_shutdown((*tp)->t_mountp, SHUTDOWN_CORRUPT_INCORE); 435 xfs_force_shutdown((*tp)->t_mountp, SHUTDOWN_CORRUPT_INCORE);
441 trace_xfs_defer_finish_error((*tp)->t_mountp, (*tp)->t_dfops, 436 trace_xfs_defer_finish_error(*tp, error);
442 error);
443 xfs_defer_cancel_list((*tp)->t_mountp, &dop_pending); 437 xfs_defer_cancel_list((*tp)->t_mountp, &dop_pending);
444 xfs_defer_cancel(*tp); 438 xfs_defer_cancel(*tp);
445 return error; 439 return error;
446 } 440 }
447 441
448 trace_xfs_defer_finish_done((*tp)->t_mountp, (*tp)->t_dfops, _RET_IP_); 442 trace_xfs_defer_finish_done(*tp, _RET_IP_);
449 return 0; 443 return 0;
450} 444}
451 445
@@ -480,8 +474,8 @@ xfs_defer_cancel(
480{ 474{
481 struct xfs_mount *mp = tp->t_mountp; 475 struct xfs_mount *mp = tp->t_mountp;
482 476
483 trace_xfs_defer_cancel(mp, tp->t_dfops, _RET_IP_); 477 trace_xfs_defer_cancel(tp, _RET_IP_);
484 xfs_defer_cancel_list(mp, &tp->t_dfops->dop_intake); 478 xfs_defer_cancel_list(mp, &tp->t_dfops);
485} 479}
486 480
487/* Add an item for later deferred processing. */ 481/* Add an item for later deferred processing. */
@@ -491,7 +485,6 @@ xfs_defer_add(
491 enum xfs_defer_ops_type type, 485 enum xfs_defer_ops_type type,
492 struct list_head *li) 486 struct list_head *li)
493{ 487{
494 struct xfs_defer_ops *dop = tp->t_dfops;
495 struct xfs_defer_pending *dfp = NULL; 488 struct xfs_defer_pending *dfp = NULL;
496 489
497 ASSERT(tp->t_flags & XFS_TRANS_PERM_LOG_RES); 490 ASSERT(tp->t_flags & XFS_TRANS_PERM_LOG_RES);
@@ -501,8 +494,8 @@ xfs_defer_add(
501 * If the last pending item has the same type, reuse it. Else, 494 * If the last pending item has the same type, reuse it. Else,
502 * create a new pending item at the end of the intake list. 495 * create a new pending item at the end of the intake list.
503 */ 496 */
504 if (!list_empty(&dop->dop_intake)) { 497 if (!list_empty(&tp->t_dfops)) {
505 dfp = list_last_entry(&dop->dop_intake, 498 dfp = list_last_entry(&tp->t_dfops,
506 struct xfs_defer_pending, dfp_list); 499 struct xfs_defer_pending, dfp_list);
507 if (dfp->dfp_type->type != type || 500 if (dfp->dfp_type->type != type ||
508 (dfp->dfp_type->max_items && 501 (dfp->dfp_type->max_items &&
@@ -517,7 +510,7 @@ xfs_defer_add(
517 dfp->dfp_done = NULL; 510 dfp->dfp_done = NULL;
518 dfp->dfp_count = 0; 511 dfp->dfp_count = 0;
519 INIT_LIST_HEAD(&dfp->dfp_work); 512 INIT_LIST_HEAD(&dfp->dfp_work);
520 list_add_tail(&dfp->dfp_list, &dop->dop_intake); 513 list_add_tail(&dfp->dfp_list, &tp->t_dfops);
521 } 514 }
522 515
523 list_add_tail(li, &dfp->dfp_work); 516 list_add_tail(li, &dfp->dfp_work);
@@ -532,39 +525,17 @@ xfs_defer_init_op_type(
532 defer_op_types[type->type] = type; 525 defer_op_types[type->type] = type;
533} 526}
534 527
535/* Initialize a deferred operation. */
536void
537xfs_defer_init(
538 struct xfs_trans *tp,
539 struct xfs_defer_ops *dop)
540{
541 struct xfs_mount *mp = NULL;
542
543 memset(dop, 0, sizeof(struct xfs_defer_ops));
544 INIT_LIST_HEAD(&dop->dop_intake);
545 if (tp) {
546 ASSERT(tp->t_firstblock == NULLFSBLOCK);
547 tp->t_dfops = dop;
548 mp = tp->t_mountp;
549 }
550 trace_xfs_defer_init(mp, dop, _RET_IP_);
551}
552
553/* 528/*
554 * Move state from one xfs_defer_ops to another and reset the source to initial 529 * Move deferred ops from one transaction to another and reset the source to
555 * state. This is primarily used to carry state forward across transaction rolls 530 * initial state. This is primarily used to carry state forward across
556 * with internal dfops. 531 * transaction rolls with pending dfops.
557 */ 532 */
558void 533void
559xfs_defer_move( 534xfs_defer_move(
560 struct xfs_trans *dtp, 535 struct xfs_trans *dtp,
561 struct xfs_trans *stp) 536 struct xfs_trans *stp)
562{ 537{
563 struct xfs_defer_ops *dst = dtp->t_dfops; 538 list_splice_init(&stp->t_dfops, &dtp->t_dfops);
564 struct xfs_defer_ops *src = stp->t_dfops;
565 ASSERT(dst != src);
566
567 list_splice_init(&src->dop_intake, &dst->dop_intake);
568 539
569 /* 540 /*
570 * Low free space mode was historically controlled by a dfops field. 541 * Low free space mode was historically controlled by a dfops field.
diff --git a/fs/xfs/libxfs/xfs_defer.h b/fs/xfs/libxfs/xfs_defer.h
index b2675f1ca909..2584a5b95b0d 100644
--- a/fs/xfs/libxfs/xfs_defer.h
+++ b/fs/xfs/libxfs/xfs_defer.h
@@ -7,7 +7,6 @@
7#define __XFS_DEFER_H__ 7#define __XFS_DEFER_H__
8 8
9struct xfs_defer_op_type; 9struct xfs_defer_op_type;
10struct xfs_defer_ops;
11 10
12/* 11/*
13 * Save a log intent item and a list of extents, so that we can replay 12 * Save a log intent item and a list of extents, so that we can replay
@@ -40,7 +39,6 @@ void xfs_defer_add(struct xfs_trans *tp, enum xfs_defer_ops_type type,
40int xfs_defer_finish_noroll(struct xfs_trans **tp); 39int xfs_defer_finish_noroll(struct xfs_trans **tp);
41int xfs_defer_finish(struct xfs_trans **tp); 40int xfs_defer_finish(struct xfs_trans **tp);
42void xfs_defer_cancel(struct xfs_trans *); 41void xfs_defer_cancel(struct xfs_trans *);
43void xfs_defer_init(struct xfs_trans *tp, struct xfs_defer_ops *dop);
44void xfs_defer_move(struct xfs_trans *dtp, struct xfs_trans *stp); 42void xfs_defer_move(struct xfs_trans *dtp, struct xfs_trans *stp);
45 43
46/* Description of a deferred type. */ 44/* Description of a deferred type. */
diff --git a/fs/xfs/libxfs/xfs_dir2.c b/fs/xfs/libxfs/xfs_dir2.c
index 4ea1fddb126f..229152cd1a24 100644
--- a/fs/xfs/libxfs/xfs_dir2.c
+++ b/fs/xfs/libxfs/xfs_dir2.c
@@ -424,7 +424,6 @@ xfs_dir_removename(
424 int v; /* type-checking value */ 424 int v; /* type-checking value */
425 425
426 ASSERT(S_ISDIR(VFS_I(dp)->i_mode)); 426 ASSERT(S_ISDIR(VFS_I(dp)->i_mode));
427 ASSERT(tp->t_dfops);
428 XFS_STATS_INC(dp->i_mount, xs_dir_remove); 427 XFS_STATS_INC(dp->i_mount, xs_dir_remove);
429 428
430 args = kmem_zalloc(sizeof(*args), KM_SLEEP | KM_NOFS); 429 args = kmem_zalloc(sizeof(*args), KM_SLEEP | KM_NOFS);
@@ -483,7 +482,6 @@ xfs_dir_replace(
483 int v; /* type-checking value */ 482 int v; /* type-checking value */
484 483
485 ASSERT(S_ISDIR(VFS_I(dp)->i_mode)); 484 ASSERT(S_ISDIR(VFS_I(dp)->i_mode));
486 ASSERT(tp->t_dfops);
487 485
488 rval = xfs_dir_ino_validate(tp->t_mountp, inum); 486 rval = xfs_dir_ino_validate(tp->t_mountp, inum);
489 if (rval) 487 if (rval)
diff --git a/fs/xfs/libxfs/xfs_dir2.h b/fs/xfs/libxfs/xfs_dir2.h
index ba5acd03de94..c3e3f6b813d8 100644
--- a/fs/xfs/libxfs/xfs_dir2.h
+++ b/fs/xfs/libxfs/xfs_dir2.h
@@ -9,7 +9,6 @@
9#include "xfs_da_format.h" 9#include "xfs_da_format.h"
10#include "xfs_da_btree.h" 10#include "xfs_da_btree.h"
11 11
12struct xfs_defer_ops;
13struct xfs_da_args; 12struct xfs_da_args;
14struct xfs_inode; 13struct xfs_inode;
15struct xfs_mount; 14struct xfs_mount;
diff --git a/fs/xfs/xfs_inode.h b/fs/xfs/xfs_inode.h
index 79a3e61a6991..be2014520155 100644
--- a/fs/xfs/xfs_inode.h
+++ b/fs/xfs/xfs_inode.h
@@ -15,7 +15,6 @@
15struct xfs_dinode; 15struct xfs_dinode;
16struct xfs_inode; 16struct xfs_inode;
17struct xfs_buf; 17struct xfs_buf;
18struct xfs_defer_ops;
19struct xfs_bmbt_irec; 18struct xfs_bmbt_irec;
20struct xfs_inode_log_item; 19struct xfs_inode_log_item;
21struct xfs_mount; 20struct xfs_mount;
diff --git a/fs/xfs/xfs_reflink.c b/fs/xfs/xfs_reflink.c
index cbceb320a2e7..38f405415b88 100644
--- a/fs/xfs/xfs_reflink.c
+++ b/fs/xfs/xfs_reflink.c
@@ -502,7 +502,6 @@ xfs_reflink_cancel_cow_blocks(
502 if (error) 502 if (error)
503 break; 503 break;
504 } else if (del.br_state == XFS_EXT_UNWRITTEN || cancel_real) { 504 } else if (del.br_state == XFS_EXT_UNWRITTEN || cancel_real) {
505 ASSERT((*tpp)->t_dfops);
506 ASSERT((*tpp)->t_firstblock == NULLFSBLOCK); 505 ASSERT((*tpp)->t_firstblock == NULLFSBLOCK);
507 506
508 /* Free the CoW orphan record. */ 507 /* Free the CoW orphan record. */
@@ -678,7 +677,7 @@ xfs_reflink_end_cow(
678 goto prev_extent; 677 goto prev_extent;
679 678
680 /* Unmap the old blocks in the data fork. */ 679 /* Unmap the old blocks in the data fork. */
681 ASSERT(tp->t_dfops && tp->t_firstblock == NULLFSBLOCK); 680 ASSERT(tp->t_firstblock == NULLFSBLOCK);
682 rlen = del.br_blockcount; 681 rlen = del.br_blockcount;
683 error = __xfs_bunmapi(tp, ip, del.br_startoff, &rlen, 0, 1); 682 error = __xfs_bunmapi(tp, ip, del.br_startoff, &rlen, 0, 1);
684 if (error) 683 if (error)
@@ -1021,7 +1020,7 @@ xfs_reflink_remap_extent(
1021 /* Unmap the old blocks in the data fork. */ 1020 /* Unmap the old blocks in the data fork. */
1022 rlen = unmap_len; 1021 rlen = unmap_len;
1023 while (rlen) { 1022 while (rlen) {
1024 ASSERT(tp->t_dfops && tp->t_firstblock == NULLFSBLOCK); 1023 ASSERT(tp->t_firstblock == NULLFSBLOCK);
1025 error = __xfs_bunmapi(tp, ip, destoff, &rlen, 0, 1); 1024 error = __xfs_bunmapi(tp, ip, destoff, &rlen, 0, 1);
1026 if (error) 1025 if (error)
1027 goto out_cancel; 1026 goto out_cancel;
diff --git a/fs/xfs/xfs_trace.h b/fs/xfs/xfs_trace.h
index fec9cfe3dfb4..ad315e83bc02 100644
--- a/fs/xfs/xfs_trace.h
+++ b/fs/xfs/xfs_trace.h
@@ -2213,57 +2213,54 @@ DEFINE_BTREE_CUR_EVENT(xfs_btree_overlapped_query_range);
2213 2213
2214/* deferred ops */ 2214/* deferred ops */
2215struct xfs_defer_pending; 2215struct xfs_defer_pending;
2216struct xfs_defer_ops;
2217 2216
2218DECLARE_EVENT_CLASS(xfs_defer_class, 2217DECLARE_EVENT_CLASS(xfs_defer_class,
2219 TP_PROTO(struct xfs_mount *mp, struct xfs_defer_ops *dop, 2218 TP_PROTO(struct xfs_trans *tp, unsigned long caller_ip),
2220 unsigned long caller_ip), 2219 TP_ARGS(tp, caller_ip),
2221 TP_ARGS(mp, dop, caller_ip),
2222 TP_STRUCT__entry( 2220 TP_STRUCT__entry(
2223 __field(dev_t, dev) 2221 __field(dev_t, dev)
2224 __field(void *, dop) 2222 __field(struct xfs_trans *, tp)
2225 __field(char, committed) 2223 __field(char, committed)
2226 __field(unsigned long, caller_ip) 2224 __field(unsigned long, caller_ip)
2227 ), 2225 ),
2228 TP_fast_assign( 2226 TP_fast_assign(
2229 __entry->dev = mp ? mp->m_super->s_dev : 0; 2227 __entry->dev = tp->t_mountp->m_super->s_dev;
2230 __entry->dop = dop; 2228 __entry->tp = tp;
2231 __entry->caller_ip = caller_ip; 2229 __entry->caller_ip = caller_ip;
2232 ), 2230 ),
2233 TP_printk("dev %d:%d ops %p caller %pS", 2231 TP_printk("dev %d:%d tp %p caller %pS",
2234 MAJOR(__entry->dev), MINOR(__entry->dev), 2232 MAJOR(__entry->dev), MINOR(__entry->dev),
2235 __entry->dop, 2233 __entry->tp,
2236 (char *)__entry->caller_ip) 2234 (char *)__entry->caller_ip)
2237) 2235)
2238#define DEFINE_DEFER_EVENT(name) \ 2236#define DEFINE_DEFER_EVENT(name) \
2239DEFINE_EVENT(xfs_defer_class, name, \ 2237DEFINE_EVENT(xfs_defer_class, name, \
2240 TP_PROTO(struct xfs_mount *mp, struct xfs_defer_ops *dop, \ 2238 TP_PROTO(struct xfs_trans *tp, unsigned long caller_ip), \
2241 unsigned long caller_ip), \ 2239 TP_ARGS(tp, caller_ip))
2242 TP_ARGS(mp, dop, caller_ip))
2243 2240
2244DECLARE_EVENT_CLASS(xfs_defer_error_class, 2241DECLARE_EVENT_CLASS(xfs_defer_error_class,
2245 TP_PROTO(struct xfs_mount *mp, struct xfs_defer_ops *dop, int error), 2242 TP_PROTO(struct xfs_trans *tp, int error),
2246 TP_ARGS(mp, dop, error), 2243 TP_ARGS(tp, error),
2247 TP_STRUCT__entry( 2244 TP_STRUCT__entry(
2248 __field(dev_t, dev) 2245 __field(dev_t, dev)
2249 __field(void *, dop) 2246 __field(struct xfs_trans *, tp)
2250 __field(char, committed) 2247 __field(char, committed)
2251 __field(int, error) 2248 __field(int, error)
2252 ), 2249 ),
2253 TP_fast_assign( 2250 TP_fast_assign(
2254 __entry->dev = mp ? mp->m_super->s_dev : 0; 2251 __entry->dev = tp->t_mountp->m_super->s_dev;
2255 __entry->dop = dop; 2252 __entry->tp = tp;
2256 __entry->error = error; 2253 __entry->error = error;
2257 ), 2254 ),
2258 TP_printk("dev %d:%d ops %p err %d", 2255 TP_printk("dev %d:%d tp %p err %d",
2259 MAJOR(__entry->dev), MINOR(__entry->dev), 2256 MAJOR(__entry->dev), MINOR(__entry->dev),
2260 __entry->dop, 2257 __entry->tp,
2261 __entry->error) 2258 __entry->error)
2262) 2259)
2263#define DEFINE_DEFER_ERROR_EVENT(name) \ 2260#define DEFINE_DEFER_ERROR_EVENT(name) \
2264DEFINE_EVENT(xfs_defer_error_class, name, \ 2261DEFINE_EVENT(xfs_defer_error_class, name, \
2265 TP_PROTO(struct xfs_mount *mp, struct xfs_defer_ops *dop, int error), \ 2262 TP_PROTO(struct xfs_trans *tp, int error), \
2266 TP_ARGS(mp, dop, error)) 2263 TP_ARGS(tp, error))
2267 2264
2268DECLARE_EVENT_CLASS(xfs_defer_pending_class, 2265DECLARE_EVENT_CLASS(xfs_defer_pending_class,
2269 TP_PROTO(struct xfs_mount *mp, struct xfs_defer_pending *dfp), 2266 TP_PROTO(struct xfs_mount *mp, struct xfs_defer_pending *dfp),
@@ -2382,7 +2379,6 @@ DEFINE_EVENT(xfs_map_extent_deferred_class, name, \
2382 xfs_exntst_t state), \ 2379 xfs_exntst_t state), \
2383 TP_ARGS(mp, agno, op, agbno, ino, whichfork, offset, len, state)) 2380 TP_ARGS(mp, agno, op, agbno, ino, whichfork, offset, len, state))
2384 2381
2385DEFINE_DEFER_EVENT(xfs_defer_init);
2386DEFINE_DEFER_EVENT(xfs_defer_cancel); 2382DEFINE_DEFER_EVENT(xfs_defer_cancel);
2387DEFINE_DEFER_EVENT(xfs_defer_trans_roll); 2383DEFINE_DEFER_EVENT(xfs_defer_trans_roll);
2388DEFINE_DEFER_EVENT(xfs_defer_trans_abort); 2384DEFINE_DEFER_EVENT(xfs_defer_trans_abort);
diff --git a/fs/xfs/xfs_trans.c b/fs/xfs/xfs_trans.c
index 413e4138357f..bedc5a5133a5 100644
--- a/fs/xfs/xfs_trans.c
+++ b/fs/xfs/xfs_trans.c
@@ -100,6 +100,7 @@ xfs_trans_dup(
100 ntp->t_mountp = tp->t_mountp; 100 ntp->t_mountp = tp->t_mountp;
101 INIT_LIST_HEAD(&ntp->t_items); 101 INIT_LIST_HEAD(&ntp->t_items);
102 INIT_LIST_HEAD(&ntp->t_busy); 102 INIT_LIST_HEAD(&ntp->t_busy);
103 INIT_LIST_HEAD(&ntp->t_dfops);
103 ntp->t_firstblock = NULLFSBLOCK; 104 ntp->t_firstblock = NULLFSBLOCK;
104 105
105 ASSERT(tp->t_flags & XFS_TRANS_PERM_LOG_RES); 106 ASSERT(tp->t_flags & XFS_TRANS_PERM_LOG_RES);
@@ -120,12 +121,8 @@ xfs_trans_dup(
120 tp->t_rtx_res = tp->t_rtx_res_used; 121 tp->t_rtx_res = tp->t_rtx_res_used;
121 ntp->t_pflags = tp->t_pflags; 122 ntp->t_pflags = tp->t_pflags;
122 123
123 /* copy the dfops pointer if it's external, otherwise move it */ 124 /* move deferred ops over to the new tp */
124 xfs_defer_init(ntp, &ntp->t_dfops_internal); 125 xfs_defer_move(ntp, tp);
125 if (tp->t_dfops != &tp->t_dfops_internal)
126 ntp->t_dfops = tp->t_dfops;
127 else
128 xfs_defer_move(ntp, tp);
129 126
130 xfs_trans_dup_dqinfo(tp, ntp); 127 xfs_trans_dup_dqinfo(tp, ntp);
131 128
@@ -280,8 +277,8 @@ xfs_trans_alloc(
280 tp->t_mountp = mp; 277 tp->t_mountp = mp;
281 INIT_LIST_HEAD(&tp->t_items); 278 INIT_LIST_HEAD(&tp->t_items);
282 INIT_LIST_HEAD(&tp->t_busy); 279 INIT_LIST_HEAD(&tp->t_busy);
280 INIT_LIST_HEAD(&tp->t_dfops);
283 tp->t_firstblock = NULLFSBLOCK; 281 tp->t_firstblock = NULLFSBLOCK;
284 xfs_defer_init(tp, &tp->t_dfops_internal);
285 282
286 error = xfs_trans_reserve(tp, resp, blocks, rtextents); 283 error = xfs_trans_reserve(tp, resp, blocks, rtextents);
287 if (error) { 284 if (error) {
@@ -929,7 +926,7 @@ __xfs_trans_commit(
929 * Finish deferred items on final commit. Only permanent transactions 926 * Finish deferred items on final commit. Only permanent transactions
930 * should ever have deferred ops. 927 * should ever have deferred ops.
931 */ 928 */
932 WARN_ON_ONCE(!list_empty(&tp->t_dfops->dop_intake) && 929 WARN_ON_ONCE(!list_empty(&tp->t_dfops) &&
933 !(tp->t_flags & XFS_TRANS_PERM_LOG_RES)); 930 !(tp->t_flags & XFS_TRANS_PERM_LOG_RES));
934 if (!regrant && (tp->t_flags & XFS_TRANS_PERM_LOG_RES)) { 931 if (!regrant && (tp->t_flags & XFS_TRANS_PERM_LOG_RES)) {
935 error = xfs_defer_finish_noroll(&tp); 932 error = xfs_defer_finish_noroll(&tp);
diff --git a/fs/xfs/xfs_trans.h b/fs/xfs/xfs_trans.h
index 1cdc7c0ebeac..c3d278e96ad1 100644
--- a/fs/xfs/xfs_trans.h
+++ b/fs/xfs/xfs_trans.h
@@ -90,13 +90,10 @@ void xfs_log_item_init(struct xfs_mount *mp, struct xfs_log_item *item,
90#define XFS_ITEM_FLUSHING 3 90#define XFS_ITEM_FLUSHING 3
91 91
92/* 92/*
93 * Deferred operations tracking structure. 93 * Deferred operation item relogging limits.
94 */ 94 */
95#define XFS_DEFER_OPS_NR_INODES 2 /* join up to two inodes */ 95#define XFS_DEFER_OPS_NR_INODES 2 /* join up to two inodes */
96#define XFS_DEFER_OPS_NR_BUFS 2 /* join up to two buffers */ 96#define XFS_DEFER_OPS_NR_BUFS 2 /* join up to two buffers */
97struct xfs_defer_ops {
98 struct list_head dop_intake; /* unlogged pending work */
99};
100 97
101/* 98/*
102 * This is the structure maintained for every active transaction. 99 * This is the structure maintained for every active transaction.
@@ -114,7 +111,6 @@ typedef struct xfs_trans {
114 struct xlog_ticket *t_ticket; /* log mgr ticket */ 111 struct xlog_ticket *t_ticket; /* log mgr ticket */
115 struct xfs_mount *t_mountp; /* ptr to fs mount struct */ 112 struct xfs_mount *t_mountp; /* ptr to fs mount struct */
116 struct xfs_dquot_acct *t_dqinfo; /* acctg info for dquots */ 113 struct xfs_dquot_acct *t_dqinfo; /* acctg info for dquots */
117 struct xfs_defer_ops *t_dfops; /* dfops reference */
118 int64_t t_icount_delta; /* superblock icount change */ 114 int64_t t_icount_delta; /* superblock icount change */
119 int64_t t_ifree_delta; /* superblock ifree change */ 115 int64_t t_ifree_delta; /* superblock ifree change */
120 int64_t t_fdblocks_delta; /* superblock fdblocks chg */ 116 int64_t t_fdblocks_delta; /* superblock fdblocks chg */
@@ -136,8 +132,8 @@ typedef struct xfs_trans {
136 int64_t t_rextslog_delta;/* superblocks rextslog chg */ 132 int64_t t_rextslog_delta;/* superblocks rextslog chg */
137 struct list_head t_items; /* log item descriptors */ 133 struct list_head t_items; /* log item descriptors */
138 struct list_head t_busy; /* list of busy extents */ 134 struct list_head t_busy; /* list of busy extents */
135 struct list_head t_dfops; /* deferred operations */
139 unsigned long t_pflags; /* saved process flags state */ 136 unsigned long t_pflags; /* saved process flags state */
140 struct xfs_defer_ops t_dfops_internal;
141} xfs_trans_t; 137} xfs_trans_t;
142 138
143/* 139/*