aboutsummaryrefslogtreecommitdiffstats
path: root/fs/super.c
diff options
context:
space:
mode:
authorLinus Torvalds <torvalds@linux-foundation.org>2008-10-23 13:22:40 -0400
committerLinus Torvalds <torvalds@linux-foundation.org>2008-10-23 13:22:40 -0400
commit5ed487bc2c44ca4e9668ef9cb54c830e2a9fac47 (patch)
treeaf19ed28db83e8f52690872ac99336da1cf2fd3b /fs/super.c
parent5b34653963de7a6d0d8c783527457d68fddc60fb (diff)
parentfd217f4d70172c526478f2bc76859e909fdfa674 (diff)
Merge branch 'for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/viro/vfs-2.6
* 'for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/viro/vfs-2.6: (46 commits) [PATCH] fs: add a sanity check in d_free [PATCH] i_version: remount support [patch] vfs: make security_inode_setattr() calling consistent [patch 1/3] FS_MBCACHE: don't needlessly make it built-in [PATCH] move executable checking into ->permission() [PATCH] fs/dcache.c: update comment of d_validate() [RFC PATCH] touch_mnt_namespace when the mount flags change [PATCH] reiserfs: add missing llseek method [PATCH] fix ->llseek for more directories [PATCH vfs-2.6 6/6] vfs: add LOOKUP_RENAME_TARGET intent [PATCH vfs-2.6 5/6] vfs: remove LOOKUP_PARENT from non LOOKUP_PARENT lookup [PATCH vfs-2.6 4/6] vfs: remove unnecessary fsnotify_d_instantiate() [PATCH vfs-2.6 3/6] vfs: add __d_instantiate() helper [PATCH vfs-2.6 2/6] vfs: add d_ancestor() [PATCH vfs-2.6 1/6] vfs: replace parent == dentry->d_parent by IS_ROOT() [PATCH] get rid of on-stack dentry in udf [PATCH 2/2] anondev: switch to IDA [PATCH 1/2] anondev: init IDR statically [JFFS2] Use d_splice_alias() not d_add() in jffs2_lookup() [PATCH] Optimise NFS readdir hack slightly. ...
Diffstat (limited to 'fs/super.c')
-rw-r--r--fs/super.c15
1 files changed, 5 insertions, 10 deletions
diff --git a/fs/super.c b/fs/super.c
index e931ae9511fe..f31ef824d069 100644
--- a/fs/super.c
+++ b/fs/super.c
@@ -682,7 +682,7 @@ void emergency_remount(void)
682 * filesystems which don't use real block-devices. -- jrs 682 * filesystems which don't use real block-devices. -- jrs
683 */ 683 */
684 684
685static struct idr unnamed_dev_idr; 685static DEFINE_IDA(unnamed_dev_ida);
686static DEFINE_SPINLOCK(unnamed_dev_lock);/* protects the above */ 686static DEFINE_SPINLOCK(unnamed_dev_lock);/* protects the above */
687 687
688int set_anon_super(struct super_block *s, void *data) 688int set_anon_super(struct super_block *s, void *data)
@@ -691,10 +691,10 @@ int set_anon_super(struct super_block *s, void *data)
691 int error; 691 int error;
692 692
693 retry: 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 return -ENOMEM; 695 return -ENOMEM;
696 spin_lock(&unnamed_dev_lock); 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 spin_unlock(&unnamed_dev_lock); 698 spin_unlock(&unnamed_dev_lock);
699 if (error == -EAGAIN) 699 if (error == -EAGAIN)
700 /* We raced and lost with another CPU. */ 700 /* We raced and lost with another CPU. */
@@ -704,7 +704,7 @@ int set_anon_super(struct super_block *s, void *data)
704 704
705 if ((dev & MAX_ID_MASK) == (1 << MINORBITS)) { 705 if ((dev & MAX_ID_MASK) == (1 << MINORBITS)) {
706 spin_lock(&unnamed_dev_lock); 706 spin_lock(&unnamed_dev_lock);
707 idr_remove(&unnamed_dev_idr, dev); 707 ida_remove(&unnamed_dev_ida, dev);
708 spin_unlock(&unnamed_dev_lock); 708 spin_unlock(&unnamed_dev_lock);
709 return -EMFILE; 709 return -EMFILE;
710 } 710 }
@@ -720,17 +720,12 @@ void kill_anon_super(struct super_block *sb)
720 720
721 generic_shutdown_super(sb); 721 generic_shutdown_super(sb);
722 spin_lock(&unnamed_dev_lock); 722 spin_lock(&unnamed_dev_lock);
723 idr_remove(&unnamed_dev_idr, slot); 723 ida_remove(&unnamed_dev_ida, slot);
724 spin_unlock(&unnamed_dev_lock); 724 spin_unlock(&unnamed_dev_lock);
725} 725}
726 726
727EXPORT_SYMBOL(kill_anon_super); 727EXPORT_SYMBOL(kill_anon_super);
728 728
729void __init unnamed_dev_init(void)
730{
731 idr_init(&unnamed_dev_idr);
732}
733
734void kill_litter_super(struct super_block *sb) 729void kill_litter_super(struct super_block *sb)
735{ 730{
736 if (sb->s_root) 731 if (sb->s_root)