[Devel] [PATCH rh7 08/30] fs: Kill ->direct_IO_bvec
Kirill Tkhai
ktkhai at virtuozzo.com
Wed May 20 19:03:52 MSK 2020
Move "if (iov_iter_has_bvec()" switch to fuse_direct_IO(),
since fuse is the only user of bvec.
Signed-off-by: Kirill Tkhai <ktkhai at virtuozzo.com>
---
drivers/block/ploop/io_kaio.c | 6 ------
fs/fuse/file.c | 16 ++++++++++++----
include/linux/fs.h | 11 +----------
3 files changed, 13 insertions(+), 20 deletions(-)
diff --git a/drivers/block/ploop/io_kaio.c b/drivers/block/ploop/io_kaio.c
index 51ee627c4037..c4e64b42a657 100644
--- a/drivers/block/ploop/io_kaio.c
+++ b/drivers/block/ploop/io_kaio.c
@@ -1163,12 +1163,6 @@ static int kaio_autodetect(struct ploop_io * io)
return -1;
}
- if (file->f_mapping->a_ops->direct_IO_bvec == NULL) {
- printk("Cannot run kaio over fs (%s) w/o direct_IO_bvec\n",
- file->f_mapping->host->i_sb->s_type->name);
- return -1;
- }
-
return 0;
}
diff --git a/fs/fuse/file.c b/fs/fuse/file.c
index a164db9bac9c..4522e219c934 100644
--- a/fs/fuse/file.c
+++ b/fs/fuse/file.c
@@ -3597,9 +3597,9 @@ static inline loff_t fuse_round_up(loff_t off)
return round_up(off, FUSE_MAX_PAGES_PER_REQ << PAGE_SHIFT);
}
-static ssize_t
-fuse_direct_IO(int rw, struct kiocb *iocb, struct iov_iter *iter,
- loff_t offset)
+static inline ssize_t
+__fuse_direct_IO(int rw, struct kiocb *iocb, struct iov_iter *iter,
+ loff_t offset)
{
ssize_t ret = 0;
struct file *file = iocb->ki_filp;
@@ -3689,6 +3689,15 @@ fuse_direct_IO(int rw, struct kiocb *iocb, struct iov_iter *iter,
return ret;
}
+static ssize_t
+fuse_direct_IO(int rw, struct kiocb *iocb, struct iov_iter *iter, loff_t offset)
+{
+ if (iov_iter_has_bvec(iter))
+ return fuse_direct_IO_bvec(rw, iocb, iov_iter_bvec(iter),
+ offset, iter->nr_segs);
+ return __fuse_direct_IO(rw, iocb, iter, offset);
+}
+
static long fuse_file_fallocate(struct file *file, int mode, loff_t offset,
loff_t length)
{
@@ -4056,7 +4065,6 @@ static const struct address_space_operations fuse_file_aops = {
.set_page_dirty = __set_page_dirty_nobuffers,
.bmap = fuse_bmap,
.direct_IO = fuse_direct_IO,
- .direct_IO_bvec = fuse_direct_IO_bvec,
.write_begin = fuse_write_begin,
.write_end = fuse_write_end,
};
diff --git a/include/linux/fs.h b/include/linux/fs.h
index 277bf8711b36..871505f6e575 100644
--- a/include/linux/fs.h
+++ b/include/linux/fs.h
@@ -576,8 +576,6 @@ struct address_space_operations {
void (*freepage)(struct page *);
ssize_t (*direct_IO)(int, struct kiocb *, struct iov_iter *iter,
loff_t offset);
- ssize_t (*direct_IO_bvec)(int, struct kiocb *, struct bio_vec *bvec,
- loff_t offset, unsigned long bvec_len);
int (*get_xip_mem)(struct address_space *, pgoff_t, int,
void **, unsigned long *);
RH_KABI_DEPRECATE_FN(int, get_xip_mem, struct address_space *, pgoff_t,
@@ -3657,14 +3655,7 @@ static inline ssize_t mapping_direct_IO(struct address_space *mapping, int rw,
struct kiocb *iocb, struct iov_iter *iter,
loff_t pos)
{
- if (iov_iter_has_iovec(iter))
- return mapping->a_ops->direct_IO(rw, iocb, iter, pos);
- else if (iov_iter_has_bvec(iter))
- return mapping->a_ops->direct_IO_bvec(rw, iocb,
- iov_iter_bvec(iter), pos,
- iter->nr_segs);
- else
- BUG();
+ return mapping->a_ops->direct_IO(rw, iocb, iter, pos);
}
extern bool path_noexec(const struct path *path);
More information about the Devel
mailing list