|
@@ -369,9 +369,13 @@ xfs_find_trim_cow_extent(
|
|
* If we don't find an overlapping extent, trim the range we need to
|
|
* If we don't find an overlapping extent, trim the range we need to
|
|
* allocate to fit the hole we found.
|
|
* allocate to fit the hole we found.
|
|
*/
|
|
*/
|
|
- if (!xfs_iext_lookup_extent(ip, ip->i_cowfp, offset_fsb, &icur, &got) ||
|
|
|
|
- got.br_startoff > offset_fsb)
|
|
|
|
|
|
+ if (!xfs_iext_lookup_extent(ip, ip->i_cowfp, offset_fsb, &icur, &got))
|
|
|
|
+ got.br_startoff = offset_fsb + count_fsb;
|
|
|
|
+ if (got.br_startoff > offset_fsb) {
|
|
|
|
+ xfs_trim_extent(imap, imap->br_startoff,
|
|
|
|
+ got.br_startoff - imap->br_startoff);
|
|
return xfs_reflink_trim_around_shared(ip, imap, shared);
|
|
return xfs_reflink_trim_around_shared(ip, imap, shared);
|
|
|
|
+ }
|
|
|
|
|
|
*shared = true;
|
|
*shared = true;
|
|
if (isnullstartblock(got.br_startblock)) {
|
|
if (isnullstartblock(got.br_startblock)) {
|