From 966c8b8cbc5cb58bbbff8196107505591d4fe5e2 Mon Sep 17 00:00:00 2001 From: Zach Brown Date: Wed, 4 Apr 2018 09:18:28 -0700 Subject: [PATCH] scoutfs: alloc inos at multiple of lock group Inode allocations come from batches that are reserved for directories. As the batch is exhausted a new one is acquired and allocated from. The batch size was arbitrarily set to the human friendly 10000. This doesn't interact well with the lock group size being a power of two. Each allocation batch will straddle an inode group with its previous and next inode batch. This often doesn't matter because dirctories very rarely have more than 9000 entries. But as entries pass 10000 they'd see surprising contention with other inode ranges in directories. Tweak the allocation size to be a multiple of the lock group size to stop this from happening. Signed-off-by: Zach Brown --- kmod/src/inode.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/kmod/src/inode.c b/kmod/src/inode.c index 6708c0a8..2812ae25 100644 --- a/kmod/src/inode.c +++ b/kmod/src/inode.c @@ -1272,7 +1272,9 @@ int scoutfs_alloc_ino(struct inode *parent, u64 *ino_ret) if (ia->nr == 0) { spin_unlock(&ia->lock); - ret = scoutfs_client_alloc_inodes(sb, 10000, &ino, &nr); + ret = scoutfs_client_alloc_inodes(sb, + SCOUTFS_LOCK_INODE_GROUP_NR * 10, + &ino, &nr); if (ret < 0) goto out; spin_lock(&ia->lock);