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

Submitted by Maxim Patlasov on July 7, 2017, 5:45 a.m.

Details

Message ID 149940626512.21122.4535240267086331762.stgit@maxim-thinkpad
State New
Series "fs: FIEMAP should sync only required range with FIEMAP_FLAG_SYNC"
Headers show

Commit Message

Maxim Patlasov July 7, 2017, 5:45 a.m.
Signed-off-by: Alexey Kuznetsov <kuznet@virtuozzo.com>
Signed-off-by: Maxim Patlasov <mpatlasov@virtuozzo.com>
---
 fs/ioctl.c |    3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

Patch hide | download patch | download mbox

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;

Comments

Konstantin Khorenko July 10, 2017, 9:02 a.m.
Are you going to send this patch to mainstream as well?

--
Best regards,

Konstantin Khorenko,
Virtuozzo Linux Kernel Team

On 07/07/2017 08:45 AM, Maxim Patlasov wrote:
> Signed-off-by: Alexey Kuznetsov <kuznet@virtuozzo.com>
> Signed-off-by: Maxim Patlasov <mpatlasov@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;
>
> .
>