… | |
… | |
195 | |
195 | |
196 | our @AIO_REQ = qw(aio_sendfile aio_read aio_write aio_open aio_close aio_stat |
196 | our @AIO_REQ = qw(aio_sendfile aio_read aio_write aio_open aio_close aio_stat |
197 | aio_lstat aio_unlink aio_rmdir aio_readdir aio_scandir aio_symlink |
197 | aio_lstat aio_unlink aio_rmdir aio_readdir aio_scandir aio_symlink |
198 | aio_readlink aio_fsync aio_fdatasync aio_readahead aio_rename aio_link |
198 | aio_readlink aio_fsync aio_fdatasync aio_readahead aio_rename aio_link |
199 | aio_move aio_copy aio_group aio_nop aio_mknod aio_load aio_rmtree aio_mkdir |
199 | aio_move aio_copy aio_group aio_nop aio_mknod aio_load aio_rmtree aio_mkdir |
200 | aio_chown aio_chmod aio_utime); |
200 | aio_chown aio_chmod aio_utime aio_truncate); |
201 | our @EXPORT = (@AIO_REQ, qw(aioreq_pri aioreq_nice aio_block)); |
201 | our @EXPORT = (@AIO_REQ, qw(aioreq_pri aioreq_nice aio_block)); |
202 | our @EXPORT_OK = qw(poll_fileno poll_cb poll_wait flush |
202 | our @EXPORT_OK = qw(poll_fileno poll_cb poll_wait flush |
203 | min_parallel max_parallel max_idle |
203 | min_parallel max_parallel max_idle |
204 | nreqs nready npending nthreads |
204 | nreqs nready npending nthreads |
205 | max_poll_time max_poll_reqs); |
205 | max_poll_time max_poll_reqs); |
… | |
… | |
324 | |
324 | |
325 | =item aio_read $fh,$offset,$length, $data,$dataoffset, $callback->($retval) |
325 | =item aio_read $fh,$offset,$length, $data,$dataoffset, $callback->($retval) |
326 | |
326 | |
327 | =item aio_write $fh,$offset,$length, $data,$dataoffset, $callback->($retval) |
327 | =item aio_write $fh,$offset,$length, $data,$dataoffset, $callback->($retval) |
328 | |
328 | |
329 | Reads or writes C<length> bytes from the specified C<fh> and C<offset> |
329 | Reads or writes C<$length> bytes from the specified C<$fh> and C<$offset> |
330 | into the scalar given by C<data> and offset C<dataoffset> and calls the |
330 | into the scalar given by C<$data> and offset C<$dataoffset> and calls the |
331 | callback without the actual number of bytes read (or -1 on error, just |
331 | callback without the actual number of bytes read (or -1 on error, just |
332 | like the syscall). If C<offset> is undefined, then the current file offset |
332 | like the syscall). |
|
|
333 | |
|
|
334 | If C<$offset> is undefined, then the current file offset will be used (and |
333 | will be used (and updated), otherwise the file offset will not be changed |
335 | updated), otherwise the file offset will not be changed by these calls. |
334 | by these calls. |
336 | |
|
|
337 | If C<$length> is undefined in C<aio_write>, use the remaining length of C<$data>. |
|
|
338 | |
|
|
339 | If C<$dataoffset> is less than zero, it will be counted from the end of |
|
|
340 | C<$data>. |
335 | |
341 | |
336 | The C<$data> scalar I<MUST NOT> be modified in any way while the request |
342 | The C<$data> scalar I<MUST NOT> be modified in any way while the request |
337 | is outstanding. Modifying it can result in segfaults or World War III (if |
343 | is outstanding. Modifying it can result in segfaults or World War III (if |
338 | the necessary/optional hardware is installed). |
344 | the necessary/optional hardware is installed). |
339 | |
345 | |
… | |
… | |
435 | |
441 | |
436 | # same as "chown root path" in the shell: |
442 | # same as "chown root path" in the shell: |
437 | aio_chown "path", 0, -1; |
443 | aio_chown "path", 0, -1; |
438 | # same as above: |
444 | # same as above: |
439 | aio_chown "path", 0, undef; |
445 | aio_chown "path", 0, undef; |
|
|
446 | |
|
|
447 | |
|
|
448 | =item aio_truncate $fh_or_path, $offset, $callback->($status) |
|
|
449 | |
|
|
450 | Works like truncate(2) or ftruncate(2). |
440 | |
451 | |
441 | |
452 | |
442 | =item aio_chmod $fh_or_path, $mode, $callback->($status) |
453 | =item aio_chmod $fh_or_path, $mode, $callback->($status) |
443 | |
454 | |
444 | Works like perl's C<chmod> function. |
455 | Works like perl's C<chmod> function. |
… | |
… | |
1284 | bytes of memory. In addition, stat requests need a stat buffer (possibly |
1295 | bytes of memory. In addition, stat requests need a stat buffer (possibly |
1285 | a few hundred bytes), readdir requires a result buffer and so on. Perl |
1296 | a few hundred bytes), readdir requires a result buffer and so on. Perl |
1286 | scalars and other data passed into aio requests will also be locked and |
1297 | scalars and other data passed into aio requests will also be locked and |
1287 | will consume memory till the request has entered the done state. |
1298 | will consume memory till the request has entered the done state. |
1288 | |
1299 | |
1289 | This is now awfully much, so queuing lots of requests is not usually a |
1300 | This is not awfully much, so queuing lots of requests is not usually a |
1290 | problem. |
1301 | problem. |
1291 | |
1302 | |
1292 | Per-thread usage: |
1303 | Per-thread usage: |
1293 | |
1304 | |
1294 | In the execution phase, some aio requests require more memory for |
1305 | In the execution phase, some aio requests require more memory for |