lkml.org 
[lkml]   [2018]   [Nov]   [18]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
Patch in this message
/
From
Subject[PATCH] mm/filemap.c: minor optimization in write_iter file operation
Date
This little adjustment on bitwise operation could make the code a little
faster.
As write_iter is used in lots of critical path, so this code change is
useful for performance.

Signed-off-by: Yafang Shao <laoar.shao@gmail.com>
---
mm/filemap.c | 3 ++-
1 file changed, 2 insertions(+), 1 deletion(-)

diff --git a/mm/filemap.c b/mm/filemap.c
index 81adec8..a65056ea 100644
--- a/mm/filemap.c
+++ b/mm/filemap.c
@@ -2881,7 +2881,8 @@ inline ssize_t generic_write_checks(struct kiocb *iocb, struct iov_iter *from)
if (iocb->ki_flags & IOCB_APPEND)
iocb->ki_pos = i_size_read(inode);

- if ((iocb->ki_flags & IOCB_NOWAIT) && !(iocb->ki_flags & IOCB_DIRECT))
+ if ((iocb->ki_flags & (IOCB_NOWAIT | IOCB_DIRECT)) ==
+ IOCB_NOWAIT)
return -EINVAL;

count = iov_iter_count(from);
--
1.8.3.1
\
 
 \ /
  Last update: 2018-11-18 13:05    [W:0.037 / U:0.288 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site