--- IO-AIO/AIO.xs 2012/07/27 17:24:06 1.217 +++ IO-AIO/AIO.xs 2012/07/27 17:54:40 1.218 @@ -169,9 +169,9 @@ #if HAVE_FIEMAP int count = req->int3; - /* heuristic: first try with 64 extents if we don't know how many, */ + /* heuristic: first try with 72 extents if we don't know how many, */ /* as most files have (hopefully) fewer than this many extents */ - /* in fact, most should have <= 2, so maybe the 72 below is probably overkill */ + /* in fact, most should have <= 2, so the 72 below is probably overkill */ if (count < 0) count = 72; /* for what it's worth, 72 extents fit nicely into 4kb */ @@ -196,6 +196,9 @@ if (req->int3 >= 0) break; /* when not autosizing we are done */ + if (!fiemap->fm_mapped_extents) + break; /* if file has no segments, we are done */ + if (fiemap->fm_extents [fiemap->fm_mapped_extents - 1].fe_flags & FIEMAP_EXTENT_LAST) break; /* autosizing successful, we are done */