tmpfs 是 内存文件系统( 不对应磁盘文件) , 却有 page cache
tmpfs 和 shmem 有什么关系
CONFIG_SHMEM 是 CONFIG_TMPFS 的基础, 当 CONFIG_SHMEM 选择了 , CONFIG_TMPFS 才可以选
CONFIG_TMPFS 是 CONFIG_SHMEM 的前端, CONFIG_TMPFS呈现给用户空间的接口
CONFIG_TMPFS 和 "tmpfs" 是 两个东西, tmpfs 不必依赖 CONFIG_TMPFS 而 存在.
CONFIG_TMPFS 只有 在 CONFIG_SHMEM 存在时才存在, 而 "tmpfs" 可以 在 CONFIG_SHMEM 不存在时而存在
"tmpfs" 一定要实现, 可简单可复杂, 总共有三种配置
CONFIG_SHMEM= n & CONFIG_TMPFS= n
CONFIG_SHMEM= y & CONFIG_TMPFS= n
CONFIG_SHMEM= y & CONFIG_TMPFS= y
| CONFIG_TMPFS: |
| |
| Tmpfs is a file system which keeps all files in virtual memory. |
| |
| Everything in tmpfs is temporary in the sense that no files will be |
| created on your hard drive. The files live in memory and swap |
| space. If you unmount a tmpfs instance, everything stored therein is |
| lost. |
| |
| See < file: Documentation/ filesystems/ tmpfs. rst> for details. |
| |
| Symbol: TMPFS [ = y] |
| Type : bool |
| Defined at fs/ Kconfig: 158 |
| Prompt: Tmpfs virtual memory file system support ( former shm fs) |
| Depends on: SHMEM [ = y] |
| Location: |
| -> File systems |
| -> Pseudo filesystems
| CONFIG_SHMEM: |
| |
| The shmem is an internal filesystem used to manage shared memory. |
| It is backed by swap and manages resource limits. It is also exported |
| to userspace as tmpfs if TMPFS is enabled. Disabling this |
| option replaces shmem and tmpfs with the much simpler ramfs code, |
| which may be appropriate on small systems without swap. |
| |
| Symbol: SHMEM [ = y] |
| Type : bool |
| Defined at init/ Kconfig: 1581 |
| Prompt: Use full shmem filesystem |
| Depends on: MMU [ = y] |
| Visible if : MMU [ = y] && EXPERT [ = y] |
| Location: |
| -> General setup |
| -> Configure standard kernel features ( expert users) ( EXPERT [ = y] )
Documentation/ translations/ zh_CN/ filesystems/ tmpfs. rst
tmpfs具有以下用途:
1 ) 内核总有一个无法看到的内部挂载,用于共享匿名映射和SYSV共享内存。
挂载不依赖于CONFIG_TMPFS。如果CONFIG_TMPFS未设置,tmpfs对用户不可见。
但是内部机制始终存在。
2 ) glibc 2.2 及更高版本期望将tmpfs挂载在/ dev/ shm上以用于POSIX共享内存
( shm_open,shm_unlink) 。添加内容到/ etc/ fstab应注意如下:
tmpfs / dev/ shm tmpfs defaults 0 0
使用时需要记住创建挂载tmpfs的目录。
SYSV共享内存无需挂载,内部已默认支持。( 在2.3 内核版本中,必须挂载
tmpfs的前身( shm fs) 才能使用SYSV共享内存)
mm/ shmem. c
shmem. c 一定会被编入内核
shmem. c 分为两种实现
1. 没有定义 CONFIG_SHMEM
2. 定义了 CONFIG_SHMEM
两种实现(其实为三种)
没定义 CONFIG_SHMEM
static struct file_system_type shmem_fs_type = {
. name = "tmpfs" ,
. init_fs_context = ramfs_init_fs_context,
. parameters = ramfs_fs_parameters,
. kill_sb = kill_litter_super,
. fs_flags = FS_USERNS_MOUNT,
} ;
# define shmem_file_operations ramfs_file_operations
const struct file_operations ramfs_file_operations = {
. read_iter = generic_file_read_iter,
. write_iter = generic_file_write_iter,
. mmap = generic_file_mmap,
. fsync = noop_fsync,
. splice_read = generic_file_splice_read,
. splice_write = iter_file_splice_write,
. llseek = generic_file_llseek,
. get_unmapped_area = ramfs_mmu_get_unmapped_area,
} ;
static struct file_system_type shmem_fs_type = {
. owner = THIS_MODULE,
. name = "tmpfs" ,
. init_fs_context = shmem_init_fs_context,
# ifdef CONFIG_TMPFS
. parameters = shmem_fs_parameters,
# endif
. kill_sb = kill_litter_super,
. fs_flags = FS_USERNS_MOUNT | FS_THP_SUPPORT,
} ;
static const struct file_operations shmem_file_operations = {
. mmap = shmem_mmap,
. get_unmapped_area = shmem_get_unmapped_area,
# ifdef CONFIG_TMPFS
. llseek = shmem_file_llseek,
. read_iter = shmem_file_read_iter,
. write_iter = generic_file_write_iter,
. fsync = noop_fsync,
. splice_read = generic_file_splice_read,
. splice_write = iter_file_splice_write,
. fallocate = shmem_fallocate,
# endif
} ;
tmpfs 共三个配置, 不管怎么配置, 都提供tmpfs
CONFIG_SHMEM= n & CONFIG_TMPFS= n
CONFIG_SHMEM= y & CONFIG_TMPFS= n
CONFIG_SHMEM= y & CONFIG_TMPFS= y
== == == == == == == == == == == == == == == == == == == == == == == == == == == == == == == == == == == == == == == == == ==
三种配置有一组共用的函数和结构变量, 我们以此为base讨论问题
▼ variables
- shm_mnt
▼ functions
- __shmem_file_setup ( struct vfsmount * mnt, const char * name, loff_t size, unsigned long flags, unsigned int i_flags)
shmem_file_setup ( const char * name, loff_t size, unsigned long flags)
shmem_file_setup_with_mnt ( struct vfsmount * mnt, const char * name, loff_t size, unsigned long flags)
shmem_kernel_file_setup ( const char * name, loff_t size, unsigned long flags)
shmem_read_mapping_page_gfp ( struct address_space * mapping, pgoff_t index, gfp_t gfp)
shmem_zero_setup ( struct vm_area_struct * vma)
== == == == == == == == == == == == == == == == == == == == == == == == == == == == == == == == == == == == == == == == == ==
CONFIG_SHMEM= n & CONFIG_TMPFS= n , tmpfs 多提供了
▼ macros
- shmem_acct_size
- shmem_file_operations
- shmem_get_inode
- shmem_unacct_size
- shmem_vm_ops
▼ variables
- shmem_fs_type
shmem_truncate_range
▼ functions
shmem_get_unmapped_area ( struct file * file, unsigned long addr, unsigned long len, unsigned long pgoff, unsigned long flags)
shmem_init ( void )
shmem_lock ( struct file * file, int lock, struct user_struct * user)
shmem_truncate_range ( struct inode * inode, loff_t lstart, loff_t lend)
shmem_unlock_mapping ( struct address_space * mapping)
shmem_unuse ( unsigned int type, bool frontswap, unsigned long * fs_pages_to_unuse)
== == == == == == == == == == == == == == == == == == == == == == == == == == == == == == == == == == == == == == == == == ==
CONFIG_SHMEM= y & CONFIG_TMPFS= n, tmpfs 多提供了
> ▼ macros
> - BLOCKS_PER_PAGE
> - BOGO_DIRENT_SIZE
> - SHMEM_HUGE_ADVISE
> - SHMEM_HUGE_ALWAYS
> - SHMEM_HUGE_DENY
> - SHMEM_HUGE_FORCE
> - SHMEM_HUGE_NEVER
> - SHMEM_HUGE_WITHIN_SIZE
> - SHMEM_INO_BATCH
> - SHMEM_SEEN_BLOCKS
> - SHMEM_SEEN_HUGE
> - SHMEM_SEEN_INODES
> - SHMEM_SEEN_INUMS
> - SHORT_SYMLINK_LEN
> - VM_ACCT
> - shmem_huge
> - vm_policy
>
> ▼ prototypes
> - DEFINE_MUTEX
> - LIST_HEAD
> - shmem_getpage_gfp ( struct inode * inode, pgoff_t index, struct page * * pagep, enum sgp_type sgp, gfp_t gfp, struct vm_area_struct * vma, struct vm_fault * vmf, vm_fault_t * fault_type)
> - shmem_replace_page ( struct page * * pagep, gfp_t gfp, struct shmem_inode_info * info, pgoff_t index)
> - shmem_should_replace_page ( struct page * page, gfp_t gfp)
> - shmem_swapin_page ( struct inode * inode, pgoff_t index, struct page * * pagep, enum sgp_type sgp, gfp_t gfp, struct vm_area_struct * vma, vm_fault_t * fault_type)
>
> ▼- shmem_falloc : struct
> [ members]
> + next
> + nr_falloced
> + nr_unswapped
> + start
> + waitq
>
> ▼- shmem_options : struct
> [ members]
> + blocks
> + full_inums
> + gid
> + huge
> + inodes
> + mode
> + mpol
> + seen
> + uid
▼ variables
> - __read_mostly
3 a51, 58
> shmem_aops
> shmem_aops
> shmem_aops
> - shmem_dir_inode_operations
> - shmem_dir_inode_operations
> shmem_enabled_attr
> - shmem_file_operations
> - shmem_file_operations
5 a61, 68
> - shmem_fs_context_ops
> - shmem_fs_type
> - shmem_fs_type
> - shmem_inode_cachep
> - shmem_inode_operations
> - shmem_inode_operations
> - shmem_ops
> - shmem_ops
6 a70, 74
> - shmem_special_inode_operations
> - shmem_special_inode_operations
> shmem_truncate_range
> - shmem_vm_ops
> - shmem_vm_ops
▼ functions
8 a77
> - SHMEM_SB ( struct super_block * sb)
9 a79, 95
> - is_huge_enabled ( struct shmem_sb_info * sbinfo)
> - shmem_acct_block ( unsigned long flags, long pages)
> - shmem_acct_size ( unsigned long flags, loff_t size)
> - shmem_add_to_page_cache ( struct page * page, struct address_space * mapping, pgoff_t index, void * expected, gfp_t gfp, struct mm_struct * charge_mm)
> - shmem_alloc_and_acct_page ( gfp_t gfp, struct inode * inode, pgoff_t index, bool huge)
> - shmem_alloc_hugepage ( gfp_t gfp, struct shmem_inode_info * info, pgoff_t index)
> - shmem_alloc_inode ( struct super_block * sb)
> - shmem_alloc_page ( gfp_t gfp, struct shmem_inode_info * info, pgoff_t index)
> shmem_charge ( struct inode * inode, long pages)
> - shmem_confirm_swap ( struct address_space * mapping, pgoff_t index, swp_entry_t swap)
> - shmem_delete_from_page_cache ( struct page * page, void * radswap)
> - shmem_destroy_inode ( struct inode * inode)
> - shmem_destroy_inodecache ( void )
> - shmem_enabled_show ( struct kobject * kobj, struct kobj_attribute * attr, char * buf)
> - shmem_enabled_store ( struct kobject * kobj, struct kobj_attribute * attr, const char * buf, size_t count)
> - shmem_evict_inode ( struct inode * inode)
> - shmem_fault ( struct vm_fault * vmf)
11 a98, 119
> - shmem_fill_super ( struct super_block * sb, struct fs_context * fc)
> - shmem_find_swap_entries ( struct address_space * mapping, pgoff_t start, unsigned int nr_entries, struct page * * entries, pgoff_t * indices, unsigned int type, bool frontswap)
> - shmem_format_huge ( int huge)
> - shmem_free_fc ( struct fs_context * fc)
> - shmem_free_in_core_inode ( struct inode * inode)
> - shmem_free_inode ( struct super_block * sb)
> - shmem_free_swap ( struct address_space * mapping, pgoff_t index, void * radswap)
> - shmem_get_inode ( struct super_block * sb, const struct inode * dir, umode_t mode, dev_t dev, unsigned long flags)
> - shmem_get_policy ( struct vm_area_struct * vma, unsigned long addr)
> - shmem_get_sbmpol ( struct shmem_sb_info * sbinfo)
> - shmem_get_tree ( struct fs_context * fc)
> shmem_get_unmapped_area ( struct file * file, unsigned long uaddr, unsigned long len, unsigned long pgoff, unsigned long flags)
> - shmem_getattr ( const struct path * path, struct kstat * stat, u32 request_mask, unsigned int query_flags)
> shmem_getpage ( struct inode * inode, pgoff_t index, struct page * * pagep, enum sgp_type sgp)
> - shmem_getpage_gfp ( struct inode * inode, pgoff_t index, struct page * * pagep, enum sgp_type sgp, gfp_t gfp, struct vm_area_struct * vma, struct vm_fault * vmf, vm_fault_t * fault_type)
> shmem_huge_enabled ( struct vm_area_struct * vma)
> shmem_init ( void )
> shmem_init_fs_context ( struct fs_context * fc)
> - shmem_init_inode ( void * foo)
> - shmem_init_inodecache ( void )
> - shmem_inode_acct_block ( struct inode * inode, long pages)
> - shmem_inode_unacct_blocks ( struct inode * inode, long pages)
12 a121, 132
> shmem_lock ( struct file * file, int lock, struct user_struct * user)
> shmem_mcopy_atomic_pte ( struct mm_struct * dst_mm, pmd_t * dst_pmd, struct vm_area_struct * dst_vma, unsigned long dst_addr, unsigned long src_addr, struct page * * pagep)
> - shmem_mfill_atomic_pte ( struct mm_struct * dst_mm, pmd_t * dst_pmd, struct vm_area_struct * dst_vma, unsigned long dst_addr, unsigned long src_addr, bool zeropage, struct page * * pagep)
> shmem_mfill_zeropage_pte ( struct mm_struct * dst_mm, pmd_t * dst_pmd, struct vm_area_struct * dst_vma, unsigned long dst_addr)
> - shmem_mmap ( struct file * file, struct vm_area_struct * vma)
> - shmem_parse_huge ( const char * str)
> shmem_partial_swap_usage ( struct address_space * mapping, pgoff_t start, pgoff_t end)
> - shmem_pseudo_vma_destroy ( struct vm_area_struct * vma)
> - shmem_pseudo_vma_init ( struct vm_area_struct * vma, struct shmem_inode_info * info, pgoff_t index)
> - shmem_punch_compound ( struct page * page, pgoff_t start, pgoff_t end)
> - shmem_put_super ( struct super_block * sb)
> - shmem_reacct_size ( unsigned long flags, loff_t oldsize, loff_t newsize)
13 a134, 158
> - shmem_recalc_inode ( struct inode * inode)
> - shmem_replace_entry ( struct address_space * mapping, pgoff_t index, void * expected, void * replacement)
> - shmem_replace_page ( struct page * * pagep, gfp_t gfp, struct shmem_inode_info * info, pgoff_t index)
> - shmem_reserve_inode ( struct super_block * sb, ino_t * inop)
> - shmem_set_policy ( struct vm_area_struct * vma, struct mempolicy * mpol)
> - shmem_setattr ( struct dentry * dentry, struct iattr * attr)
> - shmem_should_replace_page ( struct page * page, gfp_t gfp)
> - shmem_show_mpol ( struct seq_file * seq, struct mempolicy * mpol)
> shmem_swap_usage ( struct vm_area_struct * vma)
> - shmem_swapin ( swp_entry_t swap, gfp_t gfp, struct shmem_inode_info * info, pgoff_t index)
> - shmem_swapin_page ( struct inode * inode, pgoff_t index, struct page * * pagep, enum sgp_type sgp, gfp_t gfp, struct vm_area_struct * vma, vm_fault_t * fault_type)
> shmem_truncate_range ( struct inode * inode, loff_t lstart, loff_t lend)
> - shmem_unacct_blocks ( unsigned long flags, long pages)
> - shmem_unacct_size ( unsigned long flags, loff_t size)
> shmem_uncharge ( struct inode * inode, long pages)
> - shmem_undo_range ( struct inode * inode, loff_t lstart, loff_t lend, bool unfalloc)
> shmem_unlock_mapping ( struct address_space * mapping)
> shmem_unuse ( unsigned int type, bool frontswap, unsigned long * fs_pages_to_unuse)
> - shmem_unuse_inode ( struct inode * inode, unsigned int type, bool frontswap, unsigned long * fs_pages_to_unuse)
> - shmem_unuse_swap_entries ( struct inode * inode, struct pagevec pvec, pgoff_t * indices)
> - shmem_unused_huge_count ( struct super_block * sb, struct shrink_control * sc)
> - shmem_unused_huge_scan ( struct super_block * sb, struct shrink_control * sc)
> - shmem_unused_huge_shrink ( struct shmem_sb_info * sbinfo, struct shrink_control * sc, unsigned long nr_to_split)
> - shmem_unused_huge_shrink ( struct shmem_sb_info * sbinfo, struct shrink_control * sc, unsigned long nr_to_split)
> - shmem_writepage ( struct page * page, struct writeback_control * wbc)
14 a160, 161
> - synchronous_wake_function ( wait_queue_entry_t * wait, unsigned mode, int sync, void * key)
> vma_is_shmem ( struct vm_area_struct * vma)
== == == == == == == == == == == == == == == == == == == == == == == == == == == == == == == == == == == == == == == == == ==
CONFIG_SHMEM= y & CONFIG_TMPFS= y, tmpfs 多提供了
0 a1, 68
> " Press < F1> , ? for help
>
> ▼ macros
> - BLOCKS_PER_PAGE
> - BOGO_DIRENT_SIZE
> - SHMEM_HUGE_ADVISE
> - SHMEM_HUGE_ALWAYS
> - SHMEM_HUGE_DENY
> - SHMEM_HUGE_FORCE
> - SHMEM_HUGE_NEVER
> - SHMEM_HUGE_WITHIN_SIZE
> - SHMEM_INO_BATCH
> - SHMEM_SEEN_BLOCKS
> - SHMEM_SEEN_HUGE
> - SHMEM_SEEN_INODES
> - SHMEM_SEEN_INUMS
> - SHORT_SYMLINK_LEN
> - VM_ACCT
> - shmem_acct_size
> - shmem_file_operations
> - shmem_get_inode
> - shmem_huge
> - shmem_initxattrs
> - shmem_unacct_size
> - shmem_vm_ops
> - vm_policy
>
> ▼ prototypes
> - DEFINE_MUTEX
> - LIST_HEAD
> - shmem_getpage_gfp ( struct inode * inode, pgoff_t index, struct page * * pagep, enum sgp_type sgp, gfp_t gfp, struct vm_area_struct * vma, struct vm_fault * vmf, vm_fault_t * fault_type)
> - shmem_initxattrs ( struct inode * , const struct xattr * , void * )
> - shmem_replace_page ( struct page * * pagep, gfp_t gfp, struct shmem_inode_info * info, pgoff_t index)
> - shmem_should_replace_page ( struct page * page, gfp_t gfp)
> - shmem_swapin_page ( struct inode * inode, pgoff_t index, struct page * * pagep, enum sgp_type sgp, gfp_t gfp, struct vm_area_struct * vma, vm_fault_t * fault_type)
>
> ▼- shmem_param : enum
> [ enumerators]
> - Opt_gid
> - Opt_huge
> - Opt_inode32
> - Opt_inode64
> - Opt_mode
> - Opt_mpol
> - Opt_nr_blocks
> - Opt_nr_inodes
> - Opt_size
> - Opt_uid
>
> ▼- shmem_falloc : struct
> [ members]
> + next
> + nr_falloced
> + nr_unswapped
> + start
> + waitq
>
> ▼- shmem_options : struct
> [ members]
> + blocks
> + full_inums
> + gid
> + huge
> + inodes
> + mode
> + mpol
> + seen
> + uid
▼ variables
2 a71
> - __read_mostly
3 a73, 81
> shmem_aops
> shmem_aops
> shmem_aops
> - shmem_dir_inode_operations
> - shmem_dir_inode_operations
> shmem_enabled_attr
> - shmem_export_ops
> - shmem_file_operations
> - shmem_file_operations
5 a84, 94
> - shmem_fs_context_ops
> shmem_fs_parameters
> - shmem_fs_type
> - shmem_fs_type
> - shmem_fs_type
> - shmem_inode_cachep
> - shmem_inode_operations
> - shmem_inode_operations
> - shmem_ops
> - shmem_ops
> - shmem_param_enums_huge
6 a96, 108
> - shmem_security_xattr_handler
> - shmem_short_symlink_operations
> - shmem_short_symlink_operations
> - shmem_special_inode_operations
> - shmem_special_inode_operations
> - shmem_symlink_inode_operations
> - shmem_symlink_inode_operations
> shmem_truncate_range
> shmem_truncate_range
> - shmem_trusted_xattr_handler
> - shmem_vm_ops
> - shmem_vm_ops
> - shmem_xattr_handlers
▼ functions
8 a111
> - SHMEM_SB ( struct super_block * sb)
9 a113, 138
> - is_huge_enabled ( struct shmem_sb_info * sbinfo)
> - shmem_acct_block ( unsigned long flags, long pages)
> - shmem_acct_size ( unsigned long flags, loff_t size)
> - shmem_add_to_page_cache ( struct page * page, struct address_space * mapping, pgoff_t index, void * expected, gfp_t gfp, struct mm_struct * charge_mm)
> - shmem_alloc_and_acct_page ( gfp_t gfp, struct inode * inode, pgoff_t index, bool huge)
> - shmem_alloc_hugepage ( gfp_t gfp, struct shmem_inode_info * info, pgoff_t index)
> - shmem_alloc_inode ( struct super_block * sb)
> - shmem_alloc_page ( gfp_t gfp, struct shmem_inode_info * info, pgoff_t index)
> shmem_charge ( struct inode * inode, long pages)
> - shmem_confirm_swap ( struct address_space * mapping, pgoff_t index, swp_entry_t swap)
> - shmem_create ( struct inode * dir, struct dentry * dentry, umode_t mode, bool excl)
> - shmem_default_max_blocks ( void )
> - shmem_default_max_inodes ( void )
> - shmem_delete_from_page_cache ( struct page * page, void * radswap)
> - shmem_destroy_inode ( struct inode * inode)
> - shmem_destroy_inodecache ( void )
> - shmem_enabled_show ( struct kobject * kobj, struct kobj_attribute * attr, char * buf)
> - shmem_enabled_store ( struct kobject * kobj, struct kobj_attribute * attr, const char * buf, size_t count)
> - shmem_encode_fh ( struct inode * inode, __u32 * fh, int * len, struct inode * parent)
> - shmem_evict_inode ( struct inode * inode)
> - shmem_exchange ( struct inode * old_dir, struct dentry * old_dentry, struct inode * new_dir, struct dentry * new_dentry)
> - shmem_fallocate ( struct file * file, int mode, loff_t offset, loff_t len)
> - shmem_fault ( struct vm_fault * vmf)
> - shmem_fh_to_dentry ( struct super_block * sb, struct fid * fid, int fh_len, int fh_type)
> - shmem_file_llseek ( struct file * file, loff_t offset, int whence)
> - shmem_file_read_iter ( struct kiocb * iocb, struct iov_iter * to)
11 a141, 168
> - shmem_fill_super ( struct super_block * sb, struct fs_context * fc)
> - shmem_find_alias ( struct inode * inode)
> - shmem_find_swap_entries ( struct address_space * mapping, pgoff_t start, unsigned int nr_entries, struct page * * entries, pgoff_t * indices, unsigned int type, bool frontswap)
> - shmem_format_huge ( int huge)
> - shmem_free_fc ( struct fs_context * fc)
> - shmem_free_in_core_inode ( struct inode * inode)
> - shmem_free_inode ( struct super_block * sb)
> - shmem_free_swap ( struct address_space * mapping, pgoff_t index, void * radswap)
> - shmem_get_inode ( struct super_block * sb, const struct inode * dir, umode_t mode, dev_t dev, unsigned long flags)
> - shmem_get_link ( struct dentry * dentry, struct inode * inode, struct delayed_call * done)
> - shmem_get_parent ( struct dentry * child)
> - shmem_get_policy ( struct vm_area_struct * vma, unsigned long addr)
> - shmem_get_sbmpol ( struct shmem_sb_info * sbinfo)
> - shmem_get_tree ( struct fs_context * fc)
> shmem_get_unmapped_area ( struct file * file, unsigned long addr, unsigned long len, unsigned long pgoff, unsigned long flags)
> shmem_get_unmapped_area ( struct file * file, unsigned long uaddr, unsigned long len, unsigned long pgoff, unsigned long flags)
> - shmem_getattr ( const struct path * path, struct kstat * stat, u32 request_mask, unsigned int query_flags)
> shmem_getpage ( struct inode * inode, pgoff_t index, struct page * * pagep, enum sgp_type sgp)
> - shmem_getpage_gfp ( struct inode * inode, pgoff_t index, struct page * * pagep, enum sgp_type sgp, gfp_t gfp, struct vm_area_struct * vma, struct vm_fault * vmf, vm_fault_t * fault_type)
> shmem_huge_enabled ( struct vm_area_struct * vma)
> shmem_init ( void )
> shmem_init ( void )
> shmem_init_fs_context ( struct fs_context * fc)
> - shmem_init_inode ( void * foo)
> - shmem_init_inodecache ( void )
> - shmem_initxattrs ( struct inode * inode, const struct xattr * xattr_array, void * fs_info)
> - shmem_inode_acct_block ( struct inode * inode, long pages)
> - shmem_inode_unacct_blocks ( struct inode * inode, long pages)
12 a170, 190
> - shmem_link ( struct dentry * old_dentry, struct inode * dir, struct dentry * dentry)
> - shmem_listxattr ( struct dentry * dentry, char * buffer, size_t size)
> shmem_lock ( struct file * file, int lock, struct user_struct * user)
> shmem_lock ( struct file * file, int lock, struct user_struct * user)
> - shmem_match ( struct inode * ino, void * vfh)
> shmem_mcopy_atomic_pte ( struct mm_struct * dst_mm, pmd_t * dst_pmd, struct vm_area_struct * dst_vma, unsigned long dst_addr, unsigned long src_addr, struct page * * pagep)
> - shmem_mfill_atomic_pte ( struct mm_struct * dst_mm, pmd_t * dst_pmd, struct vm_area_struct * dst_vma, unsigned long dst_addr, unsigned long src_addr, bool zeropage, struct page * * pagep)
> shmem_mfill_zeropage_pte ( struct mm_struct * dst_mm, pmd_t * dst_pmd, struct vm_area_struct * dst_vma, unsigned long dst_addr)
> - shmem_mkdir ( struct inode * dir, struct dentry * dentry, umode_t mode)
> - shmem_mknod ( struct inode * dir, struct dentry * dentry, umode_t mode, dev_t dev)
> - shmem_mmap ( struct file * file, struct vm_area_struct * vma)
> - shmem_parse_huge ( const char * str)
> - shmem_parse_one ( struct fs_context * fc, struct fs_parameter * param)
> - shmem_parse_options ( struct fs_context * fc, void * data)
> shmem_partial_swap_usage ( struct address_space * mapping, pgoff_t start, pgoff_t end)
> - shmem_pseudo_vma_destroy ( struct vm_area_struct * vma)
> - shmem_pseudo_vma_init ( struct vm_area_struct * vma, struct shmem_inode_info * info, pgoff_t index)
> - shmem_punch_compound ( struct page * page, pgoff_t start, pgoff_t end)
> - shmem_put_link ( void * arg)
> - shmem_put_super ( struct super_block * sb)
> - shmem_reacct_size ( unsigned long flags, loff_t oldsize, loff_t newsize)
13 a192, 233
> - shmem_recalc_inode ( struct inode * inode)
> - shmem_reconfigure ( struct fs_context * fc)
> - shmem_rename2 ( struct inode * old_dir, struct dentry * old_dentry, struct inode * new_dir, struct dentry * new_dentry, unsigned int flags)
> - shmem_replace_entry ( struct address_space * mapping, pgoff_t index, void * expected, void * replacement)
> - shmem_replace_page ( struct page * * pagep, gfp_t gfp, struct shmem_inode_info * info, pgoff_t index)
> - shmem_reserve_inode ( struct super_block * sb, ino_t * inop)
> - shmem_rmdir ( struct inode * dir, struct dentry * dentry)
> - shmem_seek_hole_data ( struct address_space * mapping, pgoff_t index, pgoff_t end, int whence)
> - shmem_set_policy ( struct vm_area_struct * vma, struct mempolicy * mpol)
> - shmem_setattr ( struct dentry * dentry, struct iattr * attr)
> - shmem_should_replace_page ( struct page * page, gfp_t gfp)
> - shmem_show_mpol ( struct seq_file * seq, struct mempolicy * mpol)
> - shmem_show_options ( struct seq_file * seq, struct dentry * root)
> - shmem_statfs ( struct dentry * dentry, struct kstatfs * buf)
> shmem_swap_usage ( struct vm_area_struct * vma)
> - shmem_swapin ( swp_entry_t swap, gfp_t gfp, struct shmem_inode_info * info, pgoff_t index)
> - shmem_swapin_page ( struct inode * inode, pgoff_t index, struct page * * pagep, enum sgp_type sgp, gfp_t gfp, struct vm_area_struct * vma, vm_fault_t * fault_type)
> - shmem_symlink ( struct inode * dir, struct dentry * dentry, const char * symname)
> - shmem_tmpfile ( struct inode * dir, struct dentry * dentry, umode_t mode)
> shmem_truncate_range ( struct inode * inode, loff_t lstart, loff_t lend)
> shmem_truncate_range ( struct inode * inode, loff_t lstart, loff_t lend)
> - shmem_unacct_blocks ( unsigned long flags, long pages)
> - shmem_unacct_size ( unsigned long flags, loff_t size)
> shmem_uncharge ( struct inode * inode, long pages)
> - shmem_undo_range ( struct inode * inode, loff_t lstart, loff_t lend, bool unfalloc)
> - shmem_unlink ( struct inode * dir, struct dentry * dentry)
> shmem_unlock_mapping ( struct address_space * mapping)
> shmem_unlock_mapping ( struct address_space * mapping)
> shmem_unuse ( unsigned int type, bool frontswap, unsigned long * fs_pages_to_unuse)
> shmem_unuse ( unsigned int type, bool frontswap, unsigned long * fs_pages_to_unuse)
> - shmem_unuse_inode ( struct inode * inode, unsigned int type, bool frontswap, unsigned long * fs_pages_to_unuse)
> - shmem_unuse_swap_entries ( struct inode * inode, struct pagevec pvec, pgoff_t * indices)
> - shmem_unused_huge_count ( struct super_block * sb, struct shrink_control * sc)
> - shmem_unused_huge_scan ( struct super_block * sb, struct shrink_control * sc)
> - shmem_unused_huge_shrink ( struct shmem_sb_info * sbinfo, struct shrink_control * sc, unsigned long nr_to_split)
> - shmem_unused_huge_shrink ( struct shmem_sb_info * sbinfo, struct shrink_control * sc, unsigned long nr_to_split)
> - shmem_whiteout ( struct inode * old_dir, struct dentry * old_dentry)
> - shmem_write_begin ( struct file * file, struct address_space * mapping, loff_t pos, unsigned len, unsigned flags, struct page * * pagep, void * * fsdata)
> - shmem_write_end ( struct file * file, struct address_space * mapping, loff_t pos, unsigned len, unsigned copied, struct page * page, void * fsdata)
> - shmem_writepage ( struct page * page, struct writeback_control * wbc)
> - shmem_xattr_handler_get ( const struct xattr_handler * handler, struct dentry * unused, struct inode * inode, const char * name, void * buffer, size_t size)
> - shmem_xattr_handler_set ( const struct xattr_handler * handler, struct dentry * unused, struct inode * inode, const char * name, const void * value, size_t size, int flags)
14 a235, 236
> - synchronous_wake_function ( wait_queue_entry_t * wait, unsigned mode, int sync, void * key)
> vma_is_shmem ( struct vm_area_struct * vma)
== == == == == == == == == == == == == == == == == == == == == == == == == == == == == == == == == == == == == == == == == ==
"CONFIG_SHMEM=y & CONFIG_TMPFS=y" 相较于 "CONFIG_SHMEM=y & CONFIG_TMPFS=n" 多了
0 a1, 2
> " Press < F1> , ? for help
>
16 a19, 21
> - shmem_acct_size
> - shmem_file_operations
> - shmem_get_inode
17 a23, 25
> - shmem_initxattrs
> - shmem_unacct_size
> - shmem_vm_ops
23 a32
> - shmem_initxattrs ( struct inode * , const struct xattr * , void * )
27 a37, 49
> ▼- shmem_param : enum
> [ enumerators]
> - Opt_gid
> - Opt_huge
> - Opt_inode32
> - Opt_inode64
> - Opt_mode
> - Opt_mpol
> - Opt_nr_blocks
> - Opt_nr_inodes
> - Opt_size
> - Opt_uid
>
▼ variables
56 a79
> - shmem_export_ops
61 a85, 86
> shmem_fs_parameters
> - shmem_fs_type
68 a94
> - shmem_param_enums_huge
69 a96, 98
> - shmem_security_xattr_handler
> - shmem_short_symlink_operations
> - shmem_short_symlink_operations
71 a101, 103
> - shmem_symlink_inode_operations
> - shmem_symlink_inode_operations
> shmem_truncate_range
72 a105
> - shmem_trusted_xattr_handler
74 a108
> - shmem_xattr_handlers
▼ functions
88 a123, 125
> - shmem_create ( struct inode * dir, struct dentry * dentry, umode_t mode, bool excl)
> - shmem_default_max_blocks ( void )
> - shmem_default_max_inodes ( void )
93 a131
> - shmem_encode_fh ( struct inode * inode, __u32 * fh, int * len, struct inode * parent)
94 a133, 134
> - shmem_exchange ( struct inode * old_dir, struct dentry * old_dentry, struct inode * new_dir, struct dentry * new_dentry)
> - shmem_fallocate ( struct file * file, int mode, loff_t offset, loff_t len)
95 a136, 138
> - shmem_fh_to_dentry ( struct super_block * sb, struct fid * fid, int fh_len, int fh_type)
> - shmem_file_llseek ( struct file * file, loff_t offset, int whence)
> - shmem_file_read_iter ( struct kiocb * iocb, struct iov_iter * to)
98 a142
> - shmem_find_alias ( struct inode * inode)
105 a150, 151
> - shmem_get_link ( struct dentry * dentry, struct inode * inode, struct delayed_call * done)
> - shmem_get_parent ( struct dentry * child)
108 a155
> shmem_get_unmapped_area ( struct file * file, unsigned long addr, unsigned long len, unsigned long pgoff, unsigned long flags)
114 a162
> shmem_init ( void )
117 a166
> - shmem_initxattrs ( struct inode * inode, const struct xattr * xattr_array, void * fs_info)
120 a170, 172
> - shmem_link ( struct dentry * old_dentry, struct inode * dir, struct dentry * dentry)
> - shmem_listxattr ( struct dentry * dentry, char * buffer, size_t size)
> shmem_lock ( struct file * file, int lock, struct user_struct * user)
121 a174
> - shmem_match ( struct inode * ino, void * vfh)
124 a178, 179
> - shmem_mkdir ( struct inode * dir, struct dentry * dentry, umode_t mode)
> - shmem_mknod ( struct inode * dir, struct dentry * dentry, umode_t mode, dev_t dev)
126 a182, 183
> - shmem_parse_one ( struct fs_context * fc, struct fs_parameter * param)
> - shmem_parse_options ( struct fs_context * fc, void * data)
130 a188
> - shmem_put_link ( void * arg)
134 a193, 194
> - shmem_reconfigure ( struct fs_context * fc)
> - shmem_rename2 ( struct inode * old_dir, struct dentry * old_dentry, struct inode * new_dir, struct dentry * new_dentry, unsigned int flags)
137 a198, 199
> - shmem_rmdir ( struct inode * dir, struct dentry * dentry)
> - shmem_seek_hole_data ( struct address_space * mapping, pgoff_t index, pgoff_t end, int whence)
141 a204, 205
> - shmem_show_options ( struct seq_file * seq, struct dentry * root)
> - shmem_statfs ( struct dentry * dentry, struct kstatfs * buf)
144 a209, 211
> - shmem_symlink ( struct inode * dir, struct dentry * dentry, const char * symname)
> - shmem_tmpfile ( struct inode * dir, struct dentry * dentry, umode_t mode)
> shmem_truncate_range ( struct inode * inode, loff_t lstart, loff_t lend)
149 a217
> - shmem_unlink ( struct inode * dir, struct dentry * dentry)
150 a219, 220
> shmem_unlock_mapping ( struct address_space * mapping)
> shmem_unuse ( unsigned int type, bool frontswap, unsigned long * fs_pages_to_unuse)
157 a228, 230
> - shmem_whiteout ( struct inode * old_dir, struct dentry * old_dentry)
> - shmem_write_begin ( struct file * file, struct address_space * mapping, loff_t pos, unsigned len, unsigned flags, struct page * * pagep, void * * fsdata)
> - shmem_write_end ( struct file * file, struct address_space * mapping, loff_t pos, unsigned len, unsigned copied, struct page * page, void * fsdata)
158 a232, 233
> - shmem_xattr_handler_get ( const struct xattr_handler * handler, struct dentry * unused, struct inode * inode, const char * name, void * buffer, size_t size)
> - shmem_xattr_handler_set ( const struct xattr_handler * handler, struct dentry * unused, struct inode * inode, const char * name, const void * value, size_t size, int flags)
真实文件系统的四个问题
TODO