Lines Matching defs:extent
156 static void dbg_print_extent(char *desc, struct ext2fs_extent *extent)
160 printf("extent: lblk %llu--%llu, len %u, pblk %llu, flags: ",
161 extent->e_lblk, extent->e_lblk + extent->e_len - 1,
162 extent->e_len, extent->e_pblk);
163 if (extent->e_flags & EXT2_EXTENT_FLAGS_LEAF)
165 if (extent->e_flags & EXT2_EXTENT_FLAGS_UNINIT)
167 if (extent->e_flags & EXT2_EXTENT_FLAGS_SECOND_VISIT)
169 if (!extent->e_flags)
253 struct ext2fs_extent extent;
264 * Find the extent closest to the start of the punch range. We don't
266 * next-lowest extent if 'start' is in a hole, and doesn't set a
267 * current node if there was a real error reading the extent tree.
275 retval = ext2fs_extent_get(handle, EXT2_EXTENT_CURRENT, &extent);
283 dbg_print_extent("main loop", &extent);
284 next = extent.e_lblk + extent.e_len;
289 if (start <= extent.e_lblk) {
290 if (end < extent.e_lblk)
293 /* Start of deleted region before extent;
294 adjust beginning of extent */
295 free_start = extent.e_pblk;
296 lfree_start = extent.e_lblk;
298 free_count = end - extent.e_lblk + 1;
300 free_count = extent.e_len;
301 extent.e_len -= free_count;
302 extent.e_lblk += free_count;
303 extent.e_pblk += free_count;
307 /* End of deleted region after extent;
308 adjust end of extent */
310 newlen = start - extent.e_lblk;
311 free_start = extent.e_pblk + newlen;
312 lfree_start = extent.e_lblk + newlen;
313 free_count = extent.e_len - newlen;
314 extent.e_len = newlen;
319 /* The hard case; we need to split the extent */
320 newex.e_pblk = extent.e_pblk +
321 (end + 1 - extent.e_lblk);
324 newex.e_flags = extent.e_flags;
326 extent.e_len = start - extent.e_lblk;
327 free_start = extent.e_pblk + extent.e_len;
328 lfree_start = extent.e_lblk + extent.e_len;
336 /* Now pointing at inserted extent; so go back */
343 if (extent.e_len) {
344 dbg_print_extent("replacing", &extent);
345 retval = ext2fs_extent_replace(handle, 0, &extent);
349 dbg_printf("deleting current extent%s\n", "");
353 * back to the current extent.
375 /* Now delete the extent. */
380 /* Jump forward to the next extent. */
394 &extent);