From 3e9dfc6e1e8bce62a329f1452c7eeccbac230980 Mon Sep 17 00:00:00 2001 From: Martin Brandenburg Date: Tue, 6 Nov 2018 19:54:49 +0000 Subject: orangefs: move do_readv_writev to direct_IO direct_IO was the only caller and all direct_IO did was call it, so there's no use in having the code spread out into so many functions. Signed-off-by: Martin Brandenburg Signed-off-by: Mike Marshall --- fs/orangefs/file.c | 108 ----------------------------------------------------- 1 file changed, 108 deletions(-) (limited to 'fs/orangefs/file.c') diff --git a/fs/orangefs/file.c b/fs/orangefs/file.c index 0af9f0b42d80..f4e20d5ed207 100644 --- a/fs/orangefs/file.c +++ b/fs/orangefs/file.c @@ -237,114 +237,6 @@ out: return ret; } -/* - * Common entry point for read/write/readv/writev - * This function will dispatch it to either the direct I/O - * or buffered I/O path depending on the mount options and/or - * augmented/extended metadata attached to the file. - * Note: File extended attributes override any mount options. - */ -ssize_t do_readv_writev(enum ORANGEFS_io_type type, struct file *file, - loff_t *offset, struct iov_iter *iter) -{ - struct inode *inode = file->f_mapping->host; - struct orangefs_inode_s *orangefs_inode = ORANGEFS_I(inode); - struct orangefs_khandle *handle = &orangefs_inode->refn.khandle; - size_t count = iov_iter_count(iter); - ssize_t total_count = 0; - ssize_t ret = -EINVAL; - - gossip_debug(GOSSIP_FILE_DEBUG, - "%s-BEGIN(%pU): count(%d) after estimate_max_iovecs.\n", - __func__, - handle, - (int)count); - - if (type == ORANGEFS_IO_WRITE) { - gossip_debug(GOSSIP_FILE_DEBUG, - "%s(%pU): proceeding with offset : %llu, " - "size %d\n", - __func__, - handle, - llu(*offset), - (int)count); - } - - if (count == 0) { - ret = 0; - goto out; - } - - while (iov_iter_count(iter)) { - size_t each_count = iov_iter_count(iter); - size_t amt_complete; - - /* how much to transfer in this loop iteration */ - if (each_count > orangefs_bufmap_size_query()) - each_count = orangefs_bufmap_size_query(); - - gossip_debug(GOSSIP_FILE_DEBUG, - "%s(%pU): size of each_count(%d)\n", - __func__, - handle, - (int)each_count); - gossip_debug(GOSSIP_FILE_DEBUG, - "%s(%pU): BEFORE wait_for_io: offset is %d\n", - __func__, - handle, - (int)*offset); - - ret = wait_for_direct_io(type, inode, offset, iter, - each_count, 0); - gossip_debug(GOSSIP_FILE_DEBUG, - "%s(%pU): return from wait_for_io:%d\n", - __func__, - handle, - (int)ret); - - if (ret < 0) - goto out; - - *offset += ret; - total_count += ret; - amt_complete = ret; - - gossip_debug(GOSSIP_FILE_DEBUG, - "%s(%pU): AFTER wait_for_io: offset is %d\n", - __func__, - handle, - (int)*offset); - - /* - * if we got a short I/O operations, - * fall out and return what we got so far - */ - if (amt_complete < each_count) - break; - } /*end while */ - -out: - if (total_count > 0) - ret = total_count; - if (ret > 0) { - if (type == ORANGEFS_IO_READ) { - file_accessed(file); - } else { - file_update_time(file); - if (*offset > i_size_read(inode)) - i_size_write(inode, *offset); - } - } - - gossip_debug(GOSSIP_FILE_DEBUG, - "%s(%pU): Value(%d) returned.\n", - __func__, - handle, - (int)ret); - - return ret; -} - static ssize_t orangefs_file_read_iter(struct kiocb *iocb, struct iov_iter *iter) { -- cgit v1.2.3