]> www.infradead.org Git - users/hch/block.git/commitdiff
fs: remove fs.f_write_hint more-hint-removal
authorChristoph Hellwig <hch@lst.de>
Sun, 6 Mar 2022 08:06:17 +0000 (09:06 +0100)
committerChristoph Hellwig <hch@lst.de>
Sun, 6 Mar 2022 08:12:37 +0000 (09:12 +0100)
The value is no completely unused export for reporting it back through
the F_GET_FILE_RW_HINT ioctl, so remove it.

Signed-off-by: Christoph Hellwig <hch@lst.de>
fs/fcntl.c
fs/open.c
include/linux/fs.h

index 9c6c6a3e2de516de285fc8d3279e4297f35aafb2..726c4254d3c02c3ccb0d9eda7c2572d0bd8b9eac 100644 (file)
@@ -292,7 +292,7 @@ static long fcntl_rw_hint(struct file *file, unsigned int cmd,
 
        switch (cmd) {
        case F_GET_FILE_RW_HINT:
-               h = file_write_hint(file);
+               h = file_inode(file)->i_write_hint;
                if (copy_to_user(argp, &h, sizeof(*argp)))
                        return -EFAULT;
                return 0;
@@ -302,10 +302,7 @@ static long fcntl_rw_hint(struct file *file, unsigned int cmd,
                hint = (enum rw_hint) h;
                if (!rw_hint_valid(hint))
                        return -EINVAL;
-
-               spin_lock(&file->f_lock);
-               file->f_write_hint = hint;
-               spin_unlock(&file->f_lock);
+               /* ignore the value set for backwards compatibility */
                return 0;
        case F_GET_RW_HINT:
                h = inode->i_write_hint;
index 9ff2f621b760ba2ac69d7f7b14cab2952aff3848..1315253e024739de4b1c592dabfcd04224a427c9 100644 (file)
--- a/fs/open.c
+++ b/fs/open.c
@@ -835,7 +835,6 @@ static int do_dentry_open(struct file *f,
             likely(f->f_op->write || f->f_op->write_iter))
                f->f_mode |= FMODE_CAN_WRITE;
 
-       f->f_write_hint = WRITE_LIFE_NOT_SET;
        f->f_flags &= ~(O_CREAT | O_EXCL | O_NOCTTY | O_TRUNC);
 
        file_ra_state_init(&f->f_ra, f->f_mapping->host->i_mapping);
index d5658ac5d8c65193c6f213117ad043c3c73b5999..a1fc3b41cd82f30f6e72b6e6f6b85a041cddb663 100644 (file)
@@ -966,7 +966,6 @@ struct file {
         * Must not be taken from IRQ context.
         */
        spinlock_t              f_lock;
-       enum rw_hint            f_write_hint;
        atomic_long_t           f_count;
        unsigned int            f_flags;
        fmode_t                 f_mode;
@@ -2214,14 +2213,6 @@ static inline bool HAS_UNMAPPED_ID(struct user_namespace *mnt_userns,
               !gid_valid(i_gid_into_mnt(mnt_userns, inode));
 }
 
-static inline enum rw_hint file_write_hint(struct file *file)
-{
-       if (file->f_write_hint != WRITE_LIFE_NOT_SET)
-               return file->f_write_hint;
-
-       return file_inode(file)->i_write_hint;
-}
-
 static inline int iocb_flags(struct file *file);
 
 static inline void init_sync_kiocb(struct kiocb *kiocb, struct file *filp)