diff mbox series

btrfs: remove trivial nowait check

Message ID 1580529093-26170-1-git-send-email-qiwuchen55@gmail.com (mailing list archive)
State New, archived
Headers show
Series btrfs: remove trivial nowait check | expand

Commit Message

chenqiwu Feb. 1, 2020, 3:51 a.m. UTC
From: chenqiwu <chenqiwu@xiaomi.com>

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().

Signed-off-by: chenqiwu <chenqiwu@xiaomi.com>
---
 fs/btrfs/file.c | 4 ----
 1 file changed, 4 deletions(-)

Comments

David Sterba Feb. 6, 2020, 5:17 p.m. UTC | #1
On Sat, Feb 01, 2020 at 11:51:33AM +0800, qiwuchen55@gmail.com wrote:
> From: chenqiwu <chenqiwu@xiaomi.com>
> 
> 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().
> 
> Signed-off-by: chenqiwu <chenqiwu@xiaomi.com>
> ---
>  fs/btrfs/file.c | 4 ----
>  1 file changed, 4 deletions(-)
> 
> diff --git a/fs/btrfs/file.c b/fs/btrfs/file.c
> index a16da27..320af95 100644
> --- a/fs/btrfs/file.c
> +++ b/fs/btrfs/file.c
> @@ -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.
diff mbox series

Patch

diff --git a/fs/btrfs/file.c b/fs/btrfs/file.c
index a16da27..320af95 100644
--- a/fs/btrfs/file.c
+++ b/fs/btrfs/file.c
@@ -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;