Skip to contentSkip to conversation

fat: enable .splice_write to support splice on O_DIRECT file

PATCH In review Hou Tao 2 participants 4 messages Feb 10, 2019 – Feb 13, 2019

Subsystems (2)
lore
Share & tools
lore

Hou Tao

author
#0 lore raw

PATCH 1/1 fat: enable .splice_write to support splice on O_DIRECT file

Now splice() on O_DIRECT-opened fat file will return -EFAULT, that is because the default .splice_write, namely default_file_splice_write(), will construct an ITER_KVEC iov_iter and dio_refill_pages() in dio path can not handle it.

Fix it by implementing .splice_write through iter_file_splice_write().

Spotted by xfs-tests generic/091.

---
 fs/fat/file.c | 1 +
 1 file changed, 1 insertion(+)
fs/fat/file.c +1 -0
index 13935ee99e1e..b3bed32946b1 100644
@@ -214,6 +214,7 @@ const struct file_operations fat_file_operations = {
 #endif
 	.fsync		= fat_file_fsync,
 	.splice_read	= generic_file_splice_read,
+	.splice_write	= iter_file_splice_write,
 	.fallocate	= fat_fallocate,
 };
 
Signature · 1 line
2.16.2.dirty
author
#1 lore raw

ping ?

Quoted 27 lines · Hou Tao

Now splice() on O_DIRECT-opened fat file will return -EFAULT, that is because the default .splice_write, namely default_file_splice_write(), will construct an ITER_KVEC iov_iter and dio_refill_pages() in dio path can not handle it.

Fix it by implementing .splice_write through iter_file_splice_write().

Spotted by xfs-tests generic/091.

---
 fs/fat/file.c | 1 +
 1 file changed, 1 insertion(+)
fs/fat/file.c +1 -0
index 13935ee99e1e..b3bed32946b1 100644
@@ -214,6 +214,7 @@ const struct file_operations fat_file_operations = {
 #endif
 	.fsync		= fat_file_fsync,
 	.splice_read	= generic_file_splice_read,
+	.splice_write	= iter_file_splice_write,
 	.fallocate	= fat_fallocate,
 };
 
maintainer Acked-by on v1 1/1
#2 lore raw
In reply to Hou Tao
Quoted 19 lines · Hou Tao

Now splice() on O_DIRECT-opened fat file will return -EFAULT, that is because the default .splice_write, namely default_file_splice_write(), will construct an ITER_KVEC iov_iter and dio_refill_pages() in dio path can not handle it.

Fix it by implementing .splice_write through iter_file_splice_write().

Spotted by xfs-tests generic/091.

---
 fs/fat/file.c | 1 +
 1 file changed, 1 insertion(+)
fs/fat/file.c +0 -0
index 13935ee99e1e..b3bed32946b1 100644

fs/fat/file.c const struct file_operations fat_file_operations = { · line 219

Quoted 6 lines
fs/fat/file.c +1 -0
@@ -214,6 +214,7 @@ const struct file_operations fat_file_operations = {
 #endif
 	.fsync		= fat_file_fsync,
 	.splice_read	= generic_file_splice_read,
+	.splice_write	= iter_file_splice_write,
 	.fallocate	= fat_fallocate,
 };

Looks good.

Thanks.

Signature · 1 line
OGAWA Hirofumi <[email protected]>
maintainer
#3 lore raw
Quoted 30 lines · OGAWA Hirofumi
Quoted 19 lines · Hou Tao

Now splice() on O_DIRECT-opened fat file will return -EFAULT, that is because the default .splice_write, namely default_file_splice_write(), will construct an ITER_KVEC iov_iter and dio_refill_pages() in dio path can not handle it.

Fix it by implementing .splice_write through iter_file_splice_write().

Spotted by xfs-tests generic/091.

---
 fs/fat/file.c | 1 +
 1 file changed, 1 insertion(+)
fs/fat/file.c +0 -0
index 13935ee99e1e..b3bed32946b1 100644

fs/fat/file.c const struct file_operations fat_file_operations = { · line 219

Quoted 6 lines
fs/fat/file.c +1 -0
@@ -214,6 +214,7 @@ const struct file_operations fat_file_operations = {
 #endif
 	.fsync		= fat_file_fsync,
 	.splice_read	= generic_file_splice_read,
+	.splice_write	= iter_file_splice_write,
 	.fallocate	= fat_fallocate,
 };

Looks good.

Quoted 3 lines

Thanks.

Forgot to include akpm to addresses.

Signature · 1 line
OGAWA Hirofumi <[email protected]>