@@ -602,14 +602,18 @@ void
libxfs_compute_all_maxlevels(
struct xfs_mount *mp)
{
+ struct xfs_ino_geometry *igeo = M_IGEO(mp);
+
xfs_alloc_compute_maxlevels(mp);
xfs_bmap_compute_maxlevels(mp, XFS_DATA_FORK);
xfs_bmap_compute_maxlevels(mp, XFS_ATTR_FORK);
+ igeo->attr_fork_offset = xfs_bmap_compute_attr_offset(mp);
xfs_ialloc_setup_geometry(mp);
xfs_rmapbt_compute_maxlevels(mp);
xfs_refcountbt_compute_maxlevels(mp);
xfs_agbtree_compute_maxlevels(mp);
+
}
/*
@@ -274,11 +274,12 @@ libxfs_init_new_inode(
struct fsxattr *fsx,
struct xfs_inode **ipp)
{
+ struct xfs_mount *mp = tp->t_mountp;
struct xfs_inode *ip;
unsigned int flags;
int error;
- error = libxfs_iget(tp->t_mountp, tp, ino, XFS_IGET_CREATE, &ip);
+ error = libxfs_iget(mp, tp, ino, XFS_IGET_CREATE, &ip);
if (error != 0)
return error;
ASSERT(ip != NULL);
@@ -340,6 +341,22 @@ libxfs_init_new_inode(
ASSERT(0);
}
+ /*
+ * If we're going to set a parent pointer on this file, we need to
+ * create an attr fork to receive that parent pointer.
+ */
+ if (pip && xfs_has_parent(mp)) {
+ ip->i_forkoff = xfs_default_attroffset(ip) >> 3;
+ xfs_ifork_init_attr(ip, XFS_DINODE_FMT_EXTENTS, 0);
+
+ if (!xfs_has_attr(mp)) {
+ spin_lock(&mp->m_sb_lock);
+ xfs_add_attr(mp);
+ spin_unlock(&mp->m_sb_lock);
+ xfs_log_sb(tp);
+ }
+ }
+
/*
* Log the new values stuffed into the inode.
*/