structsuper_block{structlist_heads_list;/* Keep this first */dev_ts_dev;/* search index; _not_ kdev_t */unsignedchars_blocksize_bits;unsignedlongs_blocksize;loff_ts_maxbytes;/* Max file size */structfile_system_type*s_type;conststructsuper_operations*s_op;conststructdquot_operations*dq_op;conststructquotactl_ops*s_qcop;conststructexport_operations*s_export_op;unsignedlongs_flags;unsignedlongs_iflags;/* internal SB_I_* flags */unsignedlongs_magic;structdentry*s_root;structrw_semaphores_umount;ints_count;atomic_ts_active;#ifdef CONFIG_SECURITY
void*s_security;#endif
conststructxattr_handler**s_xattr;#ifdef CONFIG_FS_ENCRYPTION
conststructfscrypt_operations*s_cop;structkey*s_master_keys;/* master crypto keys in use */#endif
#ifdef CONFIG_FS_VERITY
conststructfsverity_operations*s_vop;#endif
structhlist_bl_heads_roots;/* alternate root dentries for NFS */structlist_heads_mounts;/* list of mounts; _not_ for fs use */structblock_device*s_bdev;structbacking_dev_info*s_bdi;structmtd_info*s_mtd;structhlist_nodes_instances;unsignedints_quota_types;/* Bitmask of supported quota types */structquota_infos_dquot;/* Diskquota specific options */structsb_writerss_writers;/*
* Keep s_fs_info, s_time_gran, s_fsnotify_mask, and
* s_fsnotify_marks together for cache efficiency. They are frequently
* accessed and rarely modified.
*/void*s_fs_info;/* Filesystem private info *//* Granularity of c/m/atime in ns (cannot be worse than a second) */u32s_time_gran;/* Time limits for c/m/atime in seconds */time64_ts_time_min;time64_ts_time_max;#ifdef CONFIG_FSNOTIFY
__u32s_fsnotify_mask;structfsnotify_mark_connector__rcu*s_fsnotify_marks;#endif
chars_id[32];/* Informational name */uuid_ts_uuid;/* UUID */unsignedints_max_links;fmode_ts_mode;/*
* The next field is for VFS *only*. No filesystems have any business
* even looking at it. You had been warned.
*/structmutexs_vfs_rename_mutex;/* Kludge *//*
* Filesystem subtype. If non-empty the filesystem type field
* in /proc/mounts will be "type.subtype"
*/constchar*s_subtype;conststructdentry_operations*s_d_op;/* default d_op for dentries *//*
* Saved pool identifier for cleancache (-1 means none)
*/intcleancache_poolid;structshrinkers_shrink;/* per-sb shrinker handle *//* Number of inodes with nlink == 0 but still referenced */atomic_long_ts_remove_count;/* Pending fsnotify inode refs */atomic_long_ts_fsnotify_inode_refs;/* Being remounted read-only */ints_readonly_remount;/* AIO completions deferred from interrupt context */structworkqueue_struct*s_dio_done_wq;structhlist_heads_pins;/*
* Owning user namespace and default context in which to
* interpret filesystem uids, gids, quotas, device nodes,
* xattrs and security labels.
*/structuser_namespace*s_user_ns;/*
* The list_lru structure is essentially just a pointer to a table
* of per-node lru lists, each of which has its own spinlock.
* There is no need to put them into separate cachelines.
*/structlist_lrus_dentry_lru;structlist_lrus_inode_lru;structrcu_headrcu;structwork_structdestroy_work;structmutexs_sync_lock;/* sync serialisation lock *//*
* Indicates how deep in a filesystem stack this SB is
*/ints_stack_depth;/* s_inode_list_lock protects s_inodes */spinlock_ts_inode_list_lock____cacheline_aligned_in_smp;structlist_heads_inodes;/* all inodes */spinlock_ts_inode_wblist_lock;structlist_heads_inodes_wb;/* writeback inodes */}__randomize_layout;
/*
* Keep mostly read-only and often accessed (especially for
* the RCU path lookup and 'stat' data) fields at the beginning
* of the 'struct inode'
*/structinode{// inode 类型
umode_ti_mode;unsignedshorti_opflags;kuid_ti_uid;kgid_ti_gid;unsignedinti_flags;#ifdef CONFIG_FS_POSIX_ACL
structposix_acl*i_acl;structposix_acl*i_default_acl;#endif
conststructinode_operations*i_op;structsuper_block*i_sb;// page cache 相关
structaddress_space*i_mapping;#ifdef CONFIG_SECURITY
void*i_security;#endif
/* Stat data, not accessed from path walking */unsignedlongi_ino;/*
* Filesystems may only read i_nlink directly. They shall use the
* following functions for modification:
*
* (set|clear|inc|drop)_nlink
* inode_(inc|dec)_link_count
*/union{constunsignedinti_nlink;unsignedint__i_nlink;};dev_ti_rdev;loff_ti_size;structtimespec64i_atime;structtimespec64i_mtime;structtimespec64i_ctime;spinlock_ti_lock;/* i_blocks, i_bytes, maybe i_size */unsignedshorti_bytes;u8i_blkbits;u8i_write_hint;blkcnt_ti_blocks;#ifdef __NEED_I_SIZE_ORDERED
seqcount_ti_size_seqcount;#endif
/* Misc */unsignedlongi_state;structrw_semaphorei_rwsem;unsignedlongdirtied_when;/* jiffies of first dirtying */unsignedlongdirtied_time_when;structhlist_nodei_hash;structlist_headi_io_list;/* backing dev IO list */#ifdef CONFIG_CGROUP_WRITEBACK
structbdi_writeback*i_wb;/* the associated cgroup wb *//* foreign inode detection, see wbc_detach_inode() */inti_wb_frn_winner;u16i_wb_frn_avg_time;u16i_wb_frn_history;#endif
structlist_headi_lru;/* inode LRU list */structlist_headi_sb_list;structlist_headi_wb_list;/* backing dev writeback list */union{structhlist_headi_dentry;structrcu_headi_rcu;};atomic64_ti_version;atomic64_ti_sequence;/* see futex */atomic_ti_count;atomic_ti_dio_count;atomic_ti_writecount;#if defined(CONFIG_IMA) || defined(CONFIG_FILE_LOCKING)
atomic_ti_readcount;/* struct files open RO */#endif
union{conststructfile_operations*i_fop;/* former ->i_op->default_file_ops */void(*free_inode)(structinode*);};structfile_lock_context*i_flctx;structaddress_spacei_data;structlist_headi_devices;union{structpipe_inode_info*i_pipe;structblock_device*i_bdev;structcdev*i_cdev;char*i_link;unsignedi_dir_seq;};__u32i_generation;#ifdef CONFIG_FSNOTIFY
__u32i_fsnotify_mask;/* all events this inode cares about */structfsnotify_mark_connector__rcu*i_fsnotify_marks;#endif
#ifdef CONFIG_FS_ENCRYPTION
structfscrypt_info*i_crypt_info;#endif
#ifdef CONFIG_FS_VERITY
structfsverity_info*i_verity_info;#endif
void*i_private;/* fs or device private pointer */}__randomize_layout;
structfile{union{structllist_nodefu_llist;structrcu_headfu_rcuhead;}f_u;structpathf_path;structinode*f_inode;/* cached value */conststructfile_operations*f_op;/*
* Protects f_ep_links, f_flags.
* Must not be taken from IRQ context.
*/spinlock_tf_lock;enumrw_hintf_write_hint;atomic_long_tf_count;unsignedintf_flags;fmode_tf_mode;structmutexf_pos_lock;loff_tf_pos;structfown_structf_owner;conststructcred*f_cred;structfile_ra_statef_ra;u64f_version;#ifdef CONFIG_SECURITY
void*f_security;#endif
/* needed for tty driver, and maybe others */void*private_data;#ifdef CONFIG_EPOLL
/* Used by fs/eventpoll.c to link all the hooks to this file */structlist_headf_ep_links;structlist_headf_tfile_llink;#endif /* #ifdef CONFIG_EPOLL */structaddress_space*f_mapping;errseq_tf_wb_err;}__randomize_layout__attribute__((aligned(4)));/* lest something weird decides that 2 is OK */
structdentry{/* RCU lookup touched fields */unsignedintd_flags;/* protected by d_lock */seqcount_td_seq;/* per dentry seqlock */structhlist_bl_noded_hash;/* lookup hash list */structdentry*d_parent;/* parent directory */structqstrd_name;structinode*d_inode;/* Where the name belongs to - NULL is
* negative */unsignedchard_iname[DNAME_INLINE_LEN];/* small names *//* Ref lookup also touches following */structlockrefd_lockref;/* per-dentry lock and refcount */conststructdentry_operations*d_op;structsuper_block*d_sb;/* The root of the dentry tree */unsignedlongd_time;/* used by d_revalidate */void*d_fsdata;/* fs-specific data */union{structlist_headd_lru;/* LRU list */wait_queue_head_t*d_wait;/* in-lookup ones only */};structlist_headd_child;/* child of parent list */structlist_headd_subdirs;/* our children *//*
* d_alias and d_rcu can share memory
*/union{structhlist_noded_alias;/* inode alias list */structhlist_bl_noded_in_lookup_hash;/* only for in-lookup ones */structrcu_headd_rcu;}d_u;}__randomize_layout;
/**
* struct address_space - Contents of a cacheable, mappable object.
* @host: Owner, either the inode or the block_device.
* @i_pages: Cached pages.
* @gfp_mask: Memory allocation flags to use for allocating pages.
* @i_mmap_writable: Number of VM_SHARED mappings.
* @nr_thps: Number of THPs in the pagecache (non-shmem only).
* @i_mmap: Tree of private and shared mappings.
* @i_mmap_rwsem: Protects @i_mmap and @i_mmap_writable.
* @nrpages: Number of page entries, protected by the i_pages lock.
* @nrexceptional: Shadow or DAX entries, protected by the i_pages lock.
* @writeback_index: Writeback starts here.
* @a_ops: Methods.
* @flags: Error bits and flags (AS_*).
* @wb_err: The most recent error which has occurred.
* @private_lock: For use by the owner of the address_space.
* @private_list: For use by the owner of the address_space.
* @private_data: For use by the owner of the address_space.
*/structaddress_space{// 指向文件 inode
structinode*host;// 当前文件缓存的所有 page
structxarrayi_pages;gfp_tgfp_mask;atomic_ti_mmap_writable;#ifdef CONFIG_READ_ONLY_THP_FOR_FS
/* number of thp, only for non-shmem files */atomic_tnr_thps;#endif
structrb_root_cachedi_mmap;structrw_semaphorei_mmap_rwsem;unsignedlongnrpages;unsignedlongnrexceptional;pgoff_twriteback_index;conststructaddress_space_operations*a_ops;unsignedlongflags;errseq_twb_err;spinlock_tprivate_lock;structlist_headprivate_list;void*private_data;}__attribute__((aligned(sizeof(long))))__randomize_layout;/*
* On most architectures that alignment is already the case; but
* must be enforced here for CRIS, to let the least significant bit
* of struct page's "mapping" pointer be used for PAGE_MAPPING_ANON.
*/structrequest_queue;structblock_device{dev_tbd_dev;/* not a kdev_t - it's a search key */intbd_openers;structinode*bd_inode;/* will die */structsuper_block*bd_super;structmutexbd_mutex;/* open/close mutex */void*bd_claiming;void*bd_holder;intbd_holders;boolbd_write_holder;#ifdef CONFIG_SYSFS
structlist_headbd_holder_disks;#endif
structblock_device*bd_contains;unsignedbd_block_size;u8bd_partno;structhd_struct*bd_part;/* number of times partitions within this device have been opened. */unsignedbd_part_count;intbd_invalidated;structgendisk*bd_disk;structrequest_queue*bd_queue;structbacking_dev_info*bd_bdi;structlist_headbd_list;/*
* Private data. You must have bd_claim'ed the block_device
* to use this. NOTE: bd_claim allows an owner to claim
* the same device multiple times, the owner must take special
* care to not mess up bd_private for that case.
*/unsignedlongbd_private;/* The counter of freeze processes */intbd_fsfreeze_count;/* Mutex for freeze */structmutexbd_fsfreeze_mutex;}__randomize_layout;
structaddress_space_operations{int(*writepage)(structpage*page,structwriteback_control*wbc);int(*readpage)(structfile*,structpage*);/* Write back some dirty pages from this mapping. */int(*writepages)(structaddress_space*,structwriteback_control*);/* Set a page dirty. Return true if this dirtied it */int(*set_page_dirty)(structpage*page);/*
* Reads in the requested pages. Unlike ->readpage(), this is
* PURELY used for read-ahead!.
*/int(*readpages)(structfile*filp,structaddress_space*mapping,structlist_head*pages,unsignednr_pages);int(*write_begin)(structfile*,structaddress_space*mapping,loff_tpos,unsignedlen,unsignedflags,structpage**pagep,void**fsdata);int(*write_end)(structfile*,structaddress_space*mapping,loff_tpos,unsignedlen,unsignedcopied,structpage*page,void*fsdata);/* Unfortunately this kludge is needed for FIBMAP. Don't use it */sector_t(*bmap)(structaddress_space*,sector_t);void(*invalidatepage)(structpage*,unsignedint,unsignedint);int(*releasepage)(structpage*,gfp_t);void(*freepage)(structpage*);ssize_t(*direct_IO)(structkiocb*,structiov_iter*iter);/*
* migrate the contents of a page to the specified target. If
* migrate_mode is MIGRATE_ASYNC, it must not block.
*/int(*migratepage)(structaddress_space*,structpage*,structpage*,enummigrate_mode);bool(*isolate_page)(structpage*,isolate_mode_t);void(*putback_page)(structpage*);int(*launder_page)(structpage*);int(*is_partially_uptodate)(structpage*,unsignedlong,unsignedlong);void(*is_dirty_writeback)(structpage*,bool*,bool*);int(*error_remove_page)(structaddress_space*,structpage*);/* swapfile support */int(*swap_activate)(structswap_info_struct*sis,structfile*file,sector_t*span);void(*swap_deactivate)(structfile*file);};