mirror of
https://github.com/torvalds/linux.git
synced 2026-07-27 17:47:41 +02:00
quota: allocate dquot_hash with kmalloc()
dquot_init() allocates a single page for dquot_hash with __get_free_pages(). kmalloc() is a better API for such use and it also provides better scalability and more debugging possibilities. Replace use of __get_free_pages() with kmalloc() and get rid of the order variable that remained 0 for more than 20 years. Signed-off-by: Mike Rapoport (Microsoft) <rppt@kernel.org> Link: https://patch.msgid.link/20260523-b4-fs-v1-1-275e36a83f0e@kernel.org Signed-off-by: Jan Kara <jack@suse.cz>
This commit is contained in:
parent
5f0419457f
commit
6d06b04c2b
|
|
@ -3022,7 +3022,7 @@ static const struct ctl_table fs_dqstats_table[] = {
|
|||
static int __init dquot_init(void)
|
||||
{
|
||||
int i, ret;
|
||||
unsigned long nr_hash, order;
|
||||
unsigned long nr_hash;
|
||||
struct shrinker *dqcache_shrinker;
|
||||
|
||||
printk(KERN_NOTICE "VFS: Disk quotas %s\n", __DQUOT_VERSION__);
|
||||
|
|
@ -3035,8 +3035,7 @@ static int __init dquot_init(void)
|
|||
SLAB_PANIC),
|
||||
NULL);
|
||||
|
||||
order = 0;
|
||||
dquot_hash = (struct hlist_head *)__get_free_pages(GFP_KERNEL, order);
|
||||
dquot_hash = kmalloc(PAGE_SIZE, GFP_KERNEL);
|
||||
if (!dquot_hash)
|
||||
panic("Cannot create dquot hash table");
|
||||
|
||||
|
|
@ -3046,7 +3045,7 @@ static int __init dquot_init(void)
|
|||
panic("Cannot create dquot stat counters");
|
||||
|
||||
/* Find power-of-two hlist_heads which can fit into allocation */
|
||||
nr_hash = (1UL << order) * PAGE_SIZE / sizeof(struct hlist_head);
|
||||
nr_hash = PAGE_SIZE / sizeof(struct hlist_head);
|
||||
dq_hash_bits = ilog2(nr_hash);
|
||||
|
||||
nr_hash = 1UL << dq_hash_bits;
|
||||
|
|
@ -3054,8 +3053,8 @@ static int __init dquot_init(void)
|
|||
for (i = 0; i < nr_hash; i++)
|
||||
INIT_HLIST_HEAD(dquot_hash + i);
|
||||
|
||||
pr_info("VFS: Dquot-cache hash table entries: %ld (order %ld,"
|
||||
" %ld bytes)\n", nr_hash, order, (PAGE_SIZE << order));
|
||||
pr_info("VFS: Dquot-cache hash table entries: %ld (%ld bytes)\n",
|
||||
nr_hash, PAGE_SIZE);
|
||||
|
||||
dqcache_shrinker = shrinker_alloc(0, "dquota-cache");
|
||||
if (!dqcache_shrinker)
|
||||
|
|
|
|||
Loading…
Reference in New Issue
Block a user