You've already forked linux-apfs-rw
mirror of
https://github.com/linux-apfs/linux-apfs-rw.git
synced 2026-05-01 15:01:34 -07:00
Get rid of query cache
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 <ernesto@corellium.com>
This commit is contained in:
@@ -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
|
||||
*/
|
||||
|
||||
@@ -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);
|
||||
|
||||
@@ -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();
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user