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

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



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);
 


_______________________________________________
xfs mailing list
xfs@xxxxxxxxxxx
http://oss.sgi.com/mailman/listinfo/xfs




[Index of Archives]     [Linux XFS Devel]     [Linux Filesystem Development]     [Filesystem Testing]     [Linux USB Devel]     [Linux Audio Users]     [Yosemite News]     [Linux Kernel]     [Linux SCSI]

  Powered by Linux