Message ID | 20181128032330.11753-1-lufq.fnst@cn.fujitsu.com (mailing list archive) |
---|---|
State | New, archived |
Headers | show |
Series | [1/3] btrfs: remove always true if branch in find_delalloc_range | expand |
On 28.11.18 г. 5:23 ч., Lu Fengqi wrote: > The generic_write_checks will check the combination of IOCB_NOWAIT and > !IOCB_DIRECT. True, however btrfs will return ENOSUPP whereas the generic code returns EINVAL. I guess this is not a big deal and it's likely generic code is correct, so: Reviewed-by: Nikolay Borisov <nborisov@suse.com> > > Signed-off-by: Lu Fengqi <lufq.fnst@cn.fujitsu.com> > --- > fs/btrfs/file.c | 4 ---- > 1 file changed, 4 deletions(-) > > diff --git a/fs/btrfs/file.c b/fs/btrfs/file.c > index 3835bb8c146d..190db9a685a2 100644 > --- a/fs/btrfs/file.c > +++ b/fs/btrfs/file.c > @@ -1889,10 +1889,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 (!inode_trylock(inode)) { > if (iocb->ki_flags & IOCB_NOWAIT) > return -EAGAIN; >
Reviewed-by: Johannes Thumshirn <jthumshirn@suse.de>
On Wed, Nov 28, 2018 at 09:04:31AM +0200, Nikolay Borisov wrote: > On 28.11.18 г. 5:23 ч., Lu Fengqi wrote: > > The generic_write_checks will check the combination of IOCB_NOWAIT and > > !IOCB_DIRECT. > > True, however btrfs will return ENOSUPP whereas the generic code returns > EINVAL. I guess this is not a big deal and it's likely generic code is > correct, so: I tried to check the git history if there are some clues for that. The duplicate checks could be a intermediate step before the aio/nowait feature was complete but somehow not removed at the end. The btrfs part was Added in commit 91f9943e1c7b6638f27312d03fe71fcc67b23571 "fs: support RWF_NOWAIT for buffered reads" (4.13) The generic checks were added in 6be96d3ad34a124450028dabba43f07fe1d0c86d (4.12), so from that it seems that it was added tot btrfs as redundant already.
diff --git a/fs/btrfs/file.c b/fs/btrfs/file.c index 3835bb8c146d..190db9a685a2 100644 --- a/fs/btrfs/file.c +++ b/fs/btrfs/file.c @@ -1889,10 +1889,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 (!inode_trylock(inode)) { if (iocb->ki_flags & IOCB_NOWAIT) return -EAGAIN;
The generic_write_checks will check the combination of IOCB_NOWAIT and !IOCB_DIRECT. Signed-off-by: Lu Fengqi <lufq.fnst@cn.fujitsu.com> --- fs/btrfs/file.c | 4 ---- 1 file changed, 4 deletions(-)