mirror of
https://github.com/versity/scoutfs.git
synced 2026-09-06 08:06:56 +00:00
scoutfs: start truncate from first block
Truncation updates extents that intersect with the input range. It starts with the first block in the range and iterates until it has searched for all the extents that could cover the range. Extents are stored in items at their final block location so that we can use _next to find intersections. Truncation was searching for the next extent after the full extent that it was still searching for. That means it was starting the search at the last block in the extent, not the first. It would miss all the extents that didn't overlap with the last block it was searching for. This fixed by searching from a temporary single block extent at the start of the search range. Signed-off-by: Zach Brown <zab@versity.com>
This commit is contained in:
+4
-1
@@ -530,6 +530,7 @@ int scoutfs_data_truncate_items(struct super_block *sb, u64 ino, u64 iblock,
|
||||
struct scoutfs_key_buf last;
|
||||
struct scoutfs_key_buf key;
|
||||
struct native_extent found;
|
||||
struct native_extent first;
|
||||
struct native_extent rng;
|
||||
struct native_extent ext;
|
||||
struct native_extent ofl;
|
||||
@@ -554,7 +555,9 @@ int scoutfs_data_truncate_items(struct super_block *sb, u64 ino, u64 iblock,
|
||||
|
||||
while (rng.blocks) {
|
||||
/* find the next extent that could include our first block */
|
||||
init_extent_key(&key, key_bytes, &rng, ino,
|
||||
first = rng;
|
||||
first.blocks = 1;
|
||||
init_extent_key(&key, key_bytes, &first, ino,
|
||||
SCOUTFS_FILE_EXTENT_TYPE);
|
||||
|
||||
ret = scoutfs_item_next_same(sb, &key, &last, NULL, NULL);
|
||||
|
||||
Reference in New Issue
Block a user