diff options
author | Dave Chinner <dchinner@redhat.com> | 2013-08-12 06:49:39 -0400 |
---|---|---|
committer | Ben Myers <bpm@sgi.com> | 2013-08-12 17:42:30 -0400 |
commit | fde2227ce12b6d3e1945bd512da2a4a333331a2c (patch) | |
tree | 48bce1802731a4ddbaf9d4beaed5a1466b17b90e /fs/xfs/xfs_attr.c | |
parent | abec5f2bf991a03b055be36d918cd6f8f58cc83e (diff) |
xfs: split out attribute fork truncation code into separate file
The attribute inactivation code is not used by userspace, so like
the attribute listing, split it out into a separate file to minimise
the differences between the filesystem shared with libxfs in
userspace.
Signed-off-by: Dave Chinner <dchinner@redhat.com>
Reviewed-by: Mark Tinguely <tinguely@sgi.com>
Signed-off-by: Ben Myers <bpm@sgi.com>
Diffstat (limited to 'fs/xfs/xfs_attr.c')
-rw-r--r-- | fs/xfs/xfs_attr.c | 71 |
1 files changed, 0 insertions, 71 deletions
diff --git a/fs/xfs/xfs_attr.c b/fs/xfs/xfs_attr.c index e9fd5acb4305..6ab77e356a9d 100644 --- a/fs/xfs/xfs_attr.c +++ b/fs/xfs/xfs_attr.c | |||
@@ -610,77 +610,6 @@ xfs_attr_remove( | |||
610 | return xfs_attr_remove_int(dp, &xname, flags); | 610 | return xfs_attr_remove_int(dp, &xname, flags); |
611 | } | 611 | } |
612 | 612 | ||
613 | int /* error */ | ||
614 | xfs_attr_inactive(xfs_inode_t *dp) | ||
615 | { | ||
616 | xfs_trans_t *trans; | ||
617 | xfs_mount_t *mp; | ||
618 | int error; | ||
619 | |||
620 | mp = dp->i_mount; | ||
621 | ASSERT(! XFS_NOT_DQATTACHED(mp, dp)); | ||
622 | |||
623 | xfs_ilock(dp, XFS_ILOCK_SHARED); | ||
624 | if (!xfs_inode_hasattr(dp) || | ||
625 | dp->i_d.di_aformat == XFS_DINODE_FMT_LOCAL) { | ||
626 | xfs_iunlock(dp, XFS_ILOCK_SHARED); | ||
627 | return 0; | ||
628 | } | ||
629 | xfs_iunlock(dp, XFS_ILOCK_SHARED); | ||
630 | |||
631 | /* | ||
632 | * Start our first transaction of the day. | ||
633 | * | ||
634 | * All future transactions during this code must be "chained" off | ||
635 | * this one via the trans_dup() call. All transactions will contain | ||
636 | * the inode, and the inode will always be marked with trans_ihold(). | ||
637 | * Since the inode will be locked in all transactions, we must log | ||
638 | * the inode in every transaction to let it float upward through | ||
639 | * the log. | ||
640 | */ | ||
641 | trans = xfs_trans_alloc(mp, XFS_TRANS_ATTRINVAL); | ||
642 | if ((error = xfs_trans_reserve(trans, 0, XFS_ATTRINVAL_LOG_RES(mp), 0, | ||
643 | XFS_TRANS_PERM_LOG_RES, | ||
644 | XFS_ATTRINVAL_LOG_COUNT))) { | ||
645 | xfs_trans_cancel(trans, 0); | ||
646 | return(error); | ||
647 | } | ||
648 | xfs_ilock(dp, XFS_ILOCK_EXCL); | ||
649 | |||
650 | /* | ||
651 | * No need to make quota reservations here. We expect to release some | ||
652 | * blocks, not allocate, in the common case. | ||
653 | */ | ||
654 | xfs_trans_ijoin(trans, dp, 0); | ||
655 | |||
656 | /* | ||
657 | * Decide on what work routines to call based on the inode size. | ||
658 | */ | ||
659 | if (!xfs_inode_hasattr(dp) || | ||
660 | dp->i_d.di_aformat == XFS_DINODE_FMT_LOCAL) { | ||
661 | error = 0; | ||
662 | goto out; | ||
663 | } | ||
664 | error = xfs_attr3_root_inactive(&trans, dp); | ||
665 | if (error) | ||
666 | goto out; | ||
667 | |||
668 | error = xfs_itruncate_extents(&trans, dp, XFS_ATTR_FORK, 0); | ||
669 | if (error) | ||
670 | goto out; | ||
671 | |||
672 | error = xfs_trans_commit(trans, XFS_TRANS_RELEASE_LOG_RES); | ||
673 | xfs_iunlock(dp, XFS_ILOCK_EXCL); | ||
674 | |||
675 | return(error); | ||
676 | |||
677 | out: | ||
678 | xfs_trans_cancel(trans, XFS_TRANS_RELEASE_LOG_RES|XFS_TRANS_ABORT); | ||
679 | xfs_iunlock(dp, XFS_ILOCK_EXCL); | ||
680 | return(error); | ||
681 | } | ||
682 | |||
683 | |||
684 | 613 | ||
685 | /*======================================================================== | 614 | /*======================================================================== |
686 | * External routines when attribute list is inside the inode | 615 | * External routines when attribute list is inside the inode |