Merge
This commit is contained in:
17
src/ioutil.c
17
src/ioutil.c
@@ -28,7 +28,8 @@ int build_allocation_map(struct bitset_mapping* allocation_map, int fd)
|
|||||||
|
|
||||||
memset(&fiemap_static, 0, sizeof(fiemap_static));
|
memset(&fiemap_static, 0, sizeof(fiemap_static));
|
||||||
|
|
||||||
for (offset = 0; offset < allocation_map->size; offset += fiemap->fm_length) {
|
for (offset = 0; offset < allocation_map->size; ) {
|
||||||
|
|
||||||
unsigned int i;
|
unsigned int i;
|
||||||
|
|
||||||
fiemap->fm_start = offset;
|
fiemap->fm_start = offset;
|
||||||
@@ -54,6 +55,20 @@ int build_allocation_map(struct bitset_mapping* allocation_map, int fd)
|
|||||||
fiemap->fm_extents[i].fe_logical,
|
fiemap->fm_extents[i].fe_logical,
|
||||||
fiemap->fm_extents[i].fe_length );
|
fiemap->fm_extents[i].fe_length );
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
/* must move the offset on, but careful not to jump max_length
|
||||||
|
* if we've actually hit max_offsets.
|
||||||
|
*/
|
||||||
|
if (fiemap->fm_mapped_extents > 0) {
|
||||||
|
struct fiemap_extent *last = &fiemap->fm_extents[
|
||||||
|
fiemap->fm_mapped_extents-1
|
||||||
|
];
|
||||||
|
offset += last->fe_logical + last->fe_length;
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
offset += fiemap->fm_length;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Reference in New Issue
Block a user