[Devel] [PATCH vz7] fs: FIEMAP should sync only required range with FIEMAP_FLAG_SYNC

Maxim Patlasov mpatlasov at virtuozzo.com
Fri Jul 7 08:45:15 MSK 2017


Signed-off-by: Alexey Kuznetsov <kuznet at virtuozzo.com>
Signed-off-by: Maxim Patlasov <mpatlasov at virtuozzo.com>
---
 fs/ioctl.c |    3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

diff --git a/fs/ioctl.c b/fs/ioctl.c
index dea5a20..98f84a7 100644
--- a/fs/ioctl.c
+++ b/fs/ioctl.c
@@ -204,7 +204,8 @@ static int ioctl_fiemap(struct file *filp, unsigned long arg)
 		return -EFAULT;
 
 	if (fieinfo.fi_flags & FIEMAP_FLAG_SYNC)
-		filemap_write_and_wait(inode->i_mapping);
+		filemap_write_and_wait_range(inode->i_mapping, fiemap.fm_start,
+					     fiemap.fm_start + len - 1);
 
 	error = inode->i_op->fiemap(inode, &fieinfo, fiemap.fm_start, len);
 	fiemap.fm_flags = fieinfo.fi_flags;



More information about the Devel mailing list