mirror of
https://github.com/Fishwaldo/Star64_linux.git
synced 2025-06-20 21:51:05 +00:00
xfs: simplify inode to transaction joining
Currently we need to either call IHOLD or xfs_trans_ihold on an inode when joining it to a transaction via xfs_trans_ijoin. This patches instead makes xfs_trans_ijoin usable on it's own by doing an implicity xfs_trans_ihold, which also allows us to drop the third argument. For the case where we want to hold a reference on the inode a xfs_trans_ijoin_ref wrapper is added which does the IHOLD and marks the inode for needing an xfs_iput. In addition to the cleaner interface to the caller this also simplifies the implementation. Signed-off-by: Christoph Hellwig <hch@lst.de> Reviewed-by: Dave Chinner <dchinner@redhat.com>
This commit is contained in:
parent
4d16e9246f
commit
898621d5a7
19 changed files with 103 additions and 247 deletions
|
@ -169,26 +169,14 @@ xfs_rename(
|
|||
/*
|
||||
* Join all the inodes to the transaction. From this point on,
|
||||
* we can rely on either trans_commit or trans_cancel to unlock
|
||||
* them. Note that we need to add a vnode reference to the
|
||||
* directories since trans_commit & trans_cancel will decrement
|
||||
* them when they unlock the inodes. Also, we need to be careful
|
||||
* not to add an inode to the transaction more than once.
|
||||
* them.
|
||||
*/
|
||||
IHOLD(src_dp);
|
||||
xfs_trans_ijoin(tp, src_dp, XFS_ILOCK_EXCL);
|
||||
|
||||
if (new_parent) {
|
||||
IHOLD(target_dp);
|
||||
xfs_trans_ijoin(tp, target_dp, XFS_ILOCK_EXCL);
|
||||
}
|
||||
|
||||
IHOLD(src_ip);
|
||||
xfs_trans_ijoin(tp, src_ip, XFS_ILOCK_EXCL);
|
||||
|
||||
if (target_ip) {
|
||||
IHOLD(target_ip);
|
||||
xfs_trans_ijoin(tp, target_ip, XFS_ILOCK_EXCL);
|
||||
}
|
||||
xfs_trans_ijoin_ref(tp, src_dp, XFS_ILOCK_EXCL);
|
||||
if (new_parent)
|
||||
xfs_trans_ijoin_ref(tp, target_dp, XFS_ILOCK_EXCL);
|
||||
xfs_trans_ijoin_ref(tp, src_ip, XFS_ILOCK_EXCL);
|
||||
if (target_ip)
|
||||
xfs_trans_ijoin_ref(tp, target_ip, XFS_ILOCK_EXCL);
|
||||
|
||||
/*
|
||||
* If we are using project inheritance, we only allow renames
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue