Skip to contentSkip to conversation

f2fs: remove redundant check in f2fs_file_write_iter()

PATCH In review Chengguang Xu 2 participants 2 messages Apr 23, 2019 – Apr 24, 2019 F2FS file system

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 f2fs: remove redundant check in f2fs_file_write_iter()

We have already checked flag IOCB_DIRECT in the sanity check of flag IOCB_NOWAIT, so don't have to check it again here.

---
 fs/f2fs/file.c | 21 +++++++++------------
 1 file changed, 9 insertions(+), 12 deletions(-)
fs/f2fs/file.c +9 -12
index 5742ab8b57dc..43b6a0b08497 100644
@@ -3056,18 +3056,15 @@ static ssize_t f2fs_file_write_iter(struct kiocb *iocb, struct iov_iter *from)
 		if (iov_iter_fault_in_readable(from, iov_iter_count(from)))
 			set_inode_flag(inode, FI_NO_PREALLOC);
 
-		if ((iocb->ki_flags & IOCB_NOWAIT) &&
-			(iocb->ki_flags & IOCB_DIRECT)) {
-				if (!f2fs_overwrite_io(inode, iocb->ki_pos,
-						iov_iter_count(from)) ||
-					f2fs_has_inline_data(inode) ||
-					f2fs_force_buffered_io(inode,
-							iocb, from)) {
-						clear_inode_flag(inode,
-								FI_NO_PREALLOC);
-						inode_unlock(inode);
-						return -EAGAIN;
-				}
+		if (iocb->ki_flags & IOCB_NOWAIT) {
+			if (!f2fs_overwrite_io(inode, iocb->ki_pos,
+			    iov_iter_count(from)) ||
+			    f2fs_has_inline_data(inode) ||
+			    f2fs_force_buffered_io(inode, iocb, from)) {
+				clear_inode_flag(inode, FI_NO_PREALLOC);
+				inode_unlock(inode);
+				return -EAGAIN;
+			}
 
 		} else {
 			preallocated = true;

--
2.20.1