--- /dev/null
+From: Brian Behlendorf <behlendorf1@llnl.gov>
+Subject: [PATCH] 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 <behlendorf1@llnl.gov>
#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 */
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
*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)
return (ss->ss_end - ss->ss_start);
}
+#if defined(WITH_FF_BLOCK_ALLOCATOR)
/*
* ==========================================================================
* The first-fit block allocator
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 -
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)
{
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
};
space_map_ops_t *zfs_metaslab_ops = &metaslab_ndf_ops;
+#endif /* WITH_NDF_BLOCK_ALLOCATOR */
/*
* ==========================================================================