xfs
[Top] [All Lists]

[RFC 08/17] xfs: (parent ptr) add parent pointer support to xfs_symlink

To: xfs@xxxxxxxxxxx
Subject: [RFC 08/17] xfs: (parent ptr) add parent pointer support to xfs_symlink
From: Mark Tinguely <tinguely@xxxxxxx>
Date: Wed, 15 Jan 2014 16:00:20 -0600
Delivered-to: xfs@xxxxxxxxxxx
References: <20140115220012.624438534@xxxxxxx>
User-agent: quilt/0.51-1
Add the parent inode / entry offset into the parent inode entries
when creating a new symbolic link. The first entry will always
go into the inode.

---
 fs/xfs/xfs_symlink.c |   10 +++++++++-
 1 file changed, 9 insertions(+), 1 deletion(-)

Index: b/fs/xfs/xfs_symlink.c
===================================================================
--- a/fs/xfs/xfs_symlink.c
+++ b/fs/xfs/xfs_symlink.c
@@ -36,6 +36,7 @@
 #include "xfs_bmap_util.h"
 #include "xfs_error.h"
 #include "xfs_quota.h"
+#include "xfs_attr.h"
 #include "xfs_trans_space.h"
 #include "xfs_trace.h"
 #include "xfs_symlink.h"
@@ -192,6 +193,7 @@ xfs_symlink(
        struct xfs_dquot        *gdqp = NULL;
        struct xfs_dquot        *pdqp = NULL;
        uint                    resblks;
+       uint                    offset;
 
        *ipp = NULL;
 
@@ -375,9 +377,15 @@ xfs_symlink(
         * Create the directory entry for the symlink.
         */
        error = xfs_dir_createname(tp, dp, link_name, ip->i_ino,
-                                  &first_block, &free_list, resblks, NULL);
+                                  &first_block, &free_list, resblks, &offset);
        if (error)
                goto error2;
+
+       if (xfs_sb_version_hasparent(&mp->m_sb)) {
+               /* set the parent pointer and offset to the inode core fields */
+               ip->i_d.di_parent = cpu_to_be64(dp->i_ino);
+               ip->i_d.di_poffset = cpu_to_be32(offset);
+       }
        xfs_trans_ichgtime(tp, dp, XFS_ICHGTIME_MOD | XFS_ICHGTIME_CHG);
        xfs_trans_log_inode(tp, dp, XFS_ILOG_CORE);
 


<Prev in Thread] Current Thread [Next in Thread>