Commit 5837f625 authored by Darrick J. Wong's avatar Darrick J. Wong

xfs: clean up iunlink functions

Fix some indentation issues with the iunlink functions and reorganize
the tops of the functions to be identical.  No functional changes.
Signed-off-by: default avatarDarrick J. Wong <darrick.wong@oracle.com>
Reviewed-by: default avatarBrian Foster <bfoster@redhat.com>
Reviewed-by: default avatarChristoph Hellwig <hch@lst.de>
parent c2b31643
...@@ -1918,26 +1918,24 @@ xfs_inactive( ...@@ -1918,26 +1918,24 @@ xfs_inactive(
*/ */
STATIC int STATIC int
xfs_iunlink( xfs_iunlink(
struct xfs_trans *tp, struct xfs_trans *tp,
struct xfs_inode *ip) struct xfs_inode *ip)
{ {
xfs_mount_t *mp = tp->t_mountp; struct xfs_mount *mp = tp->t_mountp;
xfs_agi_t *agi; struct xfs_agi *agi;
xfs_dinode_t *dip; struct xfs_dinode *dip;
xfs_buf_t *agibp; struct xfs_buf *agibp;
xfs_buf_t *ibp; struct xfs_buf *ibp;
xfs_agino_t agino; xfs_agnumber_t agno = XFS_INO_TO_AGNO(mp, ip->i_ino);
short bucket_index; xfs_agino_t agino = XFS_INO_TO_AGINO(mp, ip->i_ino);
int offset; short bucket_index = agino % XFS_AGI_UNLINKED_BUCKETS;
int error; int offset;
int error;
ASSERT(VFS_I(ip)->i_mode != 0); ASSERT(VFS_I(ip)->i_mode != 0);
/* /* Get the agi buffer first. It ensures lock ordering on the list. */
* Get the agi buffer first. It ensures lock ordering error = xfs_read_agi(mp, tp, agno, &agibp);
* on the list.
*/
error = xfs_read_agi(mp, tp, XFS_INO_TO_AGNO(mp, ip->i_ino), &agibp);
if (error) if (error)
return error; return error;
agi = XFS_BUF_TO_AGI(agibp); agi = XFS_BUF_TO_AGI(agibp);
...@@ -1946,9 +1944,6 @@ xfs_iunlink( ...@@ -1946,9 +1944,6 @@ xfs_iunlink(
* Get the index into the agi hash table for the * Get the index into the agi hash table for the
* list this inode will go on. * list this inode will go on.
*/ */
agino = XFS_INO_TO_AGINO(mp, ip->i_ino);
ASSERT(agino != 0);
bucket_index = agino % XFS_AGI_UNLINKED_BUCKETS;
ASSERT(agi->agi_unlinked[bucket_index]); ASSERT(agi->agi_unlinked[bucket_index]);
ASSERT(be32_to_cpu(agi->agi_unlinked[bucket_index]) != agino); ASSERT(be32_to_cpu(agi->agi_unlinked[bucket_index]) != agino);
...@@ -1995,45 +1990,35 @@ xfs_iunlink( ...@@ -1995,45 +1990,35 @@ xfs_iunlink(
*/ */
STATIC int STATIC int
xfs_iunlink_remove( xfs_iunlink_remove(
xfs_trans_t *tp, struct xfs_trans *tp,
xfs_inode_t *ip) struct xfs_inode *ip)
{ {
xfs_ino_t next_ino; struct xfs_mount *mp = tp->t_mountp;
xfs_mount_t *mp; struct xfs_agi *agi;
xfs_agi_t *agi; struct xfs_dinode *dip;
xfs_dinode_t *dip; struct xfs_buf *agibp;
xfs_buf_t *agibp; struct xfs_buf *ibp;
xfs_buf_t *ibp; struct xfs_buf *last_ibp;
xfs_agnumber_t agno; struct xfs_dinode *last_dip = NULL;
xfs_agino_t agino; xfs_ino_t next_ino;
xfs_agino_t next_agino; xfs_agnumber_t agno = XFS_INO_TO_AGNO(mp, ip->i_ino);
xfs_buf_t *last_ibp; xfs_agino_t agino = XFS_INO_TO_AGINO(mp, ip->i_ino);
xfs_dinode_t *last_dip = NULL; xfs_agino_t next_agino;
short bucket_index; short bucket_index = agino % XFS_AGI_UNLINKED_BUCKETS;
int offset, last_offset = 0; int offset;
int error; int last_offset = 0;
int error;
mp = tp->t_mountp;
agno = XFS_INO_TO_AGNO(mp, ip->i_ino);
/* /* Get the agi buffer first. It ensures lock ordering on the list. */
* Get the agi buffer first. It ensures lock ordering
* on the list.
*/
error = xfs_read_agi(mp, tp, agno, &agibp); error = xfs_read_agi(mp, tp, agno, &agibp);
if (error) if (error)
return error; return error;
agi = XFS_BUF_TO_AGI(agibp); agi = XFS_BUF_TO_AGI(agibp);
/* /*
* Get the index into the agi hash table for the * Get the index into the agi hash table for the
* list this inode will go on. * list this inode will go on.
*/ */
agino = XFS_INO_TO_AGINO(mp, ip->i_ino);
if (!xfs_verify_agino(mp, agno, agino))
return -EFSCORRUPTED;
bucket_index = agino % XFS_AGI_UNLINKED_BUCKETS;
if (!xfs_verify_agino(mp, agno, if (!xfs_verify_agino(mp, agno,
be32_to_cpu(agi->agi_unlinked[bucket_index]))) { be32_to_cpu(agi->agi_unlinked[bucket_index]))) {
XFS_CORRUPTION_ERROR(__func__, XFS_ERRLEVEL_LOW, mp, XFS_CORRUPTION_ERROR(__func__, XFS_ERRLEVEL_LOW, mp,
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment