All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH] xfs: convert COW blocks to real blocks before unwritten extent conversion
@ 2016-10-10 13:06 Christoph Hellwig
  2016-10-11  7:38 ` Dave Chinner
  0 siblings, 1 reply; 3+ messages in thread
From: Christoph Hellwig @ 2016-10-10 13:06 UTC (permalink / raw)
  To: linux-xfs; +Cc: darrick.wong

We need to splice COW blocks we've completed in xfs_end_io_direct_write
into the data fork before converting unwritten extents.  Otherwise
xfs_bmapi_write might first allocate blocks for any holes in the data
fork, which isn't only not needed but also harmful as it might cause
reserved block underruns in the transaction.

Signed-off-by: Christoph Hellwig <hch@lst.de>
---
 fs/xfs/xfs_aops.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/fs/xfs/xfs_aops.c b/fs/xfs/xfs_aops.c
index 0e2a931..3e57a56 100644
--- a/fs/xfs/xfs_aops.c
+++ b/fs/xfs/xfs_aops.c
@@ -1547,13 +1547,13 @@ xfs_end_io_direct_write(
 		i_size_write(inode, offset + size);
 	spin_unlock(&ip->i_flags_lock);
 
+	if (flags & XFS_DIO_FLAG_COW)
+		error = xfs_reflink_end_cow(ip, offset, size);
 	if (flags & XFS_DIO_FLAG_UNWRITTEN) {
 		trace_xfs_end_io_direct_write_unwritten(ip, offset, size);
 
 		error = xfs_iomap_write_unwritten(ip, offset, size);
 	}
-	if (flags & XFS_DIO_FLAG_COW)
-		error = xfs_reflink_end_cow(ip, offset, size);
 	if (flags & XFS_DIO_FLAG_APPEND) {
 		trace_xfs_end_io_direct_write_append(ip, offset, size);
 
-- 
2.10.1.382.ga23ca1b


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

* Re: [PATCH] xfs: convert COW blocks to real blocks before unwritten extent conversion
  2016-10-10 13:06 [PATCH] xfs: convert COW blocks to real blocks before unwritten extent conversion Christoph Hellwig
@ 2016-10-11  7:38 ` Dave Chinner
  2016-10-11 18:39   ` Darrick J. Wong
  0 siblings, 1 reply; 3+ messages in thread
From: Dave Chinner @ 2016-10-11  7:38 UTC (permalink / raw)
  To: Christoph Hellwig; +Cc: linux-xfs, darrick.wong

On Mon, Oct 10, 2016 at 03:06:34PM +0200, Christoph Hellwig wrote:
> We need to splice COW blocks we've completed in xfs_end_io_direct_write
> into the data fork before converting unwritten extents.  Otherwise
> xfs_bmapi_write might first allocate blocks for any holes in the data
> fork, which isn't only not needed but also harmful as it might cause
> reserved block underruns in the transaction.
> 
> Signed-off-by: Christoph Hellwig <hch@lst.de>

Committed and pushe dout to the for-next branch (commit
feac470e3642e8956ac9b7f14224e6b301b9219d). If there's no more
late-breaking, urgent fixes, then this is what I'll ask Linus to
pull tomorrow....

Cheers,

Dave.
-- 
Dave Chinner
david@fromorbit.com

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

* Re: [PATCH] xfs: convert COW blocks to real blocks before unwritten extent conversion
  2016-10-11  7:38 ` Dave Chinner
@ 2016-10-11 18:39   ` Darrick J. Wong
  0 siblings, 0 replies; 3+ messages in thread
From: Darrick J. Wong @ 2016-10-11 18:39 UTC (permalink / raw)
  To: Dave Chinner; +Cc: Christoph Hellwig, linux-xfs

On Tue, Oct 11, 2016 at 06:38:25PM +1100, Dave Chinner wrote:
> On Mon, Oct 10, 2016 at 03:06:34PM +0200, Christoph Hellwig wrote:
> > We need to splice COW blocks we've completed in xfs_end_io_direct_write
> > into the data fork before converting unwritten extents.  Otherwise
> > xfs_bmapi_write might first allocate blocks for any holes in the data
> > fork, which isn't only not needed but also harmful as it might cause
> > reserved block underruns in the transaction.
> > 
> > Signed-off-by: Christoph Hellwig <hch@lst.de>
> 
> Committed and pushe dout to the for-next branch (commit
> feac470e3642e8956ac9b7f14224e6b301b9219d). If there's no more
> late-breaking, urgent fixes, then this is what I'll ask Linus to
> pull tomorrow....

Everything looks ok from here!

--D

> 
> Cheers,
> 
> Dave.
> -- 
> Dave Chinner
> david@fromorbit.com
> --
> To unsubscribe from this list: send the line "unsubscribe linux-xfs" in
> the body of a message to majordomo@vger.kernel.org
> More majordomo info at  http://vger.kernel.org/majordomo-info.html

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

end of thread, other threads:[~2016-10-11 22:26 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2016-10-10 13:06 [PATCH] xfs: convert COW blocks to real blocks before unwritten extent conversion Christoph Hellwig
2016-10-11  7:38 ` Dave Chinner
2016-10-11 18:39   ` Darrick J. Wong

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.