aboutsummaryrefslogtreecommitdiffstats
path: root/fs/xfs
diff options
context:
space:
mode:
authorBrian Foster <bfoster@redhat.com>2018-08-01 10:20:33 -0400
committerDarrick J. Wong <darrick.wong@oracle.com>2018-08-03 02:05:14 -0400
commit60f31a609ed3d28791acb2bc24188cb7e2259176 (patch)
tree70672520f8148d5a6f7d2d80f1ad9d1dfa60fcc7 /fs/xfs
parent7dbddbaccd189e63c39c9e22c728c4548b9893bb (diff)
xfs: clean out superfluous dfops dop params/vars
The dfops code still passes around the xfs_defer_ops pointer superfluously in a few places. Clean this up wherever the transaction will suffice. 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_defer.c43
-rw-r--r--fs/xfs/libxfs/xfs_defer.h2
-rw-r--r--fs/xfs/xfs_trans.c2
3 files changed, 23 insertions, 24 deletions
diff --git a/fs/xfs/libxfs/xfs_defer.c b/fs/xfs/libxfs/xfs_defer.c
index 66ef9341813b..7079f534c735 100644
--- a/fs/xfs/libxfs/xfs_defer.c
+++ b/fs/xfs/libxfs/xfs_defer.c
@@ -181,9 +181,9 @@ static const struct xfs_defer_op_type *defer_op_types[XFS_DEFER_OPS_TYPE_MAX];
181 */ 181 */
182STATIC void 182STATIC void
183xfs_defer_intake_work( 183xfs_defer_intake_work(
184 struct xfs_trans *tp, 184 struct xfs_trans *tp)
185 struct xfs_defer_ops *dop)
186{ 185{
186 struct xfs_defer_ops *dop = tp->t_dfops;
187 struct list_head *li; 187 struct list_head *li;
188 struct xfs_defer_pending *dfp; 188 struct xfs_defer_pending *dfp;
189 189
@@ -204,9 +204,9 @@ xfs_defer_intake_work(
204STATIC void 204STATIC void
205xfs_defer_trans_abort( 205xfs_defer_trans_abort(
206 struct xfs_trans *tp, 206 struct xfs_trans *tp,
207 struct xfs_defer_ops *dop,
208 int error) 207 int error)
209{ 208{
209 struct xfs_defer_ops *dop = tp->t_dfops;
210 struct xfs_defer_pending *dfp; 210 struct xfs_defer_pending *dfp;
211 211
212 trace_xfs_defer_trans_abort(tp->t_mountp, dop, _RET_IP_); 212 trace_xfs_defer_trans_abort(tp->t_mountp, dop, _RET_IP_);
@@ -230,7 +230,6 @@ STATIC int
230xfs_defer_trans_roll( 230xfs_defer_trans_roll(
231 struct xfs_trans **tp) 231 struct xfs_trans **tp)
232{ 232{
233 struct xfs_defer_ops *dop = (*tp)->t_dfops;
234 struct xfs_buf_log_item *bli; 233 struct xfs_buf_log_item *bli;
235 struct xfs_inode_log_item *ili; 234 struct xfs_inode_log_item *ili;
236 struct xfs_log_item *lip; 235 struct xfs_log_item *lip;
@@ -272,14 +271,14 @@ xfs_defer_trans_roll(
272 } 271 }
273 } 272 }
274 273
275 trace_xfs_defer_trans_roll((*tp)->t_mountp, dop, _RET_IP_); 274 trace_xfs_defer_trans_roll((*tp)->t_mountp, (*tp)->t_dfops, _RET_IP_);
276 275
277 /* Roll the transaction. */ 276 /* Roll the transaction. */
278 error = xfs_trans_roll(tp); 277 error = xfs_trans_roll(tp);
279 dop = (*tp)->t_dfops;
280 if (error) { 278 if (error) {
281 trace_xfs_defer_trans_roll_error((*tp)->t_mountp, dop, error); 279 trace_xfs_defer_trans_roll_error((*tp)->t_mountp,
282 xfs_defer_trans_abort(*tp, dop, error); 280 (*tp)->t_dfops, error);
281 xfs_defer_trans_abort(*tp, error);
283 return error; 282 return error;
284 } 283 }
285 284
@@ -299,9 +298,10 @@ xfs_defer_trans_roll(
299/* Do we have any work items to finish? */ 298/* Do we have any work items to finish? */
300bool 299bool
301xfs_defer_has_unfinished_work( 300xfs_defer_has_unfinished_work(
302 struct xfs_defer_ops *dop) 301 struct xfs_trans *tp)
303{ 302{
304 return !list_empty(&dop->dop_pending) || !list_empty(&dop->dop_intake); 303 return !list_empty(&tp->t_dfops->dop_pending) ||
304 !list_empty(&tp->t_dfops->dop_intake);
305} 305}
306 306
307/* 307/*
@@ -311,7 +311,7 @@ static void
311xfs_defer_reset( 311xfs_defer_reset(
312 struct xfs_trans *tp) 312 struct xfs_trans *tp)
313{ 313{
314 ASSERT(!xfs_defer_has_unfinished_work(tp->t_dfops)); 314 ASSERT(!xfs_defer_has_unfinished_work(tp));
315 315
316 /* 316 /*
317 * Low mode state transfers across transaction rolls to mirror dfops 317 * Low mode state transfers across transaction rolls to mirror dfops
@@ -332,7 +332,6 @@ int
332xfs_defer_finish_noroll( 332xfs_defer_finish_noroll(
333 struct xfs_trans **tp) 333 struct xfs_trans **tp)
334{ 334{
335 struct xfs_defer_ops *dop = (*tp)->t_dfops;
336 struct xfs_defer_pending *dfp; 335 struct xfs_defer_pending *dfp;
337 struct list_head *li; 336 struct list_head *li;
338 struct list_head *n; 337 struct list_head *n;
@@ -342,24 +341,22 @@ xfs_defer_finish_noroll(
342 341
343 ASSERT((*tp)->t_flags & XFS_TRANS_PERM_LOG_RES); 342 ASSERT((*tp)->t_flags & XFS_TRANS_PERM_LOG_RES);
344 343
345 trace_xfs_defer_finish((*tp)->t_mountp, dop, _RET_IP_); 344 trace_xfs_defer_finish((*tp)->t_mountp, (*tp)->t_dfops, _RET_IP_);
346 345
347 /* Until we run out of pending work to finish... */ 346 /* Until we run out of pending work to finish... */
348 while (xfs_defer_has_unfinished_work(dop)) { 347 while (xfs_defer_has_unfinished_work(*tp)) {
349 /* Log intents for work items sitting in the intake. */ 348 /* Log intents for work items sitting in the intake. */
350 xfs_defer_intake_work(*tp, dop); 349 xfs_defer_intake_work(*tp);
351 350
352 /* 351 /*
353 * Roll the transaction and update dop in case dfops was 352 * Roll the transaction.
354 * embedded in the transaction.
355 */ 353 */
356 error = xfs_defer_trans_roll(tp); 354 error = xfs_defer_trans_roll(tp);
357 if (error) 355 if (error)
358 goto out; 356 goto out;
359 dop = (*tp)->t_dfops;
360 357
361 /* Log an intent-done item for the first pending item. */ 358 /* Log an intent-done item for the first pending item. */
362 dfp = list_first_entry(&dop->dop_pending, 359 dfp = list_first_entry(&(*tp)->t_dfops->dop_pending,
363 struct xfs_defer_pending, dfp_list); 360 struct xfs_defer_pending, dfp_list);
364 trace_xfs_defer_pending_finish((*tp)->t_mountp, dfp); 361 trace_xfs_defer_pending_finish((*tp)->t_mountp, dfp);
365 dfp->dfp_done = dfp->dfp_type->create_done(*tp, dfp->dfp_intent, 362 dfp->dfp_done = dfp->dfp_type->create_done(*tp, dfp->dfp_intent,
@@ -390,7 +387,7 @@ xfs_defer_finish_noroll(
390 */ 387 */
391 if (cleanup_fn) 388 if (cleanup_fn)
392 cleanup_fn(*tp, state, error); 389 cleanup_fn(*tp, state, error);
393 xfs_defer_trans_abort(*tp, dop, error); 390 xfs_defer_trans_abort(*tp, error);
394 goto out; 391 goto out;
395 } 392 }
396 } 393 }
@@ -420,9 +417,11 @@ xfs_defer_finish_noroll(
420 417
421out: 418out:
422 if (error) 419 if (error)
423 trace_xfs_defer_finish_error((*tp)->t_mountp, dop, error); 420 trace_xfs_defer_finish_error((*tp)->t_mountp, (*tp)->t_dfops,
421 error);
424 else 422 else
425 trace_xfs_defer_finish_done((*tp)->t_mountp, dop, _RET_IP_); 423 trace_xfs_defer_finish_done((*tp)->t_mountp, (*tp)->t_dfops,
424 _RET_IP_);
426 425
427 return error; 426 return error;
428} 427}
diff --git a/fs/xfs/libxfs/xfs_defer.h b/fs/xfs/libxfs/xfs_defer.h
index 0de7504e5651..f051c8056141 100644
--- a/fs/xfs/libxfs/xfs_defer.h
+++ b/fs/xfs/libxfs/xfs_defer.h
@@ -41,7 +41,7 @@ int xfs_defer_finish_noroll(struct xfs_trans **tp);
41int xfs_defer_finish(struct xfs_trans **tp); 41int xfs_defer_finish(struct xfs_trans **tp);
42void xfs_defer_cancel(struct xfs_trans *); 42void xfs_defer_cancel(struct xfs_trans *);
43void xfs_defer_init(struct xfs_trans *tp, struct xfs_defer_ops *dop); 43void xfs_defer_init(struct xfs_trans *tp, struct xfs_defer_ops *dop);
44bool xfs_defer_has_unfinished_work(struct xfs_defer_ops *dop); 44bool xfs_defer_has_unfinished_work(struct xfs_trans *tp);
45void xfs_defer_move(struct xfs_trans *dtp, struct xfs_trans *stp); 45void xfs_defer_move(struct xfs_trans *dtp, struct xfs_trans *stp);
46 46
47/* Description of a deferred type. */ 47/* Description of a deferred type. */
diff --git a/fs/xfs/xfs_trans.c b/fs/xfs/xfs_trans.c
index ae3c875a14e5..b0130b21f4de 100644
--- a/fs/xfs/xfs_trans.c
+++ b/fs/xfs/xfs_trans.c
@@ -929,7 +929,7 @@ __xfs_trans_commit(
929 * Finish deferred items on final commit. Only permanent transactions 929 * Finish deferred items on final commit. Only permanent transactions
930 * should ever have deferred ops. 930 * should ever have deferred ops.
931 */ 931 */
932 WARN_ON_ONCE(xfs_defer_has_unfinished_work(tp->t_dfops) && 932 WARN_ON_ONCE(xfs_defer_has_unfinished_work(tp) &&
933 !(tp->t_flags & XFS_TRANS_PERM_LOG_RES)); 933 !(tp->t_flags & XFS_TRANS_PERM_LOG_RES));
934 if (!regrant && (tp->t_flags & XFS_TRANS_PERM_LOG_RES)) { 934 if (!regrant && (tp->t_flags & XFS_TRANS_PERM_LOG_RES)) {
935 error = xfs_defer_finish_noroll(&tp); 935 error = xfs_defer_finish_noroll(&tp);