···22#ifndef _LINUX_FS_H33#define _LINUX_FS_H4455+#include <linux/fs/super_types.h>56#include <linux/vfsdebug.h>67#include <linux/linkage.h>78#include <linux/wait_bit.h>···1211#include <linux/stat.h>1312#include <linux/cache.h>1413#include <linux/list.h>1515-#include <linux/list_lru.h>1614#include <linux/llist.h>1715#include <linux/radix-tree.h>1816#include <linux/xarray.h>···3737#include <linux/uuid.h>3838#include <linux/errseq.h>3939#include <linux/ioprio.h>4040-#include <linux/fs_dirent.h>4140#include <linux/build_bug.h>4241#include <linux/stddef.h>4342#include <linux/mount.h>···5152#include <asm/byteorder.h>5253#include <uapi/linux/fs.h>53545454-struct backing_dev_info;5555struct bdi_writeback;5656struct bio;5757struct io_comp_batch;5858-struct export_operations;5958struct fiemap_extent_info;6059struct hd_geometry;6160struct iovec;···6770struct cred;6871struct swap_info_struct;6972struct seq_file;7070-struct workqueue_struct;7173struct iov_iter;7272-struct fscrypt_operations;7373-struct fsverity_operations;7474struct fsnotify_mark_connector;7575-struct fsnotify_sb_info;7675struct fs_context;7776struct fs_parameter_spec;7877struct file_kattr;···290297 */291298 struct file *ia_file;292299};293293-294294-/*295295- * Includes for diskquotas.296296- */297297-#include <linux/quota.h>298300299301/*300302 * Maximum number of layers of fs stack. Needs to be limited to···13361348extern int send_sigurg(struct file *file);1337134913381350/*13391339- * sb->s_flags. Note that these mirror the equivalent MS_* flags where13401340- * represented in both.13411341- */13421342-#define SB_RDONLY BIT(0) /* Mount read-only */13431343-#define SB_NOSUID BIT(1) /* Ignore suid and sgid bits */13441344-#define SB_NODEV BIT(2) /* Disallow access to device special files */13451345-#define SB_NOEXEC BIT(3) /* Disallow program execution */13461346-#define SB_SYNCHRONOUS BIT(4) /* Writes are synced at once */13471347-#define SB_MANDLOCK BIT(6) /* Allow mandatory locks on an FS */13481348-#define SB_DIRSYNC BIT(7) /* Directory modifications are synchronous */13491349-#define SB_NOATIME BIT(10) /* Do not update access times. */13501350-#define SB_NODIRATIME BIT(11) /* Do not update directory access times */13511351-#define SB_SILENT BIT(15)13521352-#define SB_POSIXACL BIT(16) /* Supports POSIX ACLs */13531353-#define SB_INLINECRYPT BIT(17) /* Use blk-crypto for encrypted files */13541354-#define SB_KERNMOUNT BIT(22) /* this is a kern_mount call */13551355-#define SB_I_VERSION BIT(23) /* Update inode I_version field */13561356-#define SB_LAZYTIME BIT(25) /* Update the on-disk [acm]times lazily */13571357-13581358-/* These sb flags are internal to the kernel */13591359-#define SB_DEAD BIT(21)13601360-#define SB_DYING BIT(24)13611361-#define SB_FORCE BIT(27)13621362-#define SB_NOSEC BIT(28)13631363-#define SB_BORN BIT(29)13641364-#define SB_ACTIVE BIT(30)13651365-#define SB_NOUSER BIT(31)13661366-13671367-/* These flags relate to encoding and casefolding */13681368-#define SB_ENC_STRICT_MODE_FL (1 << 0)13691369-#define SB_ENC_NO_COMPAT_FALLBACK_FL (1 << 1)13701370-13711371-#define sb_has_strict_encoding(sb) \13721372- (sb->s_encoding_flags & SB_ENC_STRICT_MODE_FL)13731373-13741374-#if IS_ENABLED(CONFIG_UNICODE)13751375-#define sb_no_casefold_compat_fallback(sb) \13761376- (sb->s_encoding_flags & SB_ENC_NO_COMPAT_FALLBACK_FL)13771377-#else13781378-#define sb_no_casefold_compat_fallback(sb) (1)13791379-#endif13801380-13811381-/*13821351 * Umount options13831352 */13841353···13441399#define MNT_EXPIRE 0x00000004 /* Mark for expiry */13451400#define UMOUNT_NOFOLLOW 0x00000008 /* Don't follow symlink on umount */13461401#define UMOUNT_UNUSED 0x80000000 /* Flag guaranteed to be unused */13471347-13481348-/* sb->s_iflags */13491349-#define SB_I_CGROUPWB 0x00000001 /* cgroup-aware writeback enabled */13501350-#define SB_I_NOEXEC 0x00000002 /* Ignore executables on this fs */13511351-#define SB_I_NODEV 0x00000004 /* Ignore devices on this fs */13521352-#define SB_I_STABLE_WRITES 0x00000008 /* don't modify blks until WB is done */13531353-13541354-/* sb->s_iflags to limit user namespace mounts */13551355-#define SB_I_USERNS_VISIBLE 0x00000010 /* fstype already mounted */13561356-#define SB_I_IMA_UNVERIFIABLE_SIGNATURE 0x0000002013571357-#define SB_I_UNTRUSTED_MOUNTER 0x0000004013581358-#define SB_I_EVM_HMAC_UNSUPPORTED 0x0000008013591359-13601360-#define SB_I_SKIP_SYNC 0x00000100 /* Skip superblock at global sync */13611361-#define SB_I_PERSB_BDI 0x00000200 /* has a per-sb bdi */13621362-#define SB_I_TS_EXPIRY_WARNED 0x00000400 /* warned about timestamp range expiry */13631363-#define SB_I_RETIRED 0x00000800 /* superblock shouldn't be reused */13641364-#define SB_I_NOUMASK 0x00001000 /* VFS does not apply umask */13651365-#define SB_I_NOIDMAP 0x00002000 /* No idmapped mounts on this superblock */13661366-#define SB_I_ALLOW_HSM 0x00004000 /* Allow HSM events on this superblock */13671367-13681368-/* Possible states of 'frozen' field */13691369-enum {13701370- SB_UNFROZEN = 0, /* FS is unfrozen */13711371- SB_FREEZE_WRITE = 1, /* Writes, dir ops, ioctls frozen */13721372- SB_FREEZE_PAGEFAULT = 2, /* Page faults stopped as well */13731373- SB_FREEZE_FS = 3, /* For internal FS use (e.g. to stop13741374- * internal threads if needed) */13751375- SB_FREEZE_COMPLETE = 4, /* ->freeze_fs finished successfully */13761376-};13771377-13781378-#define SB_FREEZE_LEVELS (SB_FREEZE_COMPLETE - 1)13791379-13801380-struct sb_writers {13811381- unsigned short frozen; /* Is sb frozen? */13821382- int freeze_kcount; /* How many kernel freeze requests? */13831383- int freeze_ucount; /* How many userspace freeze requests? */13841384- const void *freeze_owner; /* Owner of the freeze */13851385- struct percpu_rw_semaphore rw_sem[SB_FREEZE_LEVELS];13861386-};13871387-13881388-struct mount;13891389-13901390-struct super_block {13911391- struct list_head s_list; /* Keep this first */13921392- dev_t s_dev; /* search index; _not_ kdev_t */13931393- unsigned char s_blocksize_bits;13941394- unsigned long s_blocksize;13951395- loff_t s_maxbytes; /* Max file size */13961396- struct file_system_type *s_type;13971397- const struct super_operations *s_op;13981398- const struct dquot_operations *dq_op;13991399- const struct quotactl_ops *s_qcop;14001400- const struct export_operations *s_export_op;14011401- unsigned long s_flags;14021402- unsigned long s_iflags; /* internal SB_I_* flags */14031403- unsigned long s_magic;14041404- struct dentry *s_root;14051405- struct rw_semaphore s_umount;14061406- int s_count;14071407- atomic_t s_active;14081408-#ifdef CONFIG_SECURITY14091409- void *s_security;14101410-#endif14111411- const struct xattr_handler * const *s_xattr;14121412-#ifdef CONFIG_FS_ENCRYPTION14131413- const struct fscrypt_operations *s_cop;14141414- struct fscrypt_keyring *s_master_keys; /* master crypto keys in use */14151415-#endif14161416-#ifdef CONFIG_FS_VERITY14171417- const struct fsverity_operations *s_vop;14181418-#endif14191419-#if IS_ENABLED(CONFIG_UNICODE)14201420- struct unicode_map *s_encoding;14211421- __u16 s_encoding_flags;14221422-#endif14231423- struct hlist_bl_head s_roots; /* alternate root dentries for NFS */14241424- struct mount *s_mounts; /* list of mounts; _not_ for fs use */14251425- struct block_device *s_bdev; /* can go away once we use an accessor for @s_bdev_file */14261426- struct file *s_bdev_file;14271427- struct backing_dev_info *s_bdi;14281428- struct mtd_info *s_mtd;14291429- struct hlist_node s_instances;14301430- unsigned int s_quota_types; /* Bitmask of supported quota types */14311431- struct quota_info s_dquot; /* Diskquota specific options */14321432-14331433- struct sb_writers s_writers;14341434-14351435- /*14361436- * Keep s_fs_info, s_time_gran, s_fsnotify_mask, and14371437- * s_fsnotify_info together for cache efficiency. They are frequently14381438- * accessed and rarely modified.14391439- */14401440- void *s_fs_info; /* Filesystem private info */14411441-14421442- /* Granularity of c/m/atime in ns (cannot be worse than a second) */14431443- u32 s_time_gran;14441444- /* Time limits for c/m/atime in seconds */14451445- time64_t s_time_min;14461446- time64_t s_time_max;14471447-#ifdef CONFIG_FSNOTIFY14481448- u32 s_fsnotify_mask;14491449- struct fsnotify_sb_info *s_fsnotify_info;14501450-#endif14511451-14521452- /*14531453- * q: why are s_id and s_sysfs_name not the same? both are human14541454- * readable strings that identify the filesystem14551455- * a: s_id is allowed to change at runtime; it's used in log messages,14561456- * and we want to when a device starts out as single device (s_id is dev14571457- * name) but then a device is hot added and we have to switch to14581458- * identifying it by UUID14591459- * but s_sysfs_name is a handle for programmatic access, and can't14601460- * change at runtime14611461- */14621462- char s_id[32]; /* Informational name */14631463- uuid_t s_uuid; /* UUID */14641464- u8 s_uuid_len; /* Default 16, possibly smaller for weird filesystems */14651465-14661466- /* if set, fs shows up under sysfs at /sys/fs/$FSTYP/s_sysfs_name */14671467- char s_sysfs_name[UUID_STRING_LEN + 1];14681468-14691469- unsigned int s_max_links;14701470- unsigned int s_d_flags; /* default d_flags for dentries */14711471-14721472- /*14731473- * The next field is for VFS *only*. No filesystems have any business14741474- * even looking at it. You had been warned.14751475- */14761476- struct mutex s_vfs_rename_mutex; /* Kludge */14771477-14781478- /*14791479- * Filesystem subtype. If non-empty the filesystem type field14801480- * in /proc/mounts will be "type.subtype"14811481- */14821482- const char *s_subtype;14831483-14841484- const struct dentry_operations *__s_d_op; /* default d_op for dentries */14851485-14861486- struct shrinker *s_shrink; /* per-sb shrinker handle */14871487-14881488- /* Number of inodes with nlink == 0 but still referenced */14891489- atomic_long_t s_remove_count;14901490-14911491- /* Read-only state of the superblock is being changed */14921492- int s_readonly_remount;14931493-14941494- /* per-sb errseq_t for reporting writeback errors via syncfs */14951495- errseq_t s_wb_err;14961496-14971497- /* AIO completions deferred from interrupt context */14981498- struct workqueue_struct *s_dio_done_wq;14991499- struct hlist_head s_pins;15001500-15011501- /*15021502- * Owning user namespace and default context in which to15031503- * interpret filesystem uids, gids, quotas, device nodes,15041504- * xattrs and security labels.15051505- */15061506- struct user_namespace *s_user_ns;15071507-15081508- /*15091509- * The list_lru structure is essentially just a pointer to a table15101510- * of per-node lru lists, each of which has its own spinlock.15111511- * There is no need to put them into separate cachelines.15121512- */15131513- struct list_lru s_dentry_lru;15141514- struct list_lru s_inode_lru;15151515- struct rcu_head rcu;15161516- struct work_struct destroy_work;15171517-15181518- struct mutex s_sync_lock; /* sync serialisation lock */15191519-15201520- /*15211521- * Indicates how deep in a filesystem stack this SB is15221522- */15231523- int s_stack_depth;15241524-15251525- /* s_inode_list_lock protects s_inodes */15261526- spinlock_t s_inode_list_lock ____cacheline_aligned_in_smp;15271527- struct list_head s_inodes; /* all inodes */15281528-15291529- spinlock_t s_inode_wblist_lock;15301530- struct list_head s_inodes_wb; /* writeback inodes */15311531-} __randomize_layout;1532140215331403static inline struct user_namespace *i_user_ns(const struct inode *inode)15341404{···21902430extern loff_t vfs_dedupe_file_range_one(struct file *src_file, loff_t src_pos,21912431 struct file *dst_file, loff_t dst_pos,21922432 loff_t len, unsigned int remap_flags);21932193-21942194-/**21952195- * enum freeze_holder - holder of the freeze21962196- * @FREEZE_HOLDER_KERNEL: kernel wants to freeze or thaw filesystem21972197- * @FREEZE_HOLDER_USERSPACE: userspace wants to freeze or thaw filesystem21982198- * @FREEZE_MAY_NEST: whether nesting freeze and thaw requests is allowed21992199- * @FREEZE_EXCL: a freeze that can only be undone by the owner22002200- *22012201- * Indicate who the owner of the freeze or thaw request is and whether22022202- * the freeze needs to be exclusive or can nest.22032203- * Without @FREEZE_MAY_NEST, multiple freeze and thaw requests from the22042204- * same holder aren't allowed. It is however allowed to hold a single22052205- * @FREEZE_HOLDER_USERSPACE and a single @FREEZE_HOLDER_KERNEL freeze at22062206- * the same time. This is relied upon by some filesystems during online22072207- * repair or similar.22082208- */22092209-enum freeze_holder {22102210- FREEZE_HOLDER_KERNEL = (1U << 0),22112211- FREEZE_HOLDER_USERSPACE = (1U << 1),22122212- FREEZE_MAY_NEST = (1U << 2),22132213- FREEZE_EXCL = (1U << 3),22142214-};22152215-22162216-struct super_operations {22172217- struct inode *(*alloc_inode)(struct super_block *sb);22182218- void (*destroy_inode)(struct inode *);22192219- void (*free_inode)(struct inode *);22202220-22212221- void (*dirty_inode) (struct inode *, int flags);22222222- int (*write_inode) (struct inode *, struct writeback_control *wbc);22232223- int (*drop_inode) (struct inode *);22242224- void (*evict_inode) (struct inode *);22252225- void (*put_super) (struct super_block *);22262226- int (*sync_fs)(struct super_block *sb, int wait);22272227- int (*freeze_super) (struct super_block *, enum freeze_holder who, const void *owner);22282228- int (*freeze_fs) (struct super_block *);22292229- int (*thaw_super) (struct super_block *, enum freeze_holder who, const void *owner);22302230- int (*unfreeze_fs) (struct super_block *);22312231- int (*statfs) (struct dentry *, struct kstatfs *);22322232- int (*remount_fs) (struct super_block *, int *, char *);22332233- void (*umount_begin) (struct super_block *);22342234-22352235- int (*show_options)(struct seq_file *, struct dentry *);22362236- int (*show_devname)(struct seq_file *, struct dentry *);22372237- int (*show_path)(struct seq_file *, struct dentry *);22382238- int (*show_stats)(struct seq_file *, struct dentry *);22392239-#ifdef CONFIG_QUOTA22402240- ssize_t (*quota_read)(struct super_block *, int, char *, size_t, loff_t);22412241- ssize_t (*quota_write)(struct super_block *, int, const char *, size_t, loff_t);22422242- struct dquot __rcu **(*get_dquots)(struct inode *);22432243-#endif22442244- long (*nr_cached_objects)(struct super_block *,22452245- struct shrink_control *);22462246- long (*free_cached_objects)(struct super_block *,22472247- struct shrink_control *);22482248- /*22492249- * If a filesystem can support graceful removal of a device and22502250- * continue read-write operations, implement this callback.22512251- *22522252- * Return 0 if the filesystem can continue read-write.22532253- * Non-zero return value or no such callback means the fs will be shutdown22542254- * as usual.22552255- */22562256- int (*remove_bdev)(struct super_block *sb, struct block_device *bdev);22572257- void (*shutdown)(struct super_block *sb);22582258-};2259243322602434/*22612435 * Inode flags - they have no relation to superblock flags now
+335
include/linux/fs/super_types.h
···11+/* SPDX-License-Identifier: GPL-2.0 */22+#ifndef _LINUX_FS_SUPER_TYPES_H33+#define _LINUX_FS_SUPER_TYPES_H44+55+#include <linux/fs_dirent.h>66+#include <linux/errseq.h>77+#include <linux/list_lru.h>88+#include <linux/list.h>99+#include <linux/list_bl.h>1010+#include <linux/llist.h>1111+#include <linux/uidgid.h>1212+#include <linux/uuid.h>1313+#include <linux/percpu-rwsem.h>1414+#include <linux/workqueue_types.h>1515+#include <linux/quota.h>1616+1717+struct backing_dev_info;1818+struct block_device;1919+struct dentry;2020+struct dentry_operations;2121+struct dquot_operations;2222+struct export_operations;2323+struct file;2424+struct file_system_type;2525+struct fscrypt_operations;2626+struct fsnotify_sb_info;2727+struct fsverity_operations;2828+struct kstatfs;2929+struct mount;3030+struct mtd_info;3131+struct quotactl_ops;3232+struct shrinker;3333+struct unicode_map;3434+struct user_namespace;3535+struct workqueue_struct;3636+struct writeback_control;3737+struct xattr_handler;3838+3939+extern struct super_block *blockdev_superblock;4040+4141+/* Possible states of 'frozen' field */4242+enum {4343+ SB_UNFROZEN = 0, /* FS is unfrozen */4444+ SB_FREEZE_WRITE = 1, /* Writes, dir ops, ioctls frozen */4545+ SB_FREEZE_PAGEFAULT = 2, /* Page faults stopped as well */4646+ SB_FREEZE_FS = 3, /* For internal FS use (e.g. to stop internal threads if needed) */4747+ SB_FREEZE_COMPLETE = 4, /* ->freeze_fs finished successfully */4848+};4949+5050+#define SB_FREEZE_LEVELS (SB_FREEZE_COMPLETE - 1)5151+5252+struct sb_writers {5353+ unsigned short frozen; /* Is sb frozen? */5454+ int freeze_kcount; /* How many kernel freeze requests? */5555+ int freeze_ucount; /* How many userspace freeze requests? */5656+ const void *freeze_owner; /* Owner of the freeze */5757+ struct percpu_rw_semaphore rw_sem[SB_FREEZE_LEVELS];5858+};5959+6060+/**6161+ * enum freeze_holder - holder of the freeze6262+ * @FREEZE_HOLDER_KERNEL: kernel wants to freeze or thaw filesystem6363+ * @FREEZE_HOLDER_USERSPACE: userspace wants to freeze or thaw filesystem6464+ * @FREEZE_MAY_NEST: whether nesting freeze and thaw requests is allowed6565+ * @FREEZE_EXCL: a freeze that can only be undone by the owner6666+ *6767+ * Indicate who the owner of the freeze or thaw request is and whether6868+ * the freeze needs to be exclusive or can nest.6969+ * Without @FREEZE_MAY_NEST, multiple freeze and thaw requests from the7070+ * same holder aren't allowed. It is however allowed to hold a single7171+ * @FREEZE_HOLDER_USERSPACE and a single @FREEZE_HOLDER_KERNEL freeze at7272+ * the same time. This is relied upon by some filesystems during online7373+ * repair or similar.7474+ */7575+enum freeze_holder {7676+ FREEZE_HOLDER_KERNEL = (1U << 0),7777+ FREEZE_HOLDER_USERSPACE = (1U << 1),7878+ FREEZE_MAY_NEST = (1U << 2),7979+ FREEZE_EXCL = (1U << 3),8080+};8181+8282+struct super_operations {8383+ struct inode *(*alloc_inode)(struct super_block *sb);8484+ void (*destroy_inode)(struct inode *inode);8585+ void (*free_inode)(struct inode *inode);8686+ void (*dirty_inode)(struct inode *inode, int flags);8787+ int (*write_inode)(struct inode *inode, struct writeback_control *wbc);8888+ int (*drop_inode)(struct inode *inode);8989+ void (*evict_inode)(struct inode *inode);9090+ void (*put_super)(struct super_block *sb);9191+ int (*sync_fs)(struct super_block *sb, int wait);9292+ int (*freeze_super)(struct super_block *sb, enum freeze_holder who,9393+ const void *owner);9494+ int (*freeze_fs)(struct super_block *sb);9595+ int (*thaw_super)(struct super_block *sb, enum freeze_holder who,9696+ const void *owner);9797+ int (*unfreeze_fs)(struct super_block *sb);9898+ int (*statfs)(struct dentry *dentry, struct kstatfs *kstatfs);9999+ int (*remount_fs) (struct super_block *, int *, char *);100100+ void (*umount_begin)(struct super_block *sb);101101+102102+ int (*show_options)(struct seq_file *seq, struct dentry *dentry);103103+ int (*show_devname)(struct seq_file *seq, struct dentry *dentry);104104+ int (*show_path)(struct seq_file *seq, struct dentry *dentry);105105+ int (*show_stats)(struct seq_file *seq, struct dentry *dentry);106106+#ifdef CONFIG_QUOTA107107+ ssize_t (*quota_read)(struct super_block *sb, int type, char *data,108108+ size_t len, loff_t off);109109+ ssize_t (*quota_write)(struct super_block *sb, int type,110110+ const char *data, size_t len, loff_t off);111111+ struct dquot __rcu **(*get_dquots)(struct inode *inode);112112+#endif113113+ long (*nr_cached_objects)(struct super_block *sb,114114+ struct shrink_control *sc);115115+ long (*free_cached_objects)(struct super_block *sb,116116+ struct shrink_control *sc);117117+ /*118118+ * If a filesystem can support graceful removal of a device and119119+ * continue read-write operations, implement this callback.120120+ *121121+ * Return 0 if the filesystem can continue read-write.122122+ * Non-zero return value or no such callback means the fs will be shutdown123123+ * as usual.124124+ */125125+ int (*remove_bdev)(struct super_block *sb, struct block_device *bdev);126126+ void (*shutdown)(struct super_block *sb);127127+};128128+129129+struct super_block {130130+ struct list_head s_list; /* Keep this first */131131+ dev_t s_dev; /* search index; _not_ kdev_t */132132+ unsigned char s_blocksize_bits;133133+ unsigned long s_blocksize;134134+ loff_t s_maxbytes; /* Max file size */135135+ struct file_system_type *s_type;136136+ const struct super_operations *s_op;137137+ const struct dquot_operations *dq_op;138138+ const struct quotactl_ops *s_qcop;139139+ const struct export_operations *s_export_op;140140+ unsigned long s_flags;141141+ unsigned long s_iflags; /* internal SB_I_* flags */142142+ unsigned long s_magic;143143+ struct dentry *s_root;144144+ struct rw_semaphore s_umount;145145+ int s_count;146146+ atomic_t s_active;147147+#ifdef CONFIG_SECURITY148148+ void *s_security;149149+#endif150150+ const struct xattr_handler *const *s_xattr;151151+#ifdef CONFIG_FS_ENCRYPTION152152+ const struct fscrypt_operations *s_cop;153153+ struct fscrypt_keyring *s_master_keys; /* master crypto keys in use */154154+#endif155155+#ifdef CONFIG_FS_VERITY156156+ const struct fsverity_operations *s_vop;157157+#endif158158+#if IS_ENABLED(CONFIG_UNICODE)159159+ struct unicode_map *s_encoding;160160+ __u16 s_encoding_flags;161161+#endif162162+ struct hlist_bl_head s_roots; /* alternate root dentries for NFS */163163+ struct mount *s_mounts; /* list of mounts; _not_ for fs use */164164+ struct block_device *s_bdev; /* can go away once we use an accessor for @s_bdev_file */165165+ struct file *s_bdev_file;166166+ struct backing_dev_info *s_bdi;167167+ struct mtd_info *s_mtd;168168+ struct hlist_node s_instances;169169+ unsigned int s_quota_types; /* Bitmask of supported quota types */170170+ struct quota_info s_dquot; /* Diskquota specific options */171171+172172+ struct sb_writers s_writers;173173+174174+ /*175175+ * Keep s_fs_info, s_time_gran, s_fsnotify_mask, and176176+ * s_fsnotify_info together for cache efficiency. They are frequently177177+ * accessed and rarely modified.178178+ */179179+ void *s_fs_info; /* Filesystem private info */180180+181181+ /* Granularity of c/m/atime in ns (cannot be worse than a second) */182182+ u32 s_time_gran;183183+ /* Time limits for c/m/atime in seconds */184184+ time64_t s_time_min;185185+ time64_t s_time_max;186186+#ifdef CONFIG_FSNOTIFY187187+ u32 s_fsnotify_mask;188188+ struct fsnotify_sb_info *s_fsnotify_info;189189+#endif190190+191191+ /*192192+ * q: why are s_id and s_sysfs_name not the same? both are human193193+ * readable strings that identify the filesystem194194+ * a: s_id is allowed to change at runtime; it's used in log messages,195195+ * and we want to when a device starts out as single device (s_id is dev196196+ * name) but then a device is hot added and we have to switch to197197+ * identifying it by UUID198198+ * but s_sysfs_name is a handle for programmatic access, and can't199199+ * change at runtime200200+ */201201+ char s_id[32]; /* Informational name */202202+ uuid_t s_uuid; /* UUID */203203+ u8 s_uuid_len; /* Default 16, possibly smaller for weird filesystems */204204+205205+ /* if set, fs shows up under sysfs at /sys/fs/$FSTYP/s_sysfs_name */206206+ char s_sysfs_name[UUID_STRING_LEN + 1];207207+208208+ unsigned int s_max_links;209209+ unsigned int s_d_flags; /* default d_flags for dentries */210210+211211+ /*212212+ * The next field is for VFS *only*. No filesystems have any business213213+ * even looking at it. You had been warned.214214+ */215215+ struct mutex s_vfs_rename_mutex; /* Kludge */216216+217217+ /*218218+ * Filesystem subtype. If non-empty the filesystem type field219219+ * in /proc/mounts will be "type.subtype"220220+ */221221+ const char *s_subtype;222222+223223+ const struct dentry_operations *__s_d_op; /* default d_op for dentries */224224+225225+ struct shrinker *s_shrink; /* per-sb shrinker handle */226226+227227+ /* Number of inodes with nlink == 0 but still referenced */228228+ atomic_long_t s_remove_count;229229+230230+ /* Read-only state of the superblock is being changed */231231+ int s_readonly_remount;232232+233233+ /* per-sb errseq_t for reporting writeback errors via syncfs */234234+ errseq_t s_wb_err;235235+236236+ /* AIO completions deferred from interrupt context */237237+ struct workqueue_struct *s_dio_done_wq;238238+ struct hlist_head s_pins;239239+240240+ /*241241+ * Owning user namespace and default context in which to242242+ * interpret filesystem uids, gids, quotas, device nodes,243243+ * xattrs and security labels.244244+ */245245+ struct user_namespace *s_user_ns;246246+247247+ /*248248+ * The list_lru structure is essentially just a pointer to a table249249+ * of per-node lru lists, each of which has its own spinlock.250250+ * There is no need to put them into separate cachelines.251251+ */252252+ struct list_lru s_dentry_lru;253253+ struct list_lru s_inode_lru;254254+ struct rcu_head rcu;255255+ struct work_struct destroy_work;256256+257257+ struct mutex s_sync_lock; /* sync serialisation lock */258258+259259+ /*260260+ * Indicates how deep in a filesystem stack this SB is261261+ */262262+ int s_stack_depth;263263+264264+ /* s_inode_list_lock protects s_inodes */265265+ spinlock_t s_inode_list_lock ____cacheline_aligned_in_smp;266266+ struct list_head s_inodes; /* all inodes */267267+268268+ spinlock_t s_inode_wblist_lock;269269+ struct list_head s_inodes_wb; /* writeback inodes */270270+} __randomize_layout;271271+272272+/*273273+ * sb->s_flags. Note that these mirror the equivalent MS_* flags where274274+ * represented in both.275275+ */276276+#define SB_RDONLY BIT(0) /* Mount read-only */277277+#define SB_NOSUID BIT(1) /* Ignore suid and sgid bits */278278+#define SB_NODEV BIT(2) /* Disallow access to device special files */279279+#define SB_NOEXEC BIT(3) /* Disallow program execution */280280+#define SB_SYNCHRONOUS BIT(4) /* Writes are synced at once */281281+#define SB_MANDLOCK BIT(6) /* Allow mandatory locks on an FS */282282+#define SB_DIRSYNC BIT(7) /* Directory modifications are synchronous */283283+#define SB_NOATIME BIT(10) /* Do not update access times. */284284+#define SB_NODIRATIME BIT(11) /* Do not update directory access times */285285+#define SB_SILENT BIT(15)286286+#define SB_POSIXACL BIT(16) /* Supports POSIX ACLs */287287+#define SB_INLINECRYPT BIT(17) /* Use blk-crypto for encrypted files */288288+#define SB_KERNMOUNT BIT(22) /* this is a kern_mount call */289289+#define SB_I_VERSION BIT(23) /* Update inode I_version field */290290+#define SB_LAZYTIME BIT(25) /* Update the on-disk [acm]times lazily */291291+292292+/* These sb flags are internal to the kernel */293293+#define SB_DEAD BIT(21)294294+#define SB_DYING BIT(24)295295+#define SB_FORCE BIT(27)296296+#define SB_NOSEC BIT(28)297297+#define SB_BORN BIT(29)298298+#define SB_ACTIVE BIT(30)299299+#define SB_NOUSER BIT(31)300300+301301+/* These flags relate to encoding and casefolding */302302+#define SB_ENC_STRICT_MODE_FL (1 << 0)303303+#define SB_ENC_NO_COMPAT_FALLBACK_FL (1 << 1)304304+305305+#define sb_has_strict_encoding(sb) \306306+ (sb->s_encoding_flags & SB_ENC_STRICT_MODE_FL)307307+308308+#if IS_ENABLED(CONFIG_UNICODE)309309+#define sb_no_casefold_compat_fallback(sb) \310310+ (sb->s_encoding_flags & SB_ENC_NO_COMPAT_FALLBACK_FL)311311+#else312312+#define sb_no_casefold_compat_fallback(sb) (1)313313+#endif314314+315315+/* sb->s_iflags */316316+#define SB_I_CGROUPWB 0x00000001 /* cgroup-aware writeback enabled */317317+#define SB_I_NOEXEC 0x00000002 /* Ignore executables on this fs */318318+#define SB_I_NODEV 0x00000004 /* Ignore devices on this fs */319319+#define SB_I_STABLE_WRITES 0x00000008 /* don't modify blks until WB is done */320320+321321+/* sb->s_iflags to limit user namespace mounts */322322+#define SB_I_USERNS_VISIBLE 0x00000010 /* fstype already mounted */323323+#define SB_I_IMA_UNVERIFIABLE_SIGNATURE 0x00000020324324+#define SB_I_UNTRUSTED_MOUNTER 0x00000040325325+#define SB_I_EVM_HMAC_UNSUPPORTED 0x00000080326326+327327+#define SB_I_SKIP_SYNC 0x00000100 /* Skip superblock at global sync */328328+#define SB_I_PERSB_BDI 0x00000200 /* has a per-sb bdi */329329+#define SB_I_TS_EXPIRY_WARNED 0x00000400 /* warned about timestamp range expiry */330330+#define SB_I_RETIRED 0x00000800 /* superblock shouldn't be reused */331331+#define SB_I_NOUMASK 0x00001000 /* VFS does not apply umask */332332+#define SB_I_NOIDMAP 0x00002000 /* No idmapped mounts on this superblock */333333+#define SB_I_ALLOW_HSM 0x00004000 /* Allow HSM events on this superblock */334334+335335+#endif /* _LINUX_FS_SUPER_TYPES_H */