Commit 7872c516 authored by Andrew Morton's avatar Andrew Morton Committed by Linus Torvalds

[PATCH] hugetlbfs: specify size & inodes at mount

From: "Seth, Rohit" <rohit.seth@intel.com>

- Add support for setting the filesystem's maximum size and maximum inode
  count on the mount command line.

  This is needed because the system admin can now set the ownership of teh
  fs to non-root users.  We don't want those users to be able to use all of
  the hugepage pool.

- Prroperly update the inode creation/modification time.

- Set the blocksize to HPAGE_SIZE (instead of PAGE_CACHE_SIZE).

- Update Documentation/vm/hugetlbpage.txt.
parent 0056b34a
...@@ -68,14 +68,21 @@ call, then it is required that system administrator mount a file system of ...@@ -68,14 +68,21 @@ call, then it is required that system administrator mount a file system of
type hugetlbfs: type hugetlbfs:
mount none /mnt/huge -t hugetlbfs <uid=value> <gid=value> <mode=value> mount none /mnt/huge -t hugetlbfs <uid=value> <gid=value> <mode=value>
<size=value> <nr_inodes=value>
This command mounts a (pseudo) filesystem of type hugetlbfs on the directory This command mounts a (pseudo) filesystem of type hugetlbfs on the directory
/mnt/huge. Any files created on /mnt/huge uses hugepages. The uid and gid /mnt/huge. Any files created on /mnt/huge uses hugepages. The uid and gid
options sets the owner and group of the root of the file system. By default options sets the owner and group of the root of the file system. By default
the uid and gid of the current process are taken. The mode option sets the the uid and gid of the current process are taken. The mode option sets the
mode of root of file system to value & 0777. This value is given in octal. mode of root of file system to value & 0777. This value is given in octal.
By default the value 0755 is picked. An example is given at the end of this By default the value 0755 is picked. The size option sets the maximum value of
document. memory (huge pages) allowed for that filesystem (/mnt/huge). The size is
rounded down to HPAGE_SIZE. The option nr_inode sets the maximum number of
inodes that /mnt/huge can use. If the size or nr_inode options are not
provided on command line then no limits are set. For size and nr_inodes
options, you can use [G|g]/[M|m]/[K|k] to represent giga/mega/kilo. For
example, size=2K has the same meaning as size=2048. An example is given at
the end of this document.
read and write system calls are not supported on files that reside on hugetlb read and write system calls are not supported on files that reside on hugetlb
file systems. file systems.
......
This diff is collapsed.
...@@ -73,11 +73,28 @@ static inline int is_vm_hugetlb_page(struct vm_area_struct *vma) ...@@ -73,11 +73,28 @@ static inline int is_vm_hugetlb_page(struct vm_area_struct *vma)
#ifdef CONFIG_HUGETLBFS #ifdef CONFIG_HUGETLBFS
struct hugetlbfs_config { struct hugetlbfs_config {
uid_t uid; uid_t uid;
gid_t gid; gid_t gid;
umode_t mode; umode_t mode;
long nr_blocks;
long nr_inodes;
}; };
struct hugetlbfs_sb_info {
long max_blocks; /* blocks allowed */
long free_blocks; /* blocks free */
long max_inodes; /* inodes allowed */
long free_inodes; /* inodes free */
spinlock_t stat_lock;
};
static inline struct hugetlbfs_sb_info *HUGETLBFS_SB(struct super_block *sb)
{
return sb->s_fs_info;
}
#define PSEUDO_DIRENT_SIZE 20
extern struct file_operations hugetlbfs_file_operations; extern struct file_operations hugetlbfs_file_operations;
extern struct vm_operations_struct hugetlb_vm_ops; extern struct vm_operations_struct hugetlb_vm_ops;
struct file *hugetlb_zero_setup(size_t); struct file *hugetlb_zero_setup(size_t);
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment