On Mon, Jul 14, 2025 at 09:14:27AM -0400, Jeff Layton wrote: > > + delegation_buckets = roundup_pow_of_two(nfs_delegation_watermark / 16); > > + server->delegation_hash_mask = delegation_buckets - 1; > > + server->delegation_hash_table = kmalloc_array(delegation_buckets, > > + sizeof(*server->delegation_hash_table), GFP_KERNEL); > > + if (!server->delegation_hash_table) > > + goto out_free_server; > > + for (i = 0; i < delegation_buckets; i++) > > + INIT_HLIST_HEAD(&server->delegation_hash_table[i]); > > + > > This is going to get created for any mount, even v3 ones. It might be > better to only bother with this for v4 mounts. Maybe do this in > nfs4_server_common_setup() instead? Yeah, good idea. > Also, I wonder if you'd be better off using the rhashtable > infrastructure instead of adding a fixed-size one? The number of > delegations in flight is very workload-dependent, so a resizeable > hashtable may be a better option. I did try that first. But the rhashtable expects the hash key to be embedded into the structure that has the rhash_head embedded into it, while delegations use the file handle embeded into the inode as the key. So we'd have to bloat the deleations with a key copy for that.