Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

[PATCH 2/2] anondev: switch to IDA

Signed-off-by: Alexey Dobriyan <adobriyan@gmail.com>

authored by

Alexey Dobriyan and committed by
Al Viro
ad76cbc6 6de24f0e

+5 -5
+5 -5
fs/super.c
··· 682 682 * filesystems which don't use real block-devices. -- jrs 683 683 */ 684 684 685 - static DEFINE_IDR(unnamed_dev_idr); 685 + static DEFINE_IDA(unnamed_dev_ida); 686 686 static DEFINE_SPINLOCK(unnamed_dev_lock);/* protects the above */ 687 687 688 688 int set_anon_super(struct super_block *s, void *data) ··· 691 691 int error; 692 692 693 693 retry: 694 - if (idr_pre_get(&unnamed_dev_idr, GFP_ATOMIC) == 0) 694 + if (ida_pre_get(&unnamed_dev_ida, GFP_ATOMIC) == 0) 695 695 return -ENOMEM; 696 696 spin_lock(&unnamed_dev_lock); 697 - error = idr_get_new(&unnamed_dev_idr, NULL, &dev); 697 + error = ida_get_new(&unnamed_dev_ida, &dev); 698 698 spin_unlock(&unnamed_dev_lock); 699 699 if (error == -EAGAIN) 700 700 /* We raced and lost with another CPU. */ ··· 704 704 705 705 if ((dev & MAX_ID_MASK) == (1 << MINORBITS)) { 706 706 spin_lock(&unnamed_dev_lock); 707 - idr_remove(&unnamed_dev_idr, dev); 707 + ida_remove(&unnamed_dev_ida, dev); 708 708 spin_unlock(&unnamed_dev_lock); 709 709 return -EMFILE; 710 710 } ··· 720 720 721 721 generic_shutdown_super(sb); 722 722 spin_lock(&unnamed_dev_lock); 723 - idr_remove(&unnamed_dev_idr, slot); 723 + ida_remove(&unnamed_dev_ida, slot); 724 724 spin_unlock(&unnamed_dev_lock); 725 725 } 726 726