aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--fs/hugetlbfs/inode.c7
-rw-r--r--include/linux/hugetlb.h4
-rw-r--r--ipc/shm.c6
3 files changed, 7 insertions, 10 deletions
diff --git a/fs/hugetlbfs/inode.c b/fs/hugetlbfs/inode.c
index aa083dd34e92..e6b46b3ac2fe 100644
--- a/fs/hugetlbfs/inode.c
+++ b/fs/hugetlbfs/inode.c
@@ -736,15 +736,13 @@ static int can_do_hugetlb_shm(void)
736 can_do_mlock()); 736 can_do_mlock());
737} 737}
738 738
739struct file *hugetlb_zero_setup(size_t size) 739struct file *hugetlb_file_setup(const char *name, size_t size)
740{ 740{
741 int error = -ENOMEM; 741 int error = -ENOMEM;
742 struct file *file; 742 struct file *file;
743 struct inode *inode; 743 struct inode *inode;
744 struct dentry *dentry, *root; 744 struct dentry *dentry, *root;
745 struct qstr quick_string; 745 struct qstr quick_string;
746 char buf[16];
747 static atomic_t counter;
748 746
749 if (!hugetlbfs_vfsmount) 747 if (!hugetlbfs_vfsmount)
750 return ERR_PTR(-ENOENT); 748 return ERR_PTR(-ENOENT);
@@ -756,8 +754,7 @@ struct file *hugetlb_zero_setup(size_t size)
756 return ERR_PTR(-ENOMEM); 754 return ERR_PTR(-ENOMEM);
757 755
758 root = hugetlbfs_vfsmount->mnt_root; 756 root = hugetlbfs_vfsmount->mnt_root;
759 snprintf(buf, 16, "%u", atomic_inc_return(&counter)); 757 quick_string.name = name;
760 quick_string.name = buf;
761 quick_string.len = strlen(quick_string.name); 758 quick_string.len = strlen(quick_string.name);
762 quick_string.hash = 0; 759 quick_string.hash = 0;
763 dentry = d_alloc(root, &quick_string); 760 dentry = d_alloc(root, &quick_string);
diff --git a/include/linux/hugetlb.h b/include/linux/hugetlb.h
index b4570b62ab85..2c13715e9dde 100644
--- a/include/linux/hugetlb.h
+++ b/include/linux/hugetlb.h
@@ -163,7 +163,7 @@ static inline struct hugetlbfs_sb_info *HUGETLBFS_SB(struct super_block *sb)
163 163
164extern const struct file_operations hugetlbfs_file_operations; 164extern const struct file_operations hugetlbfs_file_operations;
165extern struct vm_operations_struct hugetlb_vm_ops; 165extern struct vm_operations_struct hugetlb_vm_ops;
166struct file *hugetlb_zero_setup(size_t); 166struct file *hugetlb_file_setup(const char *name, size_t);
167int hugetlb_get_quota(struct address_space *mapping); 167int hugetlb_get_quota(struct address_space *mapping);
168void hugetlb_put_quota(struct address_space *mapping); 168void hugetlb_put_quota(struct address_space *mapping);
169 169
@@ -185,7 +185,7 @@ static inline void set_file_hugepages(struct file *file)
185 185
186#define is_file_hugepages(file) 0 186#define is_file_hugepages(file) 0
187#define set_file_hugepages(file) BUG() 187#define set_file_hugepages(file) BUG()
188#define hugetlb_zero_setup(size) ERR_PTR(-ENOSYS) 188#define hugetlb_file_setup(name,size) ERR_PTR(-ENOSYS)
189 189
190#endif /* !CONFIG_HUGETLBFS */ 190#endif /* !CONFIG_HUGETLBFS */
191 191
diff --git a/ipc/shm.c b/ipc/shm.c
index 047b823e6bf0..0852f206d895 100644
--- a/ipc/shm.c
+++ b/ipc/shm.c
@@ -366,9 +366,10 @@ static int newseg (struct ipc_namespace *ns, key_t key, int shmflg, size_t size)
366 return error; 366 return error;
367 } 367 }
368 368
369 sprintf (name, "SYSV%08x", key);
369 if (shmflg & SHM_HUGETLB) { 370 if (shmflg & SHM_HUGETLB) {
370 /* hugetlb_zero_setup takes care of mlock user accounting */ 371 /* hugetlb_file_setup takes care of mlock user accounting */
371 file = hugetlb_zero_setup(size); 372 file = hugetlb_file_setup(name, size);
372 shp->mlock_user = current->user; 373 shp->mlock_user = current->user;
373 } else { 374 } else {
374 int acctflag = VM_ACCOUNT; 375 int acctflag = VM_ACCOUNT;
@@ -379,7 +380,6 @@ static int newseg (struct ipc_namespace *ns, key_t key, int shmflg, size_t size)
379 if ((shmflg & SHM_NORESERVE) && 380 if ((shmflg & SHM_NORESERVE) &&
380 sysctl_overcommit_memory != OVERCOMMIT_NEVER) 381 sysctl_overcommit_memory != OVERCOMMIT_NEVER)
381 acctflag = 0; 382 acctflag = 0;
382 sprintf (name, "SYSV%08x", key);
383 file = shmem_file_setup(name, size, acctflag); 383 file = shmem_file_setup(name, size, acctflag);
384 } 384 }
385 error = PTR_ERR(file); 385 error = PTR_ERR(file);