xfs: idiotproof defer op type configuration

Recently, we forgot to port a new defer op type to xfsprogs, which
caused us some userspace pain.  Reorganize the way we make libxfs
clients supply defer op type information so that all type information
has to be provided at build time instead of risky runtime dynamic
configuration.

Signed-off-by: Darrick J. Wong <darrick.wong@oracle.com>
Reviewed-by: Eric Sandeen <sandeen@redhat.com>
Reviewed-by: Brian Foster <bfoster@redhat.com>
This commit is contained in:
Darrick J. Wong
2018-12-12 08:46:22 -08:00
parent 43feeea88c
commit bc9f2b7c8a
8 changed files with 23 additions and 53 deletions

View File

@@ -16,6 +16,7 @@
#include "xfs_refcount_item.h"
#include "xfs_alloc.h"
#include "xfs_refcount.h"
#include "xfs_defer.h"
/*
* This routine is called to allocate a "refcount update done"
@@ -227,7 +228,7 @@ xfs_refcount_update_cancel_item(
kmem_free(refc);
}
static const struct xfs_defer_op_type xfs_refcount_update_defer_type = {
const struct xfs_defer_op_type xfs_refcount_update_defer_type = {
.type = XFS_DEFER_OPS_TYPE_REFCOUNT,
.max_items = XFS_CUI_MAX_FAST_EXTENTS,
.diff_items = xfs_refcount_update_diff_items,
@@ -239,10 +240,3 @@ static const struct xfs_defer_op_type xfs_refcount_update_defer_type = {
.finish_cleanup = xfs_refcount_update_finish_cleanup,
.cancel_item = xfs_refcount_update_cancel_item,
};
/* Register the deferred op type. */
void
xfs_refcount_update_init_defer_op(void)
{
xfs_defer_init_op_type(&xfs_refcount_update_defer_type);
}