summaryrefslogtreecommitdiffstats
path: root/module
diff options
context:
space:
mode:
authorBrian Behlendorf <[email protected]>2010-08-26 10:27:53 -0700
committerBrian Behlendorf <[email protected]>2010-08-31 08:38:45 -0700
commit22c81dd8a9ec5177a65808c1d782599402b40233 (patch)
tree150455ef944c7e92353f3a0609d9ade4d35a036e /module
parent98f72a539c8ca2ba1ca7fc8cac44018ade96065c (diff)
Fix metaslab
If your only going to allow one allocator to be used and it is defined at compile time there is no point including the others in the build. This patch could/should be refined for Linux to make the metaslab configurable at run time. That might be a bit tricky however since you would need to quiese all IO. Short of that making it configurable as a module load option would be a reasonable compromise. Signed-off-by: Brian Behlendorf <[email protected]>
Diffstat (limited to 'module')
-rw-r--r--module/zfs/metaslab.c20
1 files changed, 20 insertions, 0 deletions
diff --git a/module/zfs/metaslab.c b/module/zfs/metaslab.c
index 1722a53fc..56c46100d 100644
--- a/module/zfs/metaslab.c
+++ b/module/zfs/metaslab.c
@@ -30,6 +30,8 @@
#include <sys/vdev_impl.h>
#include <sys/zio.h>
+#define WITH_NDF_BLOCK_ALLOCATOR
+
uint64_t metaslab_aliquot = 512ULL << 10;
uint64_t metaslab_gang_bang = SPA_MAXBLOCKSIZE + 1; /* force gang blocks */
@@ -350,6 +352,9 @@ metaslab_segsize_compare(const void *x1, const void *x2)
return (0);
}
+#if defined(WITH_FF_BLOCK_ALLOCATOR) || \
+ defined(WITH_DF_BLOCK_ALLOCATOR) || \
+ defined(WITH_CDF_BLOCK_ALLOCATOR)
/*
* This is a helper function that can be used by the allocator to find
* a suitable block to allocate. This will search the specified AVL
@@ -389,6 +394,7 @@ metaslab_block_picker(avl_tree_t *t, uint64_t *cursor, uint64_t size,
*cursor = 0;
return (metaslab_block_picker(t, cursor, size, align));
}
+#endif /* WITH_FF/DF/CDF_BLOCK_ALLOCATOR */
static void
metaslab_pp_load(space_map_t *sm)
@@ -452,6 +458,7 @@ metaslab_pp_maxsize(space_map_t *sm)
return (ss->ss_end - ss->ss_start);
}
+#if defined(WITH_FF_BLOCK_ALLOCATOR)
/*
* ==========================================================================
* The first-fit block allocator
@@ -484,6 +491,10 @@ static space_map_ops_t metaslab_ff_ops = {
metaslab_ff_fragmented
};
+space_map_ops_t *zfs_metaslab_ops = &metaslab_ff_ops;
+#endif /* WITH_FF_BLOCK_ALLOCATOR */
+
+#if defined(WITH_DF_BLOCK_ALLOCATOR)
/*
* ==========================================================================
* Dynamic block allocator -
@@ -543,11 +554,15 @@ static space_map_ops_t metaslab_df_ops = {
metaslab_df_fragmented
};
+space_map_ops_t *zfs_metaslab_ops = &metaslab_df_ops;
+#endif /* WITH_DF_BLOCK_ALLOCATOR */
+
/*
* ==========================================================================
* Other experimental allocators
* ==========================================================================
*/
+#if defined(WITH_CDF_BLOCK_ALLOCATOR)
static uint64_t
metaslab_cdf_alloc(space_map_t *sm, uint64_t size)
{
@@ -607,6 +622,10 @@ static space_map_ops_t metaslab_cdf_ops = {
metaslab_cdf_fragmented
};
+space_map_ops_t *zfs_metaslab_ops = &metaslab_cdf_ops;
+#endif /* WITH_CDF_BLOCK_ALLOCATOR */
+
+#if defined(WITH_NDF_BLOCK_ALLOCATOR)
uint64_t metaslab_ndf_clump_shift = 4;
static uint64_t
@@ -672,6 +691,7 @@ static space_map_ops_t metaslab_ndf_ops = {
};
space_map_ops_t *zfs_metaslab_ops = &metaslab_ndf_ops;
+#endif /* WITH_NDF_BLOCK_ALLOCATOR */
/*
* ==========================================================================