We should want to write directly into the data fork for blocks that don't have an extent in the COW fork covering them yet.
Unified · Split
| @@ -369,9 +369,13 @@ xfs_find_trim_cow_extent( · 368 unmodified lines | ||
| 369 | 369 | * If we don't find an overlapping extent, trim the range we need to |
| 370 | 370 | * allocate to fit the hole we found. |
| 371 | 371 | */ |
| 372 | − if (!xfs_iext_lookup_extent(ip, ip->i_cowfp, offset_fsb, &icur, &got) || | |
| 373 | − got.br_startoff > offset_fsb) | |
| 372 | + if (!xfs_iext_lookup_extent(ip, ip->i_cowfp, offset_fsb, &icur, &got)) | |
| 373 | + got.br_startoff = offset_fsb + count_fsb; | |
| 374 | + if (got.br_startoff > offset_fsb) { | |
| 375 | + xfs_trim_extent(imap, imap->br_startoff, | |
| 376 | + got.br_startoff - imap->br_startoff); | |
| 374 | 377 | return xfs_reflink_trim_around_shared(ip, imap, shared); |
| 378 | + } | |
| 375 | 379 | |
| 376 | 380 | *shared = true; |
| 377 | 381 | if (isnullstartblock(got.br_startblock)) { |