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.214 by root, Mon May 28 17:00:19 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;
983 const_eio (SYNC_FILE_RANGE_WAIT_BEFORE) 986 const_eio (SYNC_FILE_RANGE_WAIT_BEFORE)
984 const_eio (SYNC_FILE_RANGE_WRITE) 987 const_eio (SYNC_FILE_RANGE_WRITE)
985 const_eio (SYNC_FILE_RANGE_WAIT_AFTER) 988 const_eio (SYNC_FILE_RANGE_WAIT_AFTER)
986 989
987 const_eio (FALLOC_FL_KEEP_SIZE) 990 const_eio (FALLOC_FL_KEEP_SIZE)
991 const_eio (FALLOC_FL_PUNCH_HOLE)
988 992
989 const_eio (READDIR_DENTS) 993 const_eio (READDIR_DENTS)
990 const_eio (READDIR_DIRS_FIRST) 994 const_eio (READDIR_DIRS_FIRST)
991 const_eio (READDIR_STAT_ORDER) 995 const_eio (READDIR_STAT_ORDER)
992 const_eio (READDIR_FOUND_UNKNOWN) 996 const_eio (READDIR_FOUND_UNKNOWN)
1215 } 1219 }
1216 else 1220 else
1217 { 1221 {
1218 /* read: check type and grow scalar as necessary */ 1222 /* read: check type and grow scalar as necessary */
1219 SvUPGRADE (data, SVt_PV); 1223 SvUPGRADE (data, SVt_PV);
1224 if (SvLEN (data) >= SvCUR (data))
1220 svptr = SvGROW (data, len + dataoffset + 1); 1225 svptr = SvGROW (data, len + dataoffset + 1);
1226 else if (SvCUR (data) < len + dataoffset)
1227 croak ("length + dataoffset outside of scalar, and cannot grow");
1221 } 1228 }
1222 1229
1223 { 1230 {
1224 dREQ; 1231 dREQ;
1225 1232
1528 1535
1529void 1536void
1530aio_fiemap (SV *fh, off_t start, SV *length, U32 flags, SV *count, SV *callback=&PL_sv_undef) 1537aio_fiemap (SV *fh, off_t start, SV *length, U32 flags, SV *count, SV *callback=&PL_sv_undef)
1531 PPCODE: 1538 PPCODE:
1532{ 1539{
1533 int fd = s_fileno_croak (fh, 0); 1540 int fd = s_fileno_croak (fh, 0);
1534 dREQ; 1541 dREQ;
1535 1542
1536 req->type = EIO_CUSTOM; 1543 req->type = EIO_CUSTOM;
1537 req->sv1 = newSVsv (fh); 1544 req->sv1 = newSVsv (fh);
1538 req->int1 = fd; 1545 req->int1 = fd;

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines