aboutsummaryrefslogtreecommitdiff
path: root/fs/xfs/libxfs/xfs_group.c
diff options
context:
space:
mode:
Diffstat (limited to 'fs/xfs/libxfs/xfs_group.c')
-rw-r--r--fs/xfs/libxfs/xfs_group.c16
1 files changed, 14 insertions, 2 deletions
diff --git a/fs/xfs/libxfs/xfs_group.c b/fs/xfs/libxfs/xfs_group.c
index 8532dc2f8628..5c6fa5d76a91 100644
--- a/fs/xfs/libxfs/xfs_group.c
+++ b/fs/xfs/libxfs/xfs_group.c
@@ -10,6 +10,7 @@
#include "xfs_mount.h"
#include "xfs_error.h"
#include "xfs_trace.h"
+#include "xfs_extent_busy.h"
#include "xfs_group.h"
/*
@@ -161,6 +162,9 @@ xfs_group_free(
XFS_IS_CORRUPT(mp, atomic_read(&xg->xg_ref) != 0);
xfs_defer_drain_free(&xg->xg_intents_drain);
+#ifdef __KERNEL__
+ kfree(xg->xg_busy_extents);
+#endif
if (uninit)
uninit(xg);
@@ -185,6 +189,9 @@ xfs_group_insert(
xg->xg_type = type;
#ifdef __KERNEL__
+ xg->xg_busy_extents = xfs_extent_busy_alloc();
+ if (!xg->xg_busy_extents)
+ return -ENOMEM;
spin_lock_init(&xg->xg_state_lock);
xfs_hooks_init(&xg->xg_rmap_update_hooks);
#endif
@@ -196,9 +203,14 @@ xfs_group_insert(
error = xa_insert(&mp->m_groups[type].xa, index, xg, GFP_KERNEL);
if (error) {
WARN_ON_ONCE(error == -EBUSY);
- xfs_defer_drain_free(&xg->xg_intents_drain);
- return error;
+ goto out_drain;
}
return 0;
+out_drain:
+ xfs_defer_drain_free(&xg->xg_intents_drain);
+#ifdef __KERNEL__
+ kfree(xg->xg_busy_extents);
+#endif
+ return error;
}