Merge tag 'idmapped-mounts-v5.12' of git://git.kernel.org/pub/scm/linux/kernel/git...
[platform/kernel/linux-rpi.git] / include / linux / fs.h
index 7762d3d..418b772 100644 (file)
@@ -2162,8 +2162,8 @@ static inline void kiocb_clone(struct kiocb *kiocb, struct kiocb *kiocb_src,
 /*
  * Inode state bits.  Protected by inode->i_lock
  *
- * Three bits determine the dirty state of the inode, I_DIRTY_SYNC,
- * I_DIRTY_DATASYNC and I_DIRTY_PAGES.
+ * Four bits determine the dirty state of the inode: I_DIRTY_SYNC,
+ * I_DIRTY_DATASYNC, I_DIRTY_PAGES, and I_DIRTY_TIME.
  *
  * Four bits define the lifetime of an inode.  Initially, inodes are I_NEW,
  * until that flag is cleared.  I_WILL_FREE, I_FREEING and I_CLEAR are set at
@@ -2172,12 +2172,20 @@ static inline void kiocb_clone(struct kiocb *kiocb, struct kiocb *kiocb_src,
  * Two bits are used for locking and completion notification, I_NEW and I_SYNC.
  *
  * I_DIRTY_SYNC                Inode is dirty, but doesn't have to be written on
- *                     fdatasync().  i_atime is the usual cause.
- * I_DIRTY_DATASYNC    Data-related inode changes pending. We keep track of
+ *                     fdatasync() (unless I_DIRTY_DATASYNC is also set).
+ *                     Timestamp updates are the usual cause.
+ * I_DIRTY_DATASYNC    Data-related inode changes pending.  We keep track of
  *                     these changes separately from I_DIRTY_SYNC so that we
  *                     don't have to write inode on fdatasync() when only
- *                     mtime has changed in it.
+ *                     e.g. the timestamps have changed.
  * I_DIRTY_PAGES       Inode has dirty pages.  Inode itself may be clean.
+ * I_DIRTY_TIME                The inode itself only has dirty timestamps, and the
+ *                     lazytime mount option is enabled.  We keep track of this
+ *                     separately from I_DIRTY_SYNC in order to implement
+ *                     lazytime.  This gets cleared if I_DIRTY_INODE
+ *                     (I_DIRTY_SYNC and/or I_DIRTY_DATASYNC) gets set.  I.e.
+ *                     either I_DIRTY_TIME *or* I_DIRTY_INODE can be set in
+ *                     i_state, but not both.  I_DIRTY_PAGES may still be set.
  * I_NEW               Serves as both a mutex and completion notification.
  *                     New inodes set I_NEW.  If two processes both create
  *                     the same inode, one of them will release its inode and
@@ -2264,6 +2272,21 @@ static inline void mark_inode_dirty_sync(struct inode *inode)
        __mark_inode_dirty(inode, I_DIRTY_SYNC);
 }
 
+/*
+ * Returns true if the given inode itself only has dirty timestamps (its pages
+ * may still be dirty) and isn't currently being allocated or freed.
+ * Filesystems should call this if when writing an inode when lazytime is
+ * enabled, they want to opportunistically write the timestamps of other inodes
+ * located very nearby on-disk, e.g. in the same inode block.  This returns true
+ * if the given inode is in need of such an opportunistic update.  Requires
+ * i_lock, or at least later re-checking under i_lock.
+ */
+static inline bool inode_is_dirtytime_only(struct inode *inode)
+{
+       return (inode->i_state & (I_DIRTY_TIME | I_NEW |
+                                 I_FREEING | I_WILL_FREE)) == I_DIRTY_TIME;
+}
+
 extern void inc_nlink(struct inode *inode);
 extern void drop_nlink(struct inode *inode);
 extern void clear_nlink(struct inode *inode);
@@ -3290,11 +3313,6 @@ extern int generic_file_fsync(struct file *, loff_t, loff_t, int);
 
 extern int generic_check_addressable(unsigned, u64);
 
-#ifdef CONFIG_UNICODE
-extern int generic_ci_d_hash(const struct dentry *dentry, struct qstr *str);
-extern int generic_ci_d_compare(const struct dentry *dentry, unsigned int len,
-                               const char *str, const struct qstr *name);
-#endif
 extern void generic_set_encrypted_ci_d_ops(struct dentry *dentry);
 
 #ifdef CONFIG_MIGRATION