… | |
… | |
362 | |
362 | |
363 | |
363 | |
364 | =item aio_open $pathname, $flags, $mode, $callback->($fh) |
364 | =item aio_open $pathname, $flags, $mode, $callback->($fh) |
365 | |
365 | |
366 | Asynchronously open or create a file and call the callback with a newly |
366 | Asynchronously open or create a file and call the callback with a newly |
367 | created filehandle for the file. |
367 | created filehandle for the file (or C<undef> in case of an error). |
368 | |
368 | |
369 | The pathname passed to C<aio_open> must be absolute. See API NOTES, above, |
369 | The pathname passed to C<aio_open> must be absolute. See API NOTES, above, |
370 | for an explanation. |
370 | for an explanation. |
371 | |
371 | |
372 | The C<$flags> argument is a bitmask. See the C<Fcntl> module for a |
372 | The C<$flags> argument is a bitmask. See the C<Fcntl> module for a |
… | |
… | |
1277 | |
1277 | |
1278 | aio_mlockall IO::AIO::MCL_FUTURE; |
1278 | aio_mlockall IO::AIO::MCL_FUTURE; |
1279 | |
1279 | |
1280 | =item aio_fiemap $fh, $start, $length, $flags, $count, $cb->(\@extents) |
1280 | =item aio_fiemap $fh, $start, $length, $flags, $count, $cb->(\@extents) |
1281 | |
1281 | |
1282 | Queries the extents of the given file (by calling the Linux FIEMAP ioctl, |
1282 | Queries the extents of the given file (by calling the Linux C<FIEMAP> |
1283 | see L<http://cvs.schmorp.de/IO-AIO/doc/fiemap.txt> for details). If the |
1283 | ioctl, see L<http://cvs.schmorp.de/IO-AIO/doc/fiemap.txt> for details). If |
1284 | C<ioctl> is not available on your OS, then this request will fail with |
1284 | the ioctl is not available on your OS, then this request will fail with |
1285 | C<ENOSYS>. |
1285 | C<ENOSYS>. |
1286 | |
1286 | |
1287 | C<$start> is the starting offset to query extents for, C<$length> is the |
1287 | C<$start> is the starting offset to query extents for, C<$length> is the |
1288 | size of the range to query - if it is C<undef>, then the whole file will |
1288 | size of the range to query - if it is C<undef>, then the whole file will |
1289 | be queried. |
1289 | be queried. |
… | |
… | |
1292 | C<IO::AIO::FIEMAP_FLAG_XATTR> - C<IO::AIO::FIEMAP_FLAGS_COMPAT> is also |
1292 | C<IO::AIO::FIEMAP_FLAG_XATTR> - C<IO::AIO::FIEMAP_FLAGS_COMPAT> is also |
1293 | exported), and is normally C<0> or C<IO::AIO::FIEMAP_FLAG_SYNC> to query |
1293 | exported), and is normally C<0> or C<IO::AIO::FIEMAP_FLAG_SYNC> to query |
1294 | the data portion. |
1294 | the data portion. |
1295 | |
1295 | |
1296 | C<$count> is the maximum number of extent records to return. If it is |
1296 | C<$count> is the maximum number of extent records to return. If it is |
1297 | C<undef>, then IO::AIO queries all extents of the file. As a very special |
1297 | C<undef>, then IO::AIO queries all extents of the range. As a very special |
1298 | case, if it is C<0>, then the callback receives the number of extents |
1298 | case, if it is C<0>, then the callback receives the number of extents |
1299 | instead of the extents themselves. |
1299 | instead of the extents themselves (which is unreliable, see below). |
1300 | |
1300 | |
1301 | If an error occurs, the callback receives no arguments. The special |
1301 | If an error occurs, the callback receives no arguments. The special |
1302 | C<errno> value C<IO::AIO::EBADR> is available to test for flag errors. |
1302 | C<errno> value C<IO::AIO::EBADR> is available to test for flag errors. |
1303 | |
1303 | |
1304 | Otherwise, the callback receives an array reference with extent |
1304 | Otherwise, the callback receives an array reference with extent |
… | |
… | |
1314 | C<IO::AIO::FIEMAP_EXTENT_DELALLOC>, C<IO::AIO::FIEMAP_EXTENT_ENCODED>, |
1314 | C<IO::AIO::FIEMAP_EXTENT_DELALLOC>, C<IO::AIO::FIEMAP_EXTENT_ENCODED>, |
1315 | C<IO::AIO::FIEMAP_EXTENT_DATA_ENCRYPTED>, C<IO::AIO::FIEMAP_EXTENT_NOT_ALIGNED>, |
1315 | C<IO::AIO::FIEMAP_EXTENT_DATA_ENCRYPTED>, C<IO::AIO::FIEMAP_EXTENT_NOT_ALIGNED>, |
1316 | C<IO::AIO::FIEMAP_EXTENT_DATA_INLINE>, C<IO::AIO::FIEMAP_EXTENT_DATA_TAIL>, |
1316 | C<IO::AIO::FIEMAP_EXTENT_DATA_INLINE>, C<IO::AIO::FIEMAP_EXTENT_DATA_TAIL>, |
1317 | C<IO::AIO::FIEMAP_EXTENT_UNWRITTEN>, C<IO::AIO::FIEMAP_EXTENT_MERGED> or |
1317 | C<IO::AIO::FIEMAP_EXTENT_UNWRITTEN>, C<IO::AIO::FIEMAP_EXTENT_MERGED> or |
1318 | C<IO::AIO::FIEMAP_EXTENT_SHARED>. |
1318 | C<IO::AIO::FIEMAP_EXTENT_SHARED>. |
|
|
1319 | |
|
|
1320 | At the time of this writing (Linux 3.2), this requets is unreliable unless |
|
|
1321 | C<$count> is C<undef>, as the kernel has all sorts of bugs preventing |
|
|
1322 | it to return all extents of a range for files with large number of |
|
|
1323 | extents. The code works around all these issues if C<$count> is undef. |
1319 | |
1324 | |
1320 | =item aio_group $callback->(...) |
1325 | =item aio_group $callback->(...) |
1321 | |
1326 | |
1322 | This is a very special aio request: Instead of doing something, it is a |
1327 | This is a very special aio request: Instead of doing something, it is a |
1323 | container for other aio requests, which is useful if you want to bundle |
1328 | container for other aio requests, which is useful if you want to bundle |