ViewVC Help
View File | Revision Log | Show Annotations | Download File
/cvs/IO-AIO/AIO.xs
(Generate patch)

Comparing IO-AIO/AIO.xs (file contents):
Revision 1.217 by root, Fri Jul 27 17:24:06 2012 UTC vs.
Revision 1.218 by root, Fri Jul 27 17:54:40 2012 UTC

167 req->result = -1; 167 req->result = -1;
168 168
169#if HAVE_FIEMAP 169#if HAVE_FIEMAP
170 int count = req->int3; 170 int count = req->int3;
171 171
172 /* heuristic: first try with 64 extents if we don't know how many, */ 172 /* heuristic: first try with 72 extents if we don't know how many, */
173 /* as most files have (hopefully) fewer than this many extents */ 173 /* as most files have (hopefully) fewer than this many extents */
174 /* in fact, most should have <= 2, so maybe the 72 below is probably overkill */ 174 /* in fact, most should have <= 2, so the 72 below is probably overkill */
175 if (count < 0) 175 if (count < 0)
176 count = 72; /* for what it's worth, 72 extents fit nicely into 4kb */ 176 count = 72; /* for what it's worth, 72 extents fit nicely into 4kb */
177 177
178 for (;;) 178 for (;;)
179 { 179 {
193 if (ioctl (req->int1, FS_IOC_FIEMAP, fiemap)) 193 if (ioctl (req->int1, FS_IOC_FIEMAP, fiemap))
194 return; 194 return;
195 195
196 if (req->int3 >= 0) 196 if (req->int3 >= 0)
197 break; /* when not autosizing we are done */ 197 break; /* when not autosizing we are done */
198
199 if (!fiemap->fm_mapped_extents)
200 break; /* if file has no segments, we are done */
198 201
199 if (fiemap->fm_extents [fiemap->fm_mapped_extents - 1].fe_flags & FIEMAP_EXTENT_LAST) 202 if (fiemap->fm_extents [fiemap->fm_mapped_extents - 1].fe_flags & FIEMAP_EXTENT_LAST)
200 break; /* autosizing successful, we are done */ 203 break; /* autosizing successful, we are done */
201 204
202 fiemap->fm_flags = req->int2; 205 fiemap->fm_flags = req->int2;

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines