[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <Ybi+HYoI2i3dVToz@infradead.org>
Date: Tue, 14 Dec 2021 07:54:05 -0800
From: Christoph Hellwig <hch@...radead.org>
To: Shiyang Ruan <ruansy.fnst@...itsu.com>
Cc: linux-kernel@...r.kernel.org, linux-xfs@...r.kernel.org,
nvdimm@...ts.linux.dev, linux-mm@...ck.org,
linux-fsdevel@...r.kernel.org, djwong@...nel.org,
dan.j.williams@...el.com, david@...morbit.com, hch@...radead.org,
jane.chu@...cle.com
Subject: Re: [PATCH v8 8/9] xfs: Implement ->notify_failure() for XFS
> + // 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.
Powered by blists - more mailing lists