xfs: add missing cmap->br_state = XFS_EXT_NORM update
PATCH 1/1 xfs: add missing cmap->br_state = XFS_EXT_NORM update
COW extents are already converted into written real extents after xfs_reflink_convert_cow_locked(), therefore cmap->br_state should reflect it.
Otherwise, there is another necessary unwritten convertion triggered in xfs_dio_write_end_io() for direct I/O cases.
---
From the logic itself and runtime tracing, IMO, it seems true. Kindly correct me here if my understanding is wrong.
fs/xfs/xfs_reflink.c | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-)
fs/xfs/xfs_reflink.c +4 -1
@@ -424,7 +424,10 @@ xfs_reflink_allocate_cow(if (!convert_now || cmap->br_state ==XFS_EXT_NORM )return 0 ;trace_xfs_reflink_convert_cow (ip, cmap); -return xfs_reflink_convert_cow_locked (ip, offset_fsb, count_fsb); + error =xfs_reflink_convert_cow_locked (ip, offset_fsb, count_fsb); +if (!error) + cmap->br_state =XFS_EXT_NORM ; +return error; out_trans_cancel:xfs_trans_cancel (tp);
Signature · 1 line
2.24.4
Quoted 8 lines · Gao Xiang
COW extents are already converted into written real extents after
xfs_reflink_convert_cow_locked(), thereforecmap->br_stateshould reflect it.Otherwise, there is another necessary unwritten convertion triggered in
xfs_dio_write_end_io()for direct I/O cases.Signed-off-by Gao Xiang <[email protected]>
I /think/ this looks ok. Does it test ok too? AFAICT nothing in the iomap/writeback machinery cares the incorrect state because we always set IOMAP_F_SHARED (which triggers COW) so I think this is simply a fix for directio, like you said?
--D
Quoted 26 lines
---
From the logic itself and runtime tracing, IMO, it seems true. Kindly correct me here if my understanding is wrong.fs/xfs/xfs_reflink.c | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-)fs/xfs/xfs_reflink.c +4
-1@@ -424,7 +424,10 @@ xfs_reflink_allocate_cow(if (!convert_now || cmap->br_state ==XFS_EXT_NORM )return 0 ;trace_xfs_reflink_convert_cow (ip, cmap); -return xfs_reflink_convert_cow_locked (ip, offset_fsb, count_fsb); + error =xfs_reflink_convert_cow_locked (ip, offset_fsb, count_fsb); +if (!error) + cmap->br_state =XFS_EXT_NORM ; +return error; out_trans_cancel:xfs_trans_cancel (tp);Signature · 1 line
2.24.4
Hi Darrick,
Quoted 8 lines · Darrick J. Wong
Quoted 7 lines · Gao Xiang
COW extents are already converted into written real extents after
xfs_reflink_convert_cow_locked(), thereforecmap->br_stateshould reflect it.Otherwise, there is another necessary unwritten convertion triggered in
xfs_dio_write_end_io()for direct I/O cases.
Quoted 6 lines
Quoted 1 line
Signed-off-by Gao Xiang <[email protected]>I /think/ this looks ok. Does it test ok too? AFAICT nothing in the iomap/writeback machinery cares the incorrect state because we always set
IOMAP_F_SHARED(which triggers COW) so I think this is simply a fix for directio, like you said?
Yeah, I think so, from the code logic buffered i/o seems no impacted... And the unnecessary unwritten convertion under direct i/o takes noticeable extra overhead in our workloads...
I checked my last night xfstests, it seems it stops unexpectedly (maybe due to some environmental problem). I will rerun tests today and feedback later.
Thanks,
Gao Xiang
Quoted 29 lines
--D
Quoted 26 lines
---
From the logic itself and runtime tracing, IMO, it seems true. Kindly correct me here if my understanding is wrong.fs/xfs/xfs_reflink.c | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-)fs/xfs/xfs_reflink.c +4
-1@@ -424,7 +424,10 @@ xfs_reflink_allocate_cow(if (!convert_now || cmap->br_state ==XFS_EXT_NORM )return 0 ;trace_xfs_reflink_convert_cow (ip, cmap); -return xfs_reflink_convert_cow_locked (ip, offset_fsb, count_fsb); + error =xfs_reflink_convert_cow_locked (ip, offset_fsb, count_fsb); +if (!error) + cmap->br_state =XFS_EXT_NORM ; +return error; out_trans_cancel:xfs_trans_cancel (tp);Signature · 1 line
2.24.4
Quoted 18 lines · Gao Xiang
Hi Darrick,
Quoted 8 lines · Darrick J. Wong
Quoted 7 lines · Gao Xiang
COW extents are already converted into written real extents after
xfs_reflink_convert_cow_locked(), thereforecmap->br_stateshould reflect it.Otherwise, there is another necessary unwritten convertion triggered in
xfs_dio_write_end_io()for direct I/O cases.Quoted 6 lines
Quoted 1 line
Signed-off-by Gao Xiang <[email protected]>I /think/ this looks ok. Does it test ok too? AFAICT nothing in the iomap/writeback machinery cares the incorrect state because we always set
IOMAP_F_SHARED(which triggers COW) so I think this is simply a fix for directio, like you said?
Quoted 7 lines
Yeah, I think so, from the code logic buffered i/o seems no impacted... And the unnecessary unwritten convertion under direct i/o takes noticeable extra overhead in our workloads...
I checked my last night xfstests, it seems it stops unexpectedly (maybe due to some environmental problem). I will rerun tests today and feedback later.
On my test environment machine, with linux 5.17-rc4, both w/ and w/o the patch, it fails:
generic/594 generic/600 xfs/158 xfs/160
I think no issue with this patch.
Thanks,
Gao Xiang
Quoted 27 lines · Gao Xiang
Quoted 18 lines · Gao Xiang
Hi Darrick,
Quoted 8 lines · Darrick J. Wong
Quoted 7 lines · Gao Xiang
COW extents are already converted into written real extents after
xfs_reflink_convert_cow_locked(), thereforecmap->br_stateshould reflect it.Otherwise, there is another necessary unwritten convertion triggered in
xfs_dio_write_end_io()for direct I/O cases.Quoted 6 lines
Quoted 1 line
Signed-off-by Gao Xiang <[email protected]>I /think/ this looks ok. Does it test ok too? AFAICT nothing in the iomap/writeback machinery cares the incorrect state because we always set
IOMAP_F_SHARED(which triggers COW) so I think this is simply a fix for directio, like you said?Quoted 7 lines
Yeah, I think so, from the code logic buffered i/o seems no impacted... And the unnecessary unwritten convertion under direct i/o takes noticeable extra overhead in our workloads...
I checked my last night xfstests, it seems it stops unexpectedly (maybe due to some environmental problem). I will rerun tests today and feedback later.
Quoted 6 lines
On my test environment machine, with linux 5.17-rc4, both w/ and w/o the patch, it fails:
generic/594 generic/600 xfs/158 xfs/160
I think no issue with this patch.
ping.. it seems a simple fix for direct I/O..
Thanks,
Gao Xiang
Quoted 3 lines
Thanks,
Gao Xiang