@@ -437,11 +437,29 @@ static void zs_zpool_unmap(void *pool, unsigned long handle)
zs_unmap_object(pool, handle);
}
+static unsigned long zs_zpool_compact(void *pool)
+{
+ return zs_compact(pool);
+}
+
+static unsigned long zs_zpool_get_compacted(void *pool)
+{
+ struct zs_pool_stats stats;
+
+ zs_pool_stats(pool, &stats);
+ return stats.pages_compacted;
+}
+
static u64 zs_zpool_total_size(void *pool)
{
return zs_get_total_pages(pool) << PAGE_SHIFT;
}
+static size_t zs_zpool_huge_class_size(void *pool)
+{
+ return zs_huge_class_size(pool);
+}
+
static struct zpool_driver zs_zpool_driver = {
.type = "zsmalloc",
.owner = THIS_MODULE,
@@ -453,6 +471,9 @@ static struct zpool_driver zs_zpool_driver = {
.map = zs_zpool_map,
.unmap = zs_zpool_unmap,
.total_size = zs_zpool_total_size,
+ .compact = zs_zpool_compact,
+ .get_num_compacted = zs_zpool_get_compacted,
+ .huge_class_size = zs_zpool_huge_class_size,
};
MODULE_ALIAS("zpool-zsmalloc");
Add compaction callbacks for zpool compaction API extension. Add huge_class_size callback too to be fully aligned. Signed-off-by: Vitaly Wool <vitaly.wool@konsulko.com> --- mm/zsmalloc.c | 21 +++++++++++++++++++++ 1 file changed, 21 insertions(+)