aboutsummaryrefslogtreecommitdiffstats
path: root/fs/xfs
diff options
context:
space:
mode:
authorChristoph Hellwig <hch@infradead.org>2012-07-04 11:13:30 -0400
committerBen Myers <bpm@sgi.com>2012-07-29 17:15:33 -0400
commitfe67be036ff2f713b1c5f24dd4cdffae75bcb97a (patch)
tree7e766ba9cd845b986a036e276e7cfcf646ab6516 /fs/xfs
parentb373e98daa70d7ddb10f53f81e711c4d17651795 (diff)
xfs: remove xfs_inactive_attrs
Remove this helper as the code flow is a lot more obvious when it gets merged into its only caller. Signed-off-by: Christoph Hellwig <hch@lst.de> Reviewed-by: Rich Johnston <rjohnston@sgi.com> Signed-off-by: Ben Myers <bpm@sgi.com>
Diffstat (limited to 'fs/xfs')
-rw-r--r--fs/xfs/xfs_vnodeops.c97
1 files changed, 36 insertions, 61 deletions
diff --git a/fs/xfs/xfs_vnodeops.c b/fs/xfs/xfs_vnodeops.c
index f9a515776a9c..9a2ae8c0ecc4 100644
--- a/fs/xfs/xfs_vnodeops.c
+++ b/fs/xfs/xfs_vnodeops.c
@@ -388,54 +388,6 @@ xfs_inactive_symlink_rmt(
388 return error; 388 return error;
389} 389}
390 390
391STATIC int
392xfs_inactive_attrs(
393 xfs_inode_t *ip,
394 xfs_trans_t **tpp)
395{
396 xfs_trans_t *tp;
397 int error;
398 xfs_mount_t *mp;
399
400 ASSERT(xfs_isilocked(ip, XFS_IOLOCK_EXCL));
401 tp = *tpp;
402 mp = ip->i_mount;
403 ASSERT(ip->i_d.di_forkoff != 0);
404 error = xfs_trans_commit(tp, XFS_TRANS_RELEASE_LOG_RES);
405 xfs_iunlock(ip, XFS_ILOCK_EXCL);
406 if (error)
407 goto error_unlock;
408
409 error = xfs_attr_inactive(ip);
410 if (error)
411 goto error_unlock;
412
413 tp = xfs_trans_alloc(mp, XFS_TRANS_INACTIVE);
414 error = xfs_trans_reserve(tp, 0,
415 XFS_IFREE_LOG_RES(mp),
416 0, XFS_TRANS_PERM_LOG_RES,
417 XFS_INACTIVE_LOG_COUNT);
418 if (error)
419 goto error_cancel;
420
421 xfs_ilock(ip, XFS_ILOCK_EXCL);
422 xfs_trans_ijoin(tp, ip, 0);
423 xfs_idestroy_fork(ip, XFS_ATTR_FORK);
424
425 ASSERT(ip->i_d.di_anextents == 0);
426
427 *tpp = tp;
428 return 0;
429
430error_cancel:
431 ASSERT(XFS_FORCED_SHUTDOWN(mp));
432 xfs_trans_cancel(tp, 0);
433error_unlock:
434 *tpp = NULL;
435 xfs_iunlock(ip, XFS_IOLOCK_EXCL);
436 return error;
437}
438
439int 391int
440xfs_release( 392xfs_release(
441 xfs_inode_t *ip) 393 xfs_inode_t *ip)
@@ -630,24 +582,40 @@ xfs_inactive(
630 } 582 }
631 583
632 /* 584 /*
633 * If there are attributes associated with the file 585 * If there are attributes associated with the file then blow them away
634 * then blow them away now. The code calls a routine 586 * now. The code calls a routine that recursively deconstructs the
635 * that recursively deconstructs the attribute fork. 587 * attribute fork. We need to just commit the current transaction
636 * We need to just commit the current transaction
637 * because we can't use it for xfs_attr_inactive(). 588 * because we can't use it for xfs_attr_inactive().
638 */ 589 */
639 if (ip->i_d.di_anextents > 0) { 590 if (ip->i_d.di_anextents > 0) {
640 error = xfs_inactive_attrs(ip, &tp); 591 ASSERT(ip->i_d.di_forkoff != 0);
641 /* 592
642 * If we got an error, the transaction is already 593 error = xfs_trans_commit(tp, XFS_TRANS_RELEASE_LOG_RES);
643 * cancelled, and the inode is unlocked. Just get out. 594 xfs_iunlock(ip, XFS_ILOCK_EXCL);
644 */ 595 if (error)
645 if (error) 596 goto error_unlock;
646 return VN_INACTIVE_CACHE; 597
647 } else if (ip->i_afp) { 598 error = xfs_attr_inactive(ip);
648 xfs_idestroy_fork(ip, XFS_ATTR_FORK); 599 if (error)
600 goto error_unlock;
601
602 tp = xfs_trans_alloc(mp, XFS_TRANS_INACTIVE);
603 error = xfs_trans_reserve(tp, 0,
604 XFS_IFREE_LOG_RES(mp),
605 0, XFS_TRANS_PERM_LOG_RES,
606 XFS_INACTIVE_LOG_COUNT);
607 if (error)
608 goto error_cancel;
609
610 xfs_ilock(ip, XFS_ILOCK_EXCL);
611 xfs_trans_ijoin(tp, ip, 0);
649 } 612 }
650 613
614 if (ip->i_afp)
615 xfs_idestroy_fork(ip, XFS_ATTR_FORK);
616
617 ASSERT(ip->i_d.di_anextents == 0);
618
651 /* 619 /*
652 * Free the inode. 620 * Free the inode.
653 */ 621 */
@@ -698,6 +666,13 @@ out_cancel:
698 xfs_trans_cancel(tp, XFS_TRANS_RELEASE_LOG_RES | XFS_TRANS_ABORT); 666 xfs_trans_cancel(tp, XFS_TRANS_RELEASE_LOG_RES | XFS_TRANS_ABORT);
699 xfs_iunlock(ip, XFS_IOLOCK_EXCL | XFS_ILOCK_EXCL); 667 xfs_iunlock(ip, XFS_IOLOCK_EXCL | XFS_ILOCK_EXCL);
700 return VN_INACTIVE_CACHE; 668 return VN_INACTIVE_CACHE;
669
670error_cancel:
671 ASSERT(XFS_FORCED_SHUTDOWN(mp));
672 xfs_trans_cancel(tp, 0);
673error_unlock:
674 xfs_iunlock(ip, XFS_IOLOCK_EXCL);
675 return VN_INACTIVE_CACHE;
701} 676}
702 677
703/* 678/*