linux-btrfs.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] btrfs: remove trivial nowait check
@ 2020-02-01  3:51 qiwuchen55
  2020-02-06 17:17 ` David Sterba
  0 siblings, 1 reply; 2+ messages in thread
From: qiwuchen55 @ 2020-02-01  3:51 UTC (permalink / raw)
  To: clm, josef, dsterba, trivial; +Cc: linux-btrfs, chenqiwu

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;
-
 	if (iocb->ki_flags & IOCB_NOWAIT) {
 		if (!inode_trylock(inode))
 			return -EAGAIN;
-- 
1.9.1


^ permalink raw reply related	[flat|nested] 2+ messages in thread

* Re: [PATCH] btrfs: remove trivial nowait check
  2020-02-01  3:51 [PATCH] btrfs: remove trivial nowait check qiwuchen55
@ 2020-02-06 17:17 ` David Sterba
  0 siblings, 0 replies; 2+ messages in thread
From: David Sterba @ 2020-02-06 17:17 UTC (permalink / raw)
  To: qiwuchen55; +Cc: clm, josef, dsterba, trivial, linux-btrfs, chenqiwu

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.

^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2020-02-06 17:17 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2020-02-01  3:51 [PATCH] btrfs: remove trivial nowait check qiwuchen55
2020-02-06 17:17 ` David Sterba

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).