diff options
Diffstat (limited to 'fs/xfs/xfs_mount.c')
-rw-r--r-- | fs/xfs/xfs_mount.c | 43 |
1 files changed, 41 insertions, 2 deletions
diff --git a/fs/xfs/xfs_mount.c b/fs/xfs/xfs_mount.c index 38deae942ed1..e665adbb0ae3 100644 --- a/fs/xfs/xfs_mount.c +++ b/fs/xfs/xfs_mount.c @@ -1491,7 +1491,7 @@ xfs_ag_intents_busy( #endif /* CONFIG_XFS_DRAIN_INTENTS */ -#ifdef CONFIG_XFS_LIVE_HOOKS +#if defined(CONFIG_XFS_LIVE_HOOKS_SRCU) /* Initialize a notifier chain. */ void xfs_hooks_init( @@ -1531,4 +1531,43 @@ xfs_hooks_call( { return srcu_notifier_call_chain(&chain->head, val, priv); } -#endif /* CONFIG_XFS_LIVE_HOOKS */ +#elif defined(CONFIG_XFS_LIVE_HOOKS_BLOCKING) +/* Initialize a notifier chain. */ +void +xfs_hooks_init( + struct xfs_hooks *chain) +{ + BLOCKING_INIT_NOTIFIER_HEAD(&chain->head); +} + +/* Make it so a function gets called whenever we hit a certain hook point. */ +int +xfs_hooks_add( + struct xfs_hooks *chain, + struct xfs_hook *hook) +{ + ASSERT(hook->nb.notifier_call != NULL); + BUILD_BUG_ON(offsetof(struct xfs_hook, nb) != 0); + + return blocking_notifier_chain_register(&chain->head, &hook->nb); +} + +/* Remove a previously installed hook. */ +void +xfs_hooks_del( + struct xfs_hooks *chain, + struct xfs_hook *hook) +{ + blocking_notifier_chain_unregister(&chain->head, &hook->nb); +} + +/* Call a hook. Returns the NOTIFY_* value returned by the last hook. */ +int +xfs_hooks_call( + struct xfs_hooks *chain, + unsigned long val, + void *priv) +{ + return blocking_notifier_call_chain(&chain->head, val, priv); +} +#endif /* CONFIG_XFS_LIVE_HOOKS_BLOCKING */ |