On Fri, Sep 24, 2021 at 09:09:58PM +0800, Shiyang Ruan wrote:
> +void fs_dax_register_holder(struct dax_device *dax_dev, void *holder,
> +             const struct dax_holder_operations *ops)
> +{
> +     dax_set_holder(dax_dev, holder, ops);
> +}
> +EXPORT_SYMBOL_GPL(fs_dax_register_holder);
> +
> +void fs_dax_unregister_holder(struct dax_device *dax_dev)
> +{
> +     dax_set_holder(dax_dev, NULL, NULL);
> +}
> +EXPORT_SYMBOL_GPL(fs_dax_unregister_holder);
> +
> +void *fs_dax_get_holder(struct dax_device *dax_dev)
> +{
> +     return dax_get_holder(dax_dev);
> +}
> +EXPORT_SYMBOL_GPL(fs_dax_get_holder);

These should not be in a XFS patch.  But why do we even need this
wrappers?

> @@ -377,6 +385,8 @@ xfs_close_devices(
>  
>               xfs_free_buftarg(mp->m_logdev_targp);
>               xfs_blkdev_put(logdev);
> +             if (dax_logdev)
> +                     fs_dax_unregister_holder(dax_logdev);
>               fs_put_dax(dax_logdev);

I'd prefer to include the fs_dax_unregister_holder in the fs_put_dax
call to avoid callers failing to unregister it.

> @@ -411,6 +425,9 @@ xfs_open_devices(
>       struct block_device     *logdev = NULL, *rtdev = NULL;
>       int                     error;
>  
> +     if (dax_ddev)
> +             fs_dax_register_holder(dax_ddev, mp,
> +                             &xfs_dax_holder_operations);

I'd include the holder registration with fs_dax_get_by_bdev as well.

Reply via email to