xfs: split xfs_iformat_fork
xfs_iformat_fork is a weird catchall. Split it into one helper for the data fork and one for the attr fork, and then call both helper as well as the COW fork initialization from xfs_inode_from_disk. Order the COW fork initialization after the attr fork initialization given that it can't fail to simplify the error handling. Note that the newly split helpers are moved down the file in xfs_inode_fork.c to avoid the need for forward declarations. Signed-off-by: Christoph Hellwig <hch@lst.de> Reviewed-by: Brian Foster <bfoster@redhat.com> Reviewed-by: Darrick J. Wong <darrick.wong@oracle.com> Signed-off-by: Darrick J. Wong <darrick.wong@oracle.com>
This commit is contained in:

committed by
Darrick J. Wong

parent
cb7d585944
commit
9229d18e80
@@ -187,6 +187,10 @@ xfs_inode_from_disk(
|
||||
{
|
||||
struct xfs_icdinode *to = &ip->i_d;
|
||||
struct inode *inode = VFS_I(ip);
|
||||
int error;
|
||||
|
||||
ASSERT(ip->i_cowfp == NULL);
|
||||
ASSERT(ip->i_afp == NULL);
|
||||
|
||||
/*
|
||||
* Convert v1 inodes immediately to v2 inode format as this is the
|
||||
@@ -242,7 +246,21 @@ xfs_inode_from_disk(
|
||||
to->di_cowextsize = be32_to_cpu(from->di_cowextsize);
|
||||
}
|
||||
|
||||
return xfs_iformat_fork(ip, from);
|
||||
error = xfs_iformat_data_fork(ip, from);
|
||||
if (error)
|
||||
return error;
|
||||
if (XFS_DFORK_Q(from)) {
|
||||
error = xfs_iformat_attr_fork(ip, from);
|
||||
if (error)
|
||||
goto out_destroy_data_fork;
|
||||
}
|
||||
if (xfs_is_reflink_inode(ip))
|
||||
xfs_ifork_init_cow(ip);
|
||||
return 0;
|
||||
|
||||
out_destroy_data_fork:
|
||||
xfs_idestroy_fork(ip, XFS_DATA_FORK);
|
||||
return error;
|
||||
}
|
||||
|
||||
void
|
||||
|
Reference in New Issue
Block a user