Merge tag 'v6.5/vfs.file' of git://git.kernel.org/pub/scm/linux/kernel/git/vfs/vfs
[platform/kernel/linux-starfive.git] / include / linux / fs.h
index 24e1be1..4ca804f 100644 (file)
@@ -959,29 +959,35 @@ static inline int ra_has_index(struct file_ra_state *ra, pgoff_t index)
                index <  ra->start + ra->size);
 }
 
+/*
+ * f_{lock,count,pos_lock} members can be highly contended and share
+ * the same cacheline. f_{lock,mode} are very frequently used together
+ * and so share the same cacheline as well. The read-mostly
+ * f_{path,inode,op} are kept on a separate cacheline.
+ */
 struct file {
        union {
                struct llist_node       f_llist;
                struct rcu_head         f_rcuhead;
                unsigned int            f_iocb_flags;
        };
-       struct path             f_path;
-       struct inode            *f_inode;       /* cached value */
-       const struct file_operations    *f_op;
 
        /*
         * Protects f_ep, f_flags.
         * Must not be taken from IRQ context.
         */
        spinlock_t              f_lock;
-       atomic_long_t           f_count;
-       unsigned int            f_flags;
        fmode_t                 f_mode;
+       atomic_long_t           f_count;
        struct mutex            f_pos_lock;
        loff_t                  f_pos;
+       unsigned int            f_flags;
        struct fown_struct      f_owner;
        const struct cred       *f_cred;
        struct file_ra_state    f_ra;
+       struct path             f_path;
+       struct inode            *f_inode;       /* cached value */
+       const struct file_operations    *f_op;
 
        u64                     f_version;
 #ifdef CONFIG_SECURITY
@@ -1079,29 +1085,29 @@ extern int send_sigurg(struct fown_struct *fown);
  * sb->s_flags.  Note that these mirror the equivalent MS_* flags where
  * represented in both.
  */
-#define SB_RDONLY       1      /* Mount read-only */
-#define SB_NOSUID       2      /* Ignore suid and sgid bits */
-#define SB_NODEV        4      /* Disallow access to device special files */
-#define SB_NOEXEC       8      /* Disallow program execution */
-#define SB_SYNCHRONOUS 16      /* Writes are synced at once */
-#define SB_MANDLOCK    64      /* Allow mandatory locks on an FS */
-#define SB_DIRSYNC     128     /* Directory modifications are synchronous */
-#define SB_NOATIME     1024    /* Do not update access times. */
-#define SB_NODIRATIME  2048    /* Do not update directory access times */
-#define SB_SILENT      32768
-#define SB_POSIXACL    (1<<16) /* VFS does not apply the umask */
-#define SB_INLINECRYPT (1<<17) /* Use blk-crypto for encrypted files */
-#define SB_KERNMOUNT   (1<<22) /* this is a kern_mount call */
-#define SB_I_VERSION   (1<<23) /* Update inode I_version field */
-#define SB_LAZYTIME    (1<<25) /* Update the on-disk [acm]times lazily */
+#define SB_RDONLY       BIT(0) /* Mount read-only */
+#define SB_NOSUID       BIT(1) /* Ignore suid and sgid bits */
+#define SB_NODEV        BIT(2) /* Disallow access to device special files */
+#define SB_NOEXEC       BIT(3) /* Disallow program execution */
+#define SB_SYNCHRONOUS  BIT(4) /* Writes are synced at once */
+#define SB_MANDLOCK     BIT(6) /* Allow mandatory locks on an FS */
+#define SB_DIRSYNC      BIT(7) /* Directory modifications are synchronous */
+#define SB_NOATIME      BIT(10)        /* Do not update access times. */
+#define SB_NODIRATIME   BIT(11)        /* Do not update directory access times */
+#define SB_SILENT       BIT(15)
+#define SB_POSIXACL     BIT(16)        /* VFS does not apply the umask */
+#define SB_INLINECRYPT  BIT(17)        /* Use blk-crypto for encrypted files */
+#define SB_KERNMOUNT    BIT(22)        /* this is a kern_mount call */
+#define SB_I_VERSION    BIT(23)        /* Update inode I_version field */
+#define SB_LAZYTIME     BIT(25)        /* Update the on-disk [acm]times lazily */
 
 /* These sb flags are internal to the kernel */
-#define SB_SUBMOUNT     (1<<26)
-#define SB_FORCE       (1<<27)
-#define SB_NOSEC       (1<<28)
-#define SB_BORN                (1<<29)
-#define SB_ACTIVE      (1<<30)
-#define SB_NOUSER      (1<<31)
+#define SB_SUBMOUNT     BIT(26)
+#define SB_FORCE        BIT(27)
+#define SB_NOSEC        BIT(28)
+#define SB_BORN         BIT(29)
+#define SB_ACTIVE       BIT(30)
+#define SB_NOUSER       BIT(31)
 
 /* These flags relate to encoding and casefolding */
 #define SB_ENC_STRICT_MODE_FL  (1 << 0)
@@ -1245,7 +1251,7 @@ struct super_block {
         */
        atomic_long_t s_fsnotify_connectors;
 
-       /* Being remounted read-only */
+       /* Read-only state of the superblock is being changed */
        int s_readonly_remount;
 
        /* per-sb errseq_t for reporting writeback errors via syncfs */
@@ -2695,7 +2701,7 @@ extern void evict_inodes(struct super_block *sb);
 void dump_mapping(const struct address_space *);
 
 /*
- * Userspace may rely on the the inode number being non-zero. For example, glibc
+ * Userspace may rely on the inode number being non-zero. For example, glibc
  * simply ignores files with zero i_ino in unlink() and other places.
  *
  * As an additional complication, if userspace was compiled with