summaryrefslogtreecommitdiffstats
path: root/fs/xfs/xfs_iunlink_item.h
diff options
context:
space:
mode:
authorDave Chinner <dchinner@redhat.com>2022-07-14 11:47:42 +1000
committerDave Chinner <david@fromorbit.com>2022-07-14 11:47:42 +1000
commit784eb7d8dd4163b82a19b914f76b2834a58a3e4c (patch)
tree48b06d793931162a0272160c918b9699784b1f3b /fs/xfs/xfs_iunlink_item.h
parentfad743d7cd8bd92d03c09e71f29eace860f50415 (diff)
downloadlinux-784eb7d8dd4163b82a19b914f76b2834a58a3e4c.tar.gz
linux-784eb7d8dd4163b82a19b914f76b2834a58a3e4c.tar.bz2
linux-784eb7d8dd4163b82a19b914f76b2834a58a3e4c.zip
xfs: add in-memory iunlink log item
Now that we have a clean operation to update the di_next_unlinked field of inode cluster buffers, we can easily defer this operation to transaction commit time so we can order the inode cluster buffer locking consistently. To do this, we introduce a new in-memory log item to track the unlinked list item modification that we are going to make. This follows the same observations as the in-memory double linked list used to track unlinked inodes in that the inodes on the list are pinned in memory and cannot go away, and hence we can simply reference them for the duration of the transaction without needing to take active references or pin them or look them up. This allows us to pass the xfs_inode to the transaction commit code along with the modification to be made, and then order the logged modifications via the ->iop_sort and ->iop_precommit operations for the new log item type. As this is an in-memory log item, it doesn't have formatting, CIL or AIL operational hooks - it exists purely to run the inode unlink modifications and is then removed from the transaction item list and freed once the precommit operation has run. Signed-off-by: Dave Chinner <dchinner@redhat.com> Reviewed-by: Darrick J. Wong <djwong@kernel.org> Reviewed-by: Christoph Hellwig <hch@lst.de>
Diffstat (limited to 'fs/xfs/xfs_iunlink_item.h')
-rw-r--r--fs/xfs/xfs_iunlink_item.h27
1 files changed, 27 insertions, 0 deletions
diff --git a/fs/xfs/xfs_iunlink_item.h b/fs/xfs/xfs_iunlink_item.h
new file mode 100644
index 000000000000..c793cdcaccde
--- /dev/null
+++ b/fs/xfs/xfs_iunlink_item.h
@@ -0,0 +1,27 @@
+// SPDX-License-Identifier: GPL-2.0
+/*
+ * Copyright (c) 2020-2022, Red Hat, Inc.
+ * All Rights Reserved.
+ */
+#ifndef XFS_IUNLINK_ITEM_H
+#define XFS_IUNLINK_ITEM_H 1
+
+struct xfs_trans;
+struct xfs_inode;
+struct xfs_perag;
+
+/* in memory log item structure */
+struct xfs_iunlink_item {
+ struct xfs_log_item item;
+ struct xfs_inode *ip;
+ struct xfs_perag *pag;
+ xfs_agino_t next_agino;
+ xfs_agino_t old_agino;
+};
+
+extern struct kmem_cache *xfs_iunlink_cache;
+
+int xfs_iunlink_log_inode(struct xfs_trans *tp, struct xfs_inode *ip,
+ struct xfs_perag *pag, xfs_agino_t next_agino);
+
+#endif /* XFS_IUNLINK_ITEM_H */