? MAX_LFS_FILESIZE
: k.k->p.offset << 9;
+ /*
+ * Found a hole in the btree, now make sure it's
+ * a hole in the pagecache. We might have to
+ * keep searching if this hole is entirely dirty
+ * in the page cache:
+ */
bch2_trans_unlock(trans);
- next_hole = bch2_seek_pagecache_hole(&inode->v,
- start_offset, end_offset, 0, false);
- break;
+ loff_t pagecache_hole = bch2_seek_pagecache_hole(&inode->v,
+ start_offset, end_offset, 0, false);
+ if (pagecache_hole < end_offset) {
+ next_hole = pagecache_hole;
+ break;
+ }
} else {
offset = max(offset, bkey_start_offset(k.k) << 9);
}