--- IO-AIO/AIO.pm 2012/05/28 17:00:19 1.226 +++ IO-AIO/AIO.pm 2012/08/13 01:01:04 1.233 @@ -204,8 +204,8 @@ =head2 QUICK OVERVIEW -This section simply lists the prototypes of the most important functions -for quick reference. See the following sections for function-by-function +This section simply lists the prototypes most of the functions for +quick reference. See the following sections for function-by-function documentation. aio_wd $pathname, $callback->($wd) @@ -223,6 +223,8 @@ aio_chown $fh_or_path, $uid, $gid, $callback->($status) aio_chmod $fh_or_path, $mode, $callback->($status) aio_truncate $fh_or_path, $offset, $callback->($status) + aio_allocate $fh, $mode, $offset, $len, $callback->($status) + aio_fiemap $fh, $start, $length, $flags, $count, $cb->(\@extents) aio_unlink $pathname, $callback->($status) aio_mknod $pathname, $mode, $dev, $callback->($status) aio_link $srcpath, $dstpath, $callback->($status) @@ -362,7 +364,7 @@ =item aio_open $pathname, $flags, $mode, $callback->($fh) Asynchronously open or create a file and call the callback with a newly -created filehandle for the file. +created filehandle for the file (or C in case of an error). The pathname passed to C must be absolute. See API NOTES, above, for an explanation. @@ -640,6 +642,22 @@ Works like truncate(2) or ftruncate(2). +=item aio_allocate $fh, $mode, $offset, $len, $callback->($status) + +Allocates or freed disk space according to the C<$mode> argument. See the +linux C docuemntation for details. + +C<$mode> can currently be C<0> or C +to allocate space, or C, to deallocate a file range. + +The file system block size used by C is presumably the +C returned by C. + +If C isn't available or cannot be emulated (currently no +emulation will be attempted), passes C<-1> and sets C<$!> to C. + + =item aio_chmod $fh_or_path, $mode, $callback->($status) Works like perl's C function. @@ -1263,7 +1281,7 @@ Queries the extents of the given file (by calling the Linux FIEMAP ioctl, see L for details). If the -C is not available on your OS, then this rquiest will fail with +C is not available on your OS, then this request will fail with C. C<$start> is the starting offset to query extents for, C<$length> is the @@ -1276,9 +1294,9 @@ the data portion. C<$count> is the maximum number of extent records to return. If it is -C, then IO::AIO queries all extents of the file. As a very special +C, then IO::AIO queries all extents of the range. As a very special case, if it is C<0>, then the callback receives the number of extents -instead of the extents themselves. +instead of the extents themselves (which is unreliable, see below). If an error occurs, the callback receives no arguments. The special C value C is available to test for flag errors. @@ -1290,7 +1308,7 @@ [$logical, $physical, $length, $flags] Flags is any combination of the following flag values (typically either C<0> -or C): +or C (1)): C, C, C, C, @@ -1299,6 +1317,11 @@ C, C or C. +At the time of this writing (Linux 3.2), this requets is unreliable unless +C<$count> is C, as the kernel has all sorts of bugs preventing +it to return all extents of a range for files with large number of +extents. The code works around all these issues if C<$count> is undef. + =item aio_group $callback->(...) This is a very special aio request: Instead of doing something, it is a @@ -1910,7 +1933,8 @@ =item IO::AIO::mmap $scalar, $length, $prot, $flags, $fh[, $offset] Memory-maps a file (or anonymous memory range) and attaches it to the -given C<$scalar>, which will act like a string scalar. +given C<$scalar>, which will act like a string scalar. Returns true on +success, and false otherwise. The only operations allowed on the scalar are C/C that don't change the string length, and most read-only operations such as copying it @@ -1979,6 +2003,9 @@ C<$w_off> are C, then C is passed for these, otherwise they should be the file offset. +C<$r_fh> and C<$w_fh> should not refer to the same file, as splice might +silently corrupt the data in this case. + The following symbol flag values are available: C, C, C and C.