Commit c63e09ecccb5 "Make allocation of anon devices cheaper" made a performance-driven change in 2009. With commit 2c57a0e233d7 "lib: find_*_bit reimplementation" the performance of the related functionality was much improved in 2015, so I think we can remove this older extension. However I didn't do any benchmarking. As a result of this change we use the idr functionality the same way as other parts of the kernel. Signed-off-by: Heiner Kallweit <hkallweit1@xxxxxxxxx> --- fs/super.c | 15 ++++----------- 1 file changed, 4 insertions(+), 11 deletions(-) diff --git a/fs/super.c b/fs/super.c index c2ff475..362e765 100644 --- a/fs/super.c +++ b/fs/super.c @@ -881,10 +881,6 @@ void emergency_remount(void) static DEFINE_IDA(unnamed_dev_ida); static DEFINE_SPINLOCK(unnamed_dev_lock);/* protects the above */ -/* Many userspace utilities consider an FSID of 0 invalid. - * Always return at least 1 from get_anon_bdev. - */ -static int unnamed_dev_start = 1; int get_anon_bdev(dev_t *p) { @@ -895,9 +891,10 @@ int get_anon_bdev(dev_t *p) if (ida_pre_get(&unnamed_dev_ida, GFP_ATOMIC) == 0) return -ENOMEM; spin_lock(&unnamed_dev_lock); - error = ida_get_new_above(&unnamed_dev_ida, unnamed_dev_start, &dev); - if (!error) - unnamed_dev_start = dev + 1; + /* Many userspace utilities consider an FSID of 0 invalid. + * Always return at least 1 from get_anon_bdev. + */ + error = ida_get_new_above(&unnamed_dev_ida, 1, &dev); spin_unlock(&unnamed_dev_lock); if (error == -EAGAIN) /* We raced and lost with another CPU. */ @@ -908,8 +905,6 @@ int get_anon_bdev(dev_t *p) if (dev >= (1 << MINORBITS)) { spin_lock(&unnamed_dev_lock); ida_remove(&unnamed_dev_ida, dev); - if (unnamed_dev_start > dev) - unnamed_dev_start = dev; spin_unlock(&unnamed_dev_lock); return -EMFILE; } @@ -923,8 +918,6 @@ void free_anon_bdev(dev_t dev) int slot = MINOR(dev); spin_lock(&unnamed_dev_lock); ida_remove(&unnamed_dev_ida, slot); - if (slot < unnamed_dev_start) - unnamed_dev_start = slot; spin_unlock(&unnamed_dev_lock); } EXPORT_SYMBOL(free_anon_bdev); -- 2.9.0 -- To unsubscribe from this list: send the line "unsubscribe linux-fsdevel" in the body of a message to majordomo@xxxxxxxxxxxxxxx More majordomo info at http://vger.kernel.org/majordomo-info.html