From 3b2b7fd01ac7817ceefbbccfb6073abbda5321ea Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Ernesto=20A=2E=20Fern=C3=A1ndez?= Date: Tue, 11 May 2021 22:24:23 -0300 Subject: [PATCH] Get rid of query cache MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Back when he first tried this out, Stan mentioned that using the slab cache for queries doesn't actually improve performance. It seems that I somehow made a mistake and pushed his test changes anyway, so revert them now. Signed-off-by: Ernesto A. Fernández --- apfs.h | 4 ---- btree.c | 6 +++--- super.c | 44 +------------------------------------------- 3 files changed, 4 insertions(+), 50 deletions(-) diff --git a/apfs.h b/apfs.h index 355fe16..96d7c63 100644 --- a/apfs.h +++ b/apfs.h @@ -494,10 +494,6 @@ static inline u32 apfs_query_storage(struct apfs_query *query) BUG(); } -/* super.c */ -struct apfs_query *apfs_alloc_query_item(void); -void apfs_free_query_item(struct apfs_query *qi); - /* * Extent record data in memory */ diff --git a/btree.c b/btree.c index 6f6e1ca..9e22950 100644 --- a/btree.c +++ b/btree.c @@ -185,7 +185,7 @@ struct apfs_query *apfs_alloc_query(struct apfs_node *node, { struct apfs_query *query; - query = apfs_alloc_query_item(); + query = kmalloc(sizeof(*query), GFP_KERNEL); if (!query) return NULL; @@ -216,7 +216,7 @@ void apfs_free_query(struct super_block *sb, struct apfs_query *query) struct apfs_query *parent = query->parent; apfs_node_put(query->node); - apfs_free_query_item(query); + kfree(query); query = parent; } } @@ -342,7 +342,7 @@ next_node: /* * Remember the parent node and index in case the search needs - * to be continued later. TODO: allocate queries from a cache? + * to be continued later. */ *query = apfs_alloc_query(node, *query); apfs_node_put(node); diff --git a/super.c b/super.c index 0c71cab..7cc2d61 100644 --- a/super.c +++ b/super.c @@ -650,40 +650,6 @@ static void destroy_inodecache(void) kmem_cache_destroy(apfs_inode_cachep); } -static struct kmem_cache *apfs_query_cachep; - -static int __init init_querycache(void) -{ - apfs_query_cachep = kmem_cache_create("apfs_query_cache", - sizeof(struct apfs_query), - 0, (SLAB_RECLAIM_ACCOUNT| - SLAB_MEM_SPREAD|SLAB_ACCOUNT), - NULL); - if (apfs_query_cachep == NULL) - return -ENOMEM; - return 0; -} - -struct apfs_query *apfs_alloc_query_item(void) -{ - struct apfs_query *qi; - qi = kmem_cache_alloc(apfs_query_cachep, GFP_KERNEL); - if(!qi) - return NULL; - memset(qi, 0, sizeof(struct apfs_query)); - return qi; -} - -void apfs_free_query_item(struct apfs_query *qi) -{ - kmem_cache_free(apfs_query_cachep, qi); -} - -static void destroy_querycache(void) -{ - kmem_cache_destroy(apfs_query_cachep); -} - /** * apfs_count_used_blocks - Count the blocks in use across all volumes * @sb: filesystem superblock @@ -1269,23 +1235,15 @@ static int __init init_apfs_fs(void) err = init_inodecache(); if (err) return err; - err = init_querycache(); - if (err) { - destroy_inodecache(); - return err; - } err = register_filesystem(&apfs_fs_type); - if (err) { - destroy_querycache(); + if (err) destroy_inodecache(); - } return err; } static void __exit exit_apfs_fs(void) { unregister_filesystem(&apfs_fs_type); - destroy_querycache(); destroy_inodecache(); }