remove write hint leftovers
Subsystems (7)
Hi Jens,
this removes the other two fields and the two now unused fcntls as pointed out by Dave.
PATCH 1/2 fs: remove kiocb.ki_hint
This field is entirely unused now except for a tracepoint in f2fs, so remove it.
--- fs/aio.c | 1 - fs/cachefiles/io.c | 2 -- fs/f2fs/file.c | 6 ------ fs/io_uring.c | 1 - include/linux/fs.h | 12 ------------ include/trace/events/f2fs.h | 3 +-- 6 files changed, 1 insertion(+), 24 deletions(-)
fs/aio.c +0 -1
@@ -1478,7 +1478,6 @@ static int aio_prep_rw(struct kiocb *req, const struct iocb *iocb) req->ki_flags =iocb_flags (req->ki_filp);if (iocb->aio_flags &IOCB_FLAG_RESFD ) req->ki_flags |=IOCB_EVENTFD ; - req->ki_hint =ki_hint_validate (file_write_hint (req->ki_filp));if (iocb->aio_flags &IOCB_FLAG_IOPRIO ) {/* * If the IOCB_FLAG_IOPRIO flag of aio_flags is set, then
fs/cachefiles/io.c +0 -2
@@ -138,7 +138,6 @@ static int cachefiles_read(struct netfs_cache_resources *cres, ki->iocb.ki_filp = file; ki->iocb.ki_pos = start_pos + skipped; ki->iocb.ki_flags =IOCB_DIRECT ; - ki->iocb.ki_hint =ki_hint_validate (file_write_hint (file)); ki->iocb.ki_ioprio =get_current_ioprio (); ki->skipped = skipped; ki->object = object;
@@ -313,7 +312,6 @@ static int cachefiles_write(struct netfs_cache_resources *cres, ki->iocb.ki_filp = file; ki->iocb.ki_pos = start_pos; ki->iocb.ki_flags =IOCB_DIRECT |IOCB_WRITE ; - ki->iocb.ki_hint =ki_hint_validate (file_write_hint (file)); ki->iocb.ki_ioprio =get_current_ioprio (); ki->object = object; ki->inval_counter = cres->inval_counter;
fs/f2fs/file.c +0 -6
@@ -4479,10 +4479,8 @@ static ssize_t f2fs_dio_write_iter(struct kiocb *iocb, struct iov_iter *from,struct f2fs_inode_info *fi =F2FS_I (inode);struct f2fs_sb_info *sbi =F2FS_I_SB (inode);const bool do_opu =f2fs_lfs_mode (sbi); -const int whint_mode =F2FS_OPTION (sbi).whint_mode;const loff_t pos = iocb->ki_pos;const ssize_t count =iov_iter_count (from); -const enum rw_hint hint = iocb->ki_hint;unsigned int dio_flags;struct iomap_dio *dio;ssize_t ret;
@@ -4515,8 +4513,6 @@ static ssize_t f2fs_dio_write_iter(struct kiocb *iocb, struct iov_iter *from,if (do_opu)down_read (&fi->i_gc_rwsem[READ ]); } -if (whint_mode ==WHINT_MODE_OFF ) - iocb->ki_hint =WRITE_LIFE_NOT_SET ;/* * We have to use __iomap_dio_rw() and iomap_dio_complete() instead of
@@ -4539,8 +4535,6 @@ static ssize_t f2fs_dio_write_iter(struct kiocb *iocb, struct iov_iter *from, ret =iomap_dio_complete (dio); } -if (whint_mode ==WHINT_MODE_OFF ) - iocb->ki_hint = hint;if (do_opu)up_read (&fi->i_gc_rwsem[READ ]);up_read (&fi->i_gc_rwsem[WRITE ]);
fs/io_uring.c +0 -1
@@ -3790,7 +3790,6 @@ static int io_write_prep(struct io_kiocb *req, const struct io_uring_sqe *sqe) {if (unlikely (!(req->file->f_mode &FMODE_WRITE )))return -EBADF ; - req->rw.kiocb.ki_hint =ki_hint_validate (file_write_hint (req->file));return io_prep_rw (req, sqe); }
include/linux/fs.h +0 -12
@@ -327,7 +327,6 @@ struct kiocb {void (*ki_complete)(struct kiocb *iocb,long ret);void *private;int ki_flags; -u16 ki_hint;u16 ki_ioprio;/* See linux/ioprio.h */ struct wait_page_queue *ki_waitq;/* for async buffered IO */ randomized_struct_fields_end
@@ -2225,21 +2224,11 @@ static inline enum rw_hint file_write_hint(struct file *file)static inline int iocb_flags (struct file *file); -static inline u16 ki_hint_validate (enum rw_hint hint) -{ - typeof(((struct kiocb *)0)->ki_hint) max_hint = -1; - -if (hint <= max_hint) -return hint; -return 0 ; -} -static inline void init_sync_kiocb (struct kiocb *kiocb,struct file *filp) { *kiocb = (struct kiocb ) { .ki_filp = filp, .ki_flags =iocb_flags (filp), - .ki_hint =ki_hint_validate (file_write_hint (filp)), .ki_ioprio =get_current_ioprio (), }; }
@@ -2250,7 +2239,6 @@ static inline void kiocb_clone(struct kiocb *kiocb, struct kiocb *kiocb_src, *kiocb = (struct kiocb ) { .ki_filp = filp, .ki_flags = kiocb_src->ki_flags, - .ki_hint = kiocb_src->ki_hint, .ki_ioprio = kiocb_src->ki_ioprio, .ki_pos = kiocb_src->ki_pos, };
include/trace/events/f2fs.h +1 -2
@@ -956,12 +956,11 @@ TRACE_EVENT(f2fs_direct_IO_enter, __entry->rw = rw; ), -TP_printk ("dev = (%d,%d), ino = %lu pos = %lld len = %lu ki_flags = %x ki_hint = %x ki_ioprio = %x rw = %d" , +TP_printk ("dev = (%d,%d), ino = %lu pos = %lld len = %lu ki_flags = %x ki_ioprio = %x rw = %d" ,show_dev_ino (__entry), __entry->iocb->ki_pos, __entry->len, __entry->iocb->ki_flags, - __entry->iocb->ki_hint, __entry->iocb->ki_ioprio, __entry->rw) );
Signature · 1 line
2.30.2
PATCH 2/2 fs: remove fs.f_write_hint
In reply to Christoph HellwigThe 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.
--- fs/fcntl.c | 18 ------------------ fs/open.c | 1 - include/linux/fs.h | 9 --------- 3 files changed, 28 deletions(-)
fs/fcntl.c +0 -18
@@ -291,22 +291,6 @@ static long fcntl_rw_hint(struct file *file, unsigned int cmd,u64 h;switch (cmd) { -case F_GET_FILE_RW_HINT : - h =file_write_hint (file); -if (copy_to_user (argp, &h,sizeof (*argp))) -return -EFAULT ; -return 0 ; -case F_SET_FILE_RW_HINT : -if (copy_from_user (&h, argp,sizeof (h))) -return -EFAULT ; - 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); -return 0 ;case F_GET_RW_HINT : h = inode->i_write_hint;if (copy_to_user (argp, &h,sizeof (*argp)))
@@ -431,8 +415,6 @@ static long do_fcntl(int fd, unsigned int cmd, unsigned long arg,break ;case F_GET_RW_HINT :case F_SET_RW_HINT : -case F_GET_FILE_RW_HINT : -case F_SET_FILE_RW_HINT : err =fcntl_rw_hint (filp, cmd, arg);break ;default :
fs/open.c +0 -1
@@ -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);
include/linux/fs.h +0 -9
@@ -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)
Signature · 1 line
2.30.2
Jens Axboe
maintainerRe: [PATCH 2/2] fs: remove fs.f_write_hint
Quoted 3 lines · Christoph Hellwig
The value is now completely unused except for reporting it back through the
F_GET_FILE_RW_HINTioctl, so remove the value and the two ioctls for it.
This commit message could do with some verbiage on why the EINVAL solution was chosen for the F_{GET,SET}_RW_HINT ioctls.
Signature · 1 line
Jens Axboe
Al Viro
maintainerRe: [PATCH 2/2] fs: remove fs.f_write_hint
In reply to Christoph HellwigQuoted 3 lines · Christoph Hellwig
The value is now completely unused except for reporting it back through the
F_GET_FILE_RW_HINTioctl, so remove the value and the two ioctls for it.
Obvious question - which userland code issues these ioctls? I obviously like the series, but...
Re: [PATCH 2/2] fs: remove fs.f_write_hint
Quoted 7 lines · Al Viro
Quoted 3 lines · Christoph Hellwig
The value is now completely unused except for reporting it back through the
F_GET_FILE_RW_HINTioctl, so remove the value and the two ioctls for it.Obvious question - which userland code issues these ioctls? I obviously like the series, but...
The only places I've ever found are fio and ceph. Despite all the noise about Android, the google code search for Android does not actually find a user there.