Thread (21 messages) 21 messages, 4 authors, 2021-12-16

Re: [PATCH v8 8/9] xfs: Implement ->notify_failure() for XFS

From: Christoph Hellwig <hch@infradead.org>
Date: 2021-12-14 15:54:11
Also in: linux-fsdevel, linux-xfs, lkml, nvdimm

+		// TODO check and try to fix metadata
Please avoid //-style comments.
+static u64
+xfs_dax_ddev_offset(
+	struct xfs_mount	*mp,
+	struct dax_device	*dax_dev,
+	u64			disk_offset)
+{
+	xfs_buftarg_t *targp;
+
+	if (mp->m_ddev_targp->bt_daxdev == dax_dev)
+		targp = mp->m_ddev_targp;
+	else if (mp->m_logdev_targp->bt_daxdev == dax_dev)
+		targp = mp->m_logdev_targp;
+	else
+		targp = mp->m_rtdev_targp;
+
+	return disk_offset - targp->bt_dax_part_off;
This is only called for the data device.  So I think we can simplify
this and open code the logic in xfs_dax_notify_ddev_failure.

+void
+xfs_notify_failure_register(
+	struct xfs_mount	*mp,
+	struct dax_device	*dax_dev)
+{
+	if (dax_dev && !fs_dax_get_holder(dax_dev))
+		fs_dax_register_holder(dax_dev, mp, &xfs_dax_holder_operations);
+}
+
+void
+xfs_notify_failure_unregister(
+	struct dax_device	*dax_dev)
+{
+	if (dax_dev)
+		fs_dax_unregister_holder(dax_dev);
+}
Why do we need these wrappers?  Also instead of the fs_dax_get_holder
here, fs_dax_register_holder needs to return an error if there already
is a holder.
Keyboard shortcuts
hback out one level
jnext message in thread
kprevious message in thread
ldrill in
Escclose help / fold thread tree
?toggle this help