Skip to content

Commit 7b12e49

Browse files
Christoph Hellwigaxboe
authored andcommitted
fs: remove fs.f_write_hint
The value is now completely unused except for reporting it back through the F_GET_FILE_RW_HINT ioctl, so remove the value and the two ioctls for it. Trying to use the F_SET_FILE_RW_HINT and F_GET_FILE_RW_HINT fcntls will now return EINVAL, just like it would on a kernel that never supported this functionality in the first place. Signed-off-by: Christoph Hellwig <[email protected]> Reviewed-by: Dave Chinner <[email protected]> Reviewed-by: Chaitanya Kulkarni <[email protected]> Link: https://lore.kernel.org/r/[email protected] Signed-off-by: Jens Axboe <[email protected]>
1 parent 41d36a9 commit 7b12e49

File tree

3 files changed

+0
-28
lines changed

3 files changed

+0
-28
lines changed

fs/fcntl.c

Lines changed: 0 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -291,22 +291,6 @@ static long fcntl_rw_hint(struct file *file, unsigned int cmd,
291291
u64 h;
292292

293293
switch (cmd) {
294-
case F_GET_FILE_RW_HINT:
295-
h = file_write_hint(file);
296-
if (copy_to_user(argp, &h, sizeof(*argp)))
297-
return -EFAULT;
298-
return 0;
299-
case F_SET_FILE_RW_HINT:
300-
if (copy_from_user(&h, argp, sizeof(h)))
301-
return -EFAULT;
302-
hint = (enum rw_hint) h;
303-
if (!rw_hint_valid(hint))
304-
return -EINVAL;
305-
306-
spin_lock(&file->f_lock);
307-
file->f_write_hint = hint;
308-
spin_unlock(&file->f_lock);
309-
return 0;
310294
case F_GET_RW_HINT:
311295
h = inode->i_write_hint;
312296
if (copy_to_user(argp, &h, sizeof(*argp)))
@@ -431,8 +415,6 @@ static long do_fcntl(int fd, unsigned int cmd, unsigned long arg,
431415
break;
432416
case F_GET_RW_HINT:
433417
case F_SET_RW_HINT:
434-
case F_GET_FILE_RW_HINT:
435-
case F_SET_FILE_RW_HINT:
436418
err = fcntl_rw_hint(filp, cmd, arg);
437419
break;
438420
default:

fs/open.c

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -835,7 +835,6 @@ static int do_dentry_open(struct file *f,
835835
likely(f->f_op->write || f->f_op->write_iter))
836836
f->f_mode |= FMODE_CAN_WRITE;
837837

838-
f->f_write_hint = WRITE_LIFE_NOT_SET;
839838
f->f_flags &= ~(O_CREAT | O_EXCL | O_NOCTTY | O_TRUNC);
840839

841840
file_ra_state_init(&f->f_ra, f->f_mapping->host->i_mapping);

include/linux/fs.h

Lines changed: 0 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -966,7 +966,6 @@ struct file {
966966
* Must not be taken from IRQ context.
967967
*/
968968
spinlock_t f_lock;
969-
enum rw_hint f_write_hint;
970969
atomic_long_t f_count;
971970
unsigned int f_flags;
972971
fmode_t f_mode;
@@ -2214,14 +2213,6 @@ static inline bool HAS_UNMAPPED_ID(struct user_namespace *mnt_userns,
22142213
!gid_valid(i_gid_into_mnt(mnt_userns, inode));
22152214
}
22162215

2217-
static inline enum rw_hint file_write_hint(struct file *file)
2218-
{
2219-
if (file->f_write_hint != WRITE_LIFE_NOT_SET)
2220-
return file->f_write_hint;
2221-
2222-
return file_inode(file)->i_write_hint;
2223-
}
2224-
22252216
static inline int iocb_flags(struct file *file);
22262217

22272218
static inline void init_sync_kiocb(struct kiocb *kiocb, struct file *filp)

0 commit comments

Comments
 (0)