Re: [PATCH v3 14/17] xfs: remove parent pointers in unlink

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

 



On 11/28/2017 11:24 AM, Darrick J. Wong wrote:

On Fri, Nov 17, 2017 at 11:21:42AM -0700, Allison Henderson wrote:
From: Dave Chinner<dchinner@xxxxxxxxxx>

This patch removes the parent pointer attribute during unlink

[bfoster: rebase, use VFS inode generation]
[achender: rebased, changed __unint32_t to xfs_dir2_dataptr_t
	   implemented xfs_attr_remove_parent]

Signed-off-by: Dave Chinner<dchinner@xxxxxxxxxx>
Signed-off-by: Allison Henderson<allison.henderson@xxxxxxxxxx>
---
  fs/xfs/libxfs/xfs_parent.c | 20 ++++++++++++++++++++
  fs/xfs/xfs_attr.h          |  4 ++++
  fs/xfs/xfs_inode.c         | 10 +++++++++-
  3 files changed, 33 insertions(+), 1 deletion(-)

diff --git a/fs/xfs/libxfs/xfs_parent.c b/fs/xfs/libxfs/xfs_parent.c
index 5eec0ab..9278c89 100644
--- a/fs/xfs/libxfs/xfs_parent.c
+++ b/fs/xfs/libxfs/xfs_parent.c
@@ -91,3 +91,23 @@ xfs_parent_add(
  		(void *)child_name->name, child_name->len, ATTR_PARENT);
  }
+/*
+ * Remove a parent record from a child inode.
+ */
+int
+xfs_parent_remove(
+        struct xfs_trans        *tp,
Unused parameter.

+        struct xfs_inode        *parent,
+        struct xfs_inode        *child,
+        xfs_dir2_dataptr_t      diroffset,
+	struct xfs_defer_ops    *dfops,
Inconsistent indenting here.

+	xfs_fsblock_t           *firstblock)
Unused parameter.

+{
+	struct xfs_parent_name_rec rec;
+
+	xfs_init_parent_name_rec(&rec, parent->i_ino,
+		VFS_I(parent)->i_generation, diroffset);
Two tabs, please...

+
+	return xfs_attr_remove_deferred(child, dfops, &rec, sizeof(rec),
+					ATTR_PARENT);
...or this indentation style.

+}
diff --git a/fs/xfs/xfs_attr.h b/fs/xfs/xfs_attr.h
index 09ef747..0829687 100644
--- a/fs/xfs/xfs_attr.h
+++ b/fs/xfs/xfs_attr.h
@@ -198,4 +198,8 @@ int xfs_parent_add(struct xfs_trans *tp, struct xfs_inode *parent,
  		struct xfs_inode *child, struct xfs_name *child_name,
  		xfs_dir2_dataptr_t diroffset, struct xfs_defer_ops *dfops,
  		xfs_fsblock_t *firstblock);
+int xfs_parent_remove(struct xfs_trans *tp, struct xfs_inode *parent,
+		      struct xfs_inode *child, xfs_dir2_dataptr_t diroffset,
+		      struct xfs_defer_ops *dfops, xfs_fsblock_t *firstblock);
+
  #endif	/* __XFS_ATTR_H__ */
diff --git a/fs/xfs/xfs_inode.c b/fs/xfs/xfs_inode.c
index 0ad843d..a289a40 100644
--- a/fs/xfs/xfs_inode.c
+++ b/fs/xfs/xfs_inode.c
@@ -2607,6 +2607,7 @@ xfs_remove(
  	struct xfs_defer_ops	dfops;
  	xfs_fsblock_t           first_block;
  	uint			resblks;
+	uint32_t		dir_offset;
xfs_dir2_dataptr_t	dir_offset; ?

--D

Alrighty, I'll fold all these in.  Thx!
trace_xfs_remove(dp, name); @@ -2687,12 +2688,19 @@ xfs_remove( xfs_defer_init(&dfops, &first_block);
  	error = xfs_dir_removename(tp, dp, name, ip->i_ino, &first_block,
-				   &dfops, resblks, NULL);
+				   &dfops, resblks, &dir_offset);
  	if (error) {
  		ASSERT(error != -ENOENT);
  		goto out_bmap_cancel;
  	}
+ if (xfs_sb_version_hasparent(&mp->m_sb)) {
+		error = xfs_parent_remove(tp, dp, ip, dir_offset, &dfops,
+					  &first_block);
+		if (error)
+			goto out_bmap_cancel;
+	}
+
  	/*
  	 * If this is a synchronous mount, make sure that the
  	 * remove transaction goes to disk before returning to
--
2.7.4

--
To unsubscribe from this list: send the line "unsubscribe linux-xfs" in
the body of a message tomajordomo@xxxxxxxxxxxxxxx
More majordomo info athttp://vger.kernel.org/majordomo-info.html

--
To unsubscribe from this list: send the line "unsubscribe linux-xfs" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at  http://vger.kernel.org/majordomo-info.html



[Index of Archives]     [XFS Filesystem Development (older mail)]     [Linux Filesystem Development]     [Linux Audio Users]     [Yosemite Trails]     [Linux Kernel]     [Linux RAID]     [Linux SCSI]


  Powered by Linux