… | |
… | |
344 | int count = req->int3; |
344 | int count = req->int3; |
345 | |
345 | |
346 | req->flags |= EIO_FLAG_PTR1_FREE; |
346 | req->flags |= EIO_FLAG_PTR1_FREE; |
347 | |
347 | |
348 | /* heuristic: start with 512 bytes (8 extents), and if that isn't enough, */ |
348 | /* heuristic: start with 512 bytes (8 extents), and if that isn't enough, */ |
349 | /* increase in 3.5kb steps */ |
349 | /* increase in fixed steps */ |
350 | if (count < 0) |
350 | if (count < 0) |
351 | count = 8; |
351 | count = 8; |
352 | |
352 | |
353 | fiemap = malloc (sizeof (*fiemap) + sizeof (struct fiemap_extent) * count); |
353 | fiemap = malloc (sizeof (*fiemap) + sizeof (struct fiemap_extent) * count); |
354 | errno = ENOMEM; |
354 | errno = ENOMEM; |
… | |
… | |
407 | |
407 | |
408 | for (count = 0; count < incmap->fm_mapped_extents; ++count) |
408 | for (count = 0; count < incmap->fm_mapped_extents; ++count) |
409 | { |
409 | { |
410 | struct fiemap_extent *e = incmap->fm_extents + count; |
410 | struct fiemap_extent *e = incmap->fm_extents + count; |
411 | |
411 | |
|
|
412 | fiemap->fm_extents [fiemap->fm_mapped_extents++] = *e; |
|
|
413 | |
412 | if (e->fe_logical + e->fe_length >= end_offset) |
414 | if (e->fe_logical + e->fe_length >= end_offset) |
413 | goto done; |
415 | goto done; |
414 | |
|
|
415 | fiemap->fm_extents [fiemap->fm_mapped_extents++] = *e; |
|
|
416 | |
416 | |
417 | if (e->fe_flags & FIEMAP_EXTENT_LAST) |
417 | if (e->fe_flags & FIEMAP_EXTENT_LAST) |
418 | goto done; |
418 | goto done; |
419 | |
419 | |
420 | } |
420 | } |