diff options
author | Brian Foster <bfoster@redhat.com> | 2018-08-01 10:20:35 -0400 |
---|---|---|
committer | Darrick J. Wong <darrick.wong@oracle.com> | 2018-08-03 02:05:14 -0400 |
commit | 9d9e6233859706875c392707efd6d516cfb764fb (patch) | |
tree | 5d4ae3417bb8a60eb3ebaf63eaf54f9374498189 /fs/xfs/libxfs | |
parent | c03edc9e49b6a3c1f4b27f505a04093ab333b245 (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/libxfs')
-rw-r--r-- | fs/xfs/libxfs/xfs_bmap.c | 1 | ||||
-rw-r--r-- | fs/xfs/libxfs/xfs_btree.h | 1 | ||||
-rw-r--r-- | fs/xfs/libxfs/xfs_da_btree.h | 1 | ||||
-rw-r--r-- | fs/xfs/libxfs/xfs_defer.c | 67 | ||||
-rw-r--r-- | fs/xfs/libxfs/xfs_defer.h | 2 | ||||
-rw-r--r-- | fs/xfs/libxfs/xfs_dir2.c | 2 | ||||
-rw-r--r-- | fs/xfs/libxfs/xfs_dir2.h | 1 |
7 files changed, 19 insertions, 56 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 | ||
9 | struct xfs_buf; | 9 | struct xfs_buf; |
10 | struct xfs_defer_ops; | ||
11 | struct xfs_inode; | 10 | struct xfs_inode; |
12 | struct xfs_mount; | 11 | struct xfs_mount; |
13 | struct xfs_trans; | 12 | struct 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 | ||
10 | struct xfs_defer_ops; | ||
11 | struct xfs_inode; | 10 | struct xfs_inode; |
12 | struct xfs_trans; | 11 | struct xfs_trans; |
13 | struct zone; | 12 | struct 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 | |||
183 | xfs_defer_create_intents( | 183 | xfs_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 | |||
297 | xfs_defer_reset( | 294 | xfs_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. */ | ||
536 | void | ||
537 | xfs_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 | */ |
558 | void | 533 | void |
559 | xfs_defer_move( | 534 | xfs_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 | ||
9 | struct xfs_defer_op_type; | 9 | struct xfs_defer_op_type; |
10 | struct 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, | |||
40 | int xfs_defer_finish_noroll(struct xfs_trans **tp); | 39 | int xfs_defer_finish_noroll(struct xfs_trans **tp); |
41 | int xfs_defer_finish(struct xfs_trans **tp); | 40 | int xfs_defer_finish(struct xfs_trans **tp); |
42 | void xfs_defer_cancel(struct xfs_trans *); | 41 | void xfs_defer_cancel(struct xfs_trans *); |
43 | void xfs_defer_init(struct xfs_trans *tp, struct xfs_defer_ops *dop); | ||
44 | void xfs_defer_move(struct xfs_trans *dtp, struct xfs_trans *stp); | 42 | void 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 | ||
12 | struct xfs_defer_ops; | ||
13 | struct xfs_da_args; | 12 | struct xfs_da_args; |
14 | struct xfs_inode; | 13 | struct xfs_inode; |
15 | struct xfs_mount; | 14 | struct xfs_mount; |