btrfs: remove trivial nowait check
PATCH 1/1 btrfs: remove trivial nowait check
From: chenqiwu <[email protected]>
Remove trivial nowait check for btrfs_file_write_iter(), since buffered writes will return -EINVAL if IOCB_NOWAIT passed in the follow-up function generic_write_checks().
--- fs/btrfs/file.c | 4 ---- 1 file changed, 4 deletions(-)
fs/btrfs/file.c +0 -4
@@ -1896,10 +1896,6 @@ static ssize_t btrfs_file_write_iter(struct kiocb *iocb,loff_t oldsize;int clean_page =0 ; -if (!(iocb->ki_flags &IOCB_DIRECT ) && - (iocb->ki_flags &IOCB_NOWAIT )) -return -EOPNOTSUPP ; -if (iocb->ki_flags &IOCB_NOWAIT ) {if (!inode_trylock (inode))return -EAGAIN ;
Signature · 1 line
1.9.1
Quoted 16 lines · On Sat, Feb 01, 2020 at 11:51:33AM +0800, [email protected] wrote:
From: chenqiwu <[email protected]>
Remove trivial nowait check for
btrfs_file_write_iter(), since buffered writes will return-EINVALifIOCB_NOWAITpassed in the follow-up functiongeneric_write_checks().Signed-off-by chenqiwu <[email protected]>--- fs/btrfs/file.c | 4 ---- 1 file changed, 4 deletions(-)fs/btrfs/file.c +0
-0
fs/btrfs/file.c static ssize_t btrfs_file_write_iter(struct kiocb *iocb, · line 1901
Quoted 6 lines
fs/btrfs/file.c +0
-3@@ -1896,10 +1896,6 @@ static ssize_t btrfs_file_write_iter(struct kiocb *iocb,loff_t oldsize;int clean_page =0 ; -if (!(iocb->ki_flags &IOCB_DIRECT ) && - (iocb->ki_flags &IOCB_NOWAIT )) -return -EOPNOTSUPP ;
This returns a different error code for the condition than generic_write_checks, and is checked without the inode lock. I'm not sure if we should remove it, it's a fast-fail path for buffered+nowait, that probably does not happen that often.