diff options
Diffstat (limited to 'fs')
-rw-r--r-- | fs/hugetlbfs/inode.c | 18 |
1 files changed, 2 insertions, 16 deletions
diff --git a/fs/hugetlbfs/inode.c b/fs/hugetlbfs/inode.c index 1a1c2fcb7823..25fa8bba8cb5 100644 --- a/fs/hugetlbfs/inode.c +++ b/fs/hugetlbfs/inode.c | |||
@@ -737,21 +737,6 @@ static struct file_system_type hugetlbfs_fs_type = { | |||
737 | 737 | ||
738 | static struct vfsmount *hugetlbfs_vfsmount; | 738 | static struct vfsmount *hugetlbfs_vfsmount; |
739 | 739 | ||
740 | /* | ||
741 | * Return the next identifier for a shm file | ||
742 | */ | ||
743 | static unsigned long hugetlbfs_counter(void) | ||
744 | { | ||
745 | static DEFINE_SPINLOCK(lock); | ||
746 | static unsigned long counter; | ||
747 | unsigned long ret; | ||
748 | |||
749 | spin_lock(&lock); | ||
750 | ret = ++counter; | ||
751 | spin_unlock(&lock); | ||
752 | return ret; | ||
753 | } | ||
754 | |||
755 | static int can_do_hugetlb_shm(void) | 740 | static int can_do_hugetlb_shm(void) |
756 | { | 741 | { |
757 | return likely(capable(CAP_IPC_LOCK) || | 742 | return likely(capable(CAP_IPC_LOCK) || |
@@ -767,6 +752,7 @@ struct file *hugetlb_zero_setup(size_t size) | |||
767 | struct dentry *dentry, *root; | 752 | struct dentry *dentry, *root; |
768 | struct qstr quick_string; | 753 | struct qstr quick_string; |
769 | char buf[16]; | 754 | char buf[16]; |
755 | static atomic_t counter; | ||
770 | 756 | ||
771 | if (!can_do_hugetlb_shm()) | 757 | if (!can_do_hugetlb_shm()) |
772 | return ERR_PTR(-EPERM); | 758 | return ERR_PTR(-EPERM); |
@@ -775,7 +761,7 @@ struct file *hugetlb_zero_setup(size_t size) | |||
775 | return ERR_PTR(-ENOMEM); | 761 | return ERR_PTR(-ENOMEM); |
776 | 762 | ||
777 | root = hugetlbfs_vfsmount->mnt_root; | 763 | root = hugetlbfs_vfsmount->mnt_root; |
778 | snprintf(buf, 16, "%lu", hugetlbfs_counter()); | 764 | snprintf(buf, 16, "%u", atomic_inc_return(&counter)); |
779 | quick_string.name = buf; | 765 | quick_string.name = buf; |
780 | quick_string.len = strlen(quick_string.name); | 766 | quick_string.len = strlen(quick_string.name); |
781 | quick_string.hash = 0; | 767 | quick_string.hash = 0; |