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.225 by root, Sat Dec 29 09:35:39 2012 UTC vs.
Revision 1.226 by root, Sun Jan 6 11:48:14 2013 UTC

198 || !fiemap->fm_mapped_extents /* no more extents */ 198 || !fiemap->fm_mapped_extents /* no more extents */
199 || fiemap->fm_extents [fiemap->fm_mapped_extents - 1].fe_flags & FIEMAP_EXTENT_LAST /* hit eof */) 199 || fiemap->fm_extents [fiemap->fm_mapped_extents - 1].fe_flags & FIEMAP_EXTENT_LAST /* hit eof */)
200 goto done; 200 goto done;
201 201
202 /* else we have to loop - 202 /* else we have to loop -
203 * it would be tempting (atcually I tried that first) to just query the 203 * it would be tempting (actually I tried that first) to just query the
204 * number of extents needed, but linux often feels like not returning all 204 * number of extents needed, but linux often feels like not returning all
205 * extents, without telling us it left any out. this complicates 205 * extents, without telling us it left any out. this complicates
206 * this quite a bit. 206 * this quite a bit.
207 */ 207 */
208 208
220 incmap->fm_flags = fiemap->fm_flags; 220 incmap->fm_flags = fiemap->fm_flags;
221 incmap->fm_extent_count = (sizeof (scratch) - sizeof (struct fiemap)) / sizeof (struct fiemap_extent); 221 incmap->fm_extent_count = (sizeof (scratch) - sizeof (struct fiemap)) / sizeof (struct fiemap_extent);
222 222
223 if (ioctl (req->int1, FS_IOC_FIEMAP, incmap) < 0) 223 if (ioctl (req->int1, FS_IOC_FIEMAP, incmap) < 0)
224 return; 224 return;
225
226 if (!incmap->fm_mapped_extents)
227 goto done;
225 228
226 count = fiemap->fm_mapped_extents + incmap->fm_mapped_extents; 229 count = fiemap->fm_mapped_extents + incmap->fm_mapped_extents;
227 fiemap = realloc (fiemap, sizeof (*fiemap) + sizeof (struct fiemap_extent) * count); 230 fiemap = realloc (fiemap, sizeof (*fiemap) + sizeof (struct fiemap_extent) * count);
228 errno = ENOMEM; 231 errno = ENOMEM;
229 if (!fiemap) 232 if (!fiemap)

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines