Skip to content

Commit

Permalink
---
Browse files Browse the repository at this point in the history
yaml
---
r: 22494
b: refs/heads/master
c: bba1e9b
h: refs/heads/master
v: v3
  • Loading branch information
Chen, Kenneth W authored and Linus Torvalds committed Mar 22, 2006
1 parent efeed54 commit ad1dca1
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 17 deletions.
2 changes: 1 addition & 1 deletion [refs]
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
---
refs/heads/master: 42b88befd6e0dae1a5fe04c03925037fa890e1f3
refs/heads/master: bba1e9b2111b14625f670bd07e57fd7ed57ce804
18 changes: 2 additions & 16 deletions trunk/fs/hugetlbfs/inode.c
Original file line number Diff line number Diff line change
Expand Up @@ -737,21 +737,6 @@ static struct file_system_type hugetlbfs_fs_type = {

static struct vfsmount *hugetlbfs_vfsmount;

/*
* Return the next identifier for a shm file
*/
static unsigned long hugetlbfs_counter(void)
{
static DEFINE_SPINLOCK(lock);
static unsigned long counter;
unsigned long ret;

spin_lock(&lock);
ret = ++counter;
spin_unlock(&lock);
return ret;
}

static int can_do_hugetlb_shm(void)
{
return likely(capable(CAP_IPC_LOCK) ||
Expand All @@ -767,6 +752,7 @@ struct file *hugetlb_zero_setup(size_t size)
struct dentry *dentry, *root;
struct qstr quick_string;
char buf[16];
static atomic_t counter;

if (!can_do_hugetlb_shm())
return ERR_PTR(-EPERM);
Expand All @@ -775,7 +761,7 @@ struct file *hugetlb_zero_setup(size_t size)
return ERR_PTR(-ENOMEM);

root = hugetlbfs_vfsmount->mnt_root;
snprintf(buf, 16, "%lu", hugetlbfs_counter());
snprintf(buf, 16, "%u", atomic_inc_return(&counter));
quick_string.name = buf;
quick_string.len = strlen(quick_string.name);
quick_string.hash = 0;
Expand Down

0 comments on commit ad1dca1

Please sign in to comment.