> +             // 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.

Reply via email to