public inbox for linux-xfs@vger.kernel.org
 help / color / mirror / Atom feed
* [PATCH] xfs: only flush the unshared range in xfs_reflink_unshare
@ 2020-11-03 18:37 Darrick J. Wong
  2020-11-04  9:37 ` Chandan Babu R
  0 siblings, 1 reply; 2+ messages in thread
From: Darrick J. Wong @ 2020-11-03 18:37 UTC (permalink / raw)
  To: xfs

From: Darrick J. Wong <darrick.wong@oracle.com>

There's no reason to flush an entire file when we're unsharing part of
a file.  Therefore, only initiate writeback on the selected range.

Signed-off-by: Darrick J. Wong <darrick.wong@oracle.com>
---
 fs/xfs/xfs_reflink.c |    3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

diff --git a/fs/xfs/xfs_reflink.c b/fs/xfs/xfs_reflink.c
index 16098dc42add..6fa05fb78189 100644
--- a/fs/xfs/xfs_reflink.c
+++ b/fs/xfs/xfs_reflink.c
@@ -1502,7 +1502,8 @@ xfs_reflink_unshare(
 			&xfs_buffered_write_iomap_ops);
 	if (error)
 		goto out;
-	error = filemap_write_and_wait(inode->i_mapping);
+
+	error = filemap_write_and_wait_range(inode->i_mapping, offset, len);
 	if (error)
 		goto out;
 

^ permalink raw reply related	[flat|nested] 2+ messages in thread

* Re: [PATCH] xfs: only flush the unshared range in xfs_reflink_unshare
  2020-11-03 18:37 [PATCH] xfs: only flush the unshared range in xfs_reflink_unshare Darrick J. Wong
@ 2020-11-04  9:37 ` Chandan Babu R
  0 siblings, 0 replies; 2+ messages in thread
From: Chandan Babu R @ 2020-11-04  9:37 UTC (permalink / raw)
  To: Darrick J. Wong; +Cc: xfs

On Wednesday 4 November 2020 12:07:33 AM IST Darrick J. Wong wrote:
> From: Darrick J. Wong <darrick.wong@oracle.com>
> 
> There's no reason to flush an entire file when we're unsharing part of
> a file.  Therefore, only initiate writeback on the selected range.
>

Looks good to me.

Reviewed-by: Chandan Babu R <chandanrlinux@gmail.com>

> Signed-off-by: Darrick J. Wong <darrick.wong@oracle.com>
> ---
>  fs/xfs/xfs_reflink.c |    3 ++-
>  1 file changed, 2 insertions(+), 1 deletion(-)
> 
> diff --git a/fs/xfs/xfs_reflink.c b/fs/xfs/xfs_reflink.c
> index 16098dc42add..6fa05fb78189 100644
> --- a/fs/xfs/xfs_reflink.c
> +++ b/fs/xfs/xfs_reflink.c
> @@ -1502,7 +1502,8 @@ xfs_reflink_unshare(
>  			&xfs_buffered_write_iomap_ops);
>  	if (error)
>  		goto out;
> -	error = filemap_write_and_wait(inode->i_mapping);
> +
> +	error = filemap_write_and_wait_range(inode->i_mapping, offset, len);
>  	if (error)
>  		goto out;
>  
> 


-- 
chandan




^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2020-11-04  9:37 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2020-11-03 18:37 [PATCH] xfs: only flush the unshared range in xfs_reflink_unshare Darrick J. Wong
2020-11-04  9:37 ` Chandan Babu R

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox