WSL2-Linux-Kernel/fs/f2fs
Chao Yu c15e8599ff f2fs: report EINVAL for unalignment direct IO
We run ltp testcase with f2fs and obtain a TFAIL in diotest4, the result in
detail is as fallow:

dio04

<<<test_start>>>
tag=dio04 stime=1432278894
cmdline="diotest4"
contacts=""
analysis=exit
<<<test_output>>>
diotest4    1  TPASS  :  Negative Offset
diotest4    2  TPASS  :  removed
diotest4    3  TFAIL  :  diotest4.c:129: write allows odd count.returns 1: Success
diotest4    4  TFAIL  :  diotest4.c:183: Odd count of read and write
diotest4    5  TPASS  :  Read beyond the file size
......

the result of ext4 with same environment:

dio04

<<<test_start>>>
tag=dio04 stime=1432259643
cmdline="diotest4"
contacts=""
analysis=exit
<<<test_output>>>
diotest4    1  TPASS  :  Negative Offset
diotest4    2  TPASS  :  removed
diotest4    3  TPASS  :  Odd count of read and write
diotest4    4  TPASS  :  Read beyond the file size
......

The reason is that when triggering DIO in f2fs, we will return zero value
in ->direct_IO if writer's buffer offset, file offset and transfer size is
not alignment to block size of filesystem, resulting in falling back into
buffered write instead of returning -EINVAL.

This patch fixes that problem by returning correct error number for above
case, and removing the judgement condition in check_direct_IO to make sure
the verification will be enabled for direct reader too.

Besides, Jaegeuk Kim pointed out that there is expectional cases we should
always make direct-io falling back into buffered write, such as dio in
encrypted file.

Signed-off-by: Yunlei He <heyunlei@huawei.com>
[Chao Yu make small change and add detail description in commit message]
Signed-off-by: Chao Yu <chao2.yu@samsung.com>
Signed-off-by: Jaegeuk Kim <jaegeuk@kernel.org>
2015-08-11 11:30:24 -07:00
..
Kconfig f2fs crypto: add f2fs encryption Kconfig 2015-05-28 15:41:46 -07:00
Makefile f2fs: maintain extent cache in separated file 2015-08-04 14:09:58 -07:00
acl.c f2fs: make posix_acl_create() safer and cleaner 2015-05-07 11:38:31 -07:00
acl.h f2fs: avoid deadlock on init_inode_metadata 2014-11-03 16:07:33 -08:00
checkpoint.c f2fs: invalidate temporary meta page 2015-08-05 08:19:21 -07:00
crypto.c f2fs crypto: add alloc_bounce_page 2015-06-11 15:04:20 -07:00
crypto_fname.c f2fs crypto: clean up error handling in f2fs_fname_setup_filename 2015-06-01 16:21:08 -07:00
crypto_key.c f2fs crypto: delete an unnecessary check before the function call "key_put" 2015-08-04 14:09:52 -07:00
crypto_policy.c f2fs crypto: do not set encryption policy for non-directory by ioctl 2015-06-01 16:21:07 -07:00
data.c f2fs: report EINVAL for unalignment direct IO 2015-08-11 11:30:24 -07:00
debug.c f2fs: use atomic_t to record hit ratio info of extent cache 2015-08-05 08:08:06 -07:00
dir.c f2fs crypto: use per-inode tfm structure 2015-06-01 16:21:04 -07:00
extent_cache.c f2fs: add new interfaces for extent tree 2015-08-05 08:08:08 -07:00
f2fs.h f2fs: use extent cache to optimize f2fs_reserve_block 2015-08-05 22:15:42 -07:00
f2fs_crypto.h f2fs crypto: remove alloc_page for bounce_page 2015-06-01 16:21:10 -07:00
file.c f2fs: report error of fill_zero 2015-08-10 12:26:34 -07:00
gc.c f2fs: use a page temporarily for encrypted gced page 2015-08-05 08:08:04 -07:00
gc.h f2fs: add new ioctl F2FS_IOC_GARBAGE_COLLECT 2015-08-04 14:09:58 -07:00
hash.c f2fs: introduce dot and dotdot name check 2015-05-28 15:41:34 -07:00
inline.c f2fs: fix to release inode page correctly 2015-08-05 08:08:23 -07:00
inode.c f2fs: fix inline data/dentry stat number leak 2015-08-05 08:08:14 -07:00
namei.c f2fs: stat inline xattr inode number 2015-08-05 08:08:05 -07:00
node.c f2fs: fix to build free nids from readaheaded nat pages 2015-08-05 08:08:14 -07:00
node.h f2fs: move existing definitions into f2fs.h 2015-05-28 15:41:27 -07:00
recovery.c f2fs: recover invalid/reserved block address for fsynced file 2015-08-05 22:16:41 -07:00
segment.c f2fs: invalidate temporary meta page 2015-08-05 08:19:21 -07:00
segment.h f2fs: unify f2fs_bug_on when check blocks and segment 2015-08-05 08:08:18 -07:00
shrinker.c f2fs: use extent_cache by default 2015-08-04 14:09:56 -07:00
super.c f2fs: fix double lock in handle_failed_inode 2015-08-05 08:08:09 -07:00
trace.c f2fs: add sbi and page pointer in f2fs_io_info 2015-05-28 15:41:32 -07:00
trace.h f2fs: add sbi and page pointer in f2fs_io_info 2015-05-28 15:41:32 -07:00
xattr.c f2fs: correct return value of ->setxattr 2015-08-04 14:09:59 -07:00
xattr.h f2fs crypto: add encryption xattr support 2015-05-28 15:41:47 -07:00