Commit 24bf14c7 authored by Alessandro Ghedini's avatar Alessandro Ghedini

Imported Upstream version 4.18

parent ed0376cf
......@@ -170,12 +170,12 @@ use common::sense;
use base 'Exporter';
BEGIN {
our $VERSION = '4.15';
our $VERSION = '4.18';
our @AIO_REQ = qw(aio_sendfile aio_seek aio_read aio_write aio_open aio_close
aio_stat aio_lstat aio_unlink aio_rmdir aio_readdir aio_readdirx
aio_scandir aio_symlink aio_readlink aio_realpath aio_sync
aio_fsync aio_syncfs aio_fdatasync aio_sync_file_range aio_fallocate
aio_fsync aio_syncfs aio_fdatasync aio_sync_file_range aio_allocate
aio_pathsync aio_readahead aio_fiemap
aio_rename aio_link aio_move aio_copy aio_group
aio_nop aio_mknod aio_load aio_rmtree aio_mkdir aio_chown
......@@ -204,8 +204,8 @@ BEGIN {
=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 @@ documentation.
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)
......@@ -274,6 +276,8 @@ documentation.
IO::AIO::sendfile $ofh, $ifh, $offset, $count
IO::AIO::fadvise $fh, $offset, $len, $advice
IO::AIO::mmap $scalar, $length, $prot, $flags[, $fh[, $offset]]
IO::AIO::munmap $scalar
IO::AIO::madvise $scalar, $offset, $length, $advice
IO::AIO::mprotect $scalar, $offset, $length, $protect
IO::AIO::munlock $scalar, $offset = 0, $length = undef
......@@ -360,7 +364,7 @@ priority, so the effect is cumulative.
=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<undef> in case of an error).
The pathname passed to C<aio_open> must be absolute. See API NOTES, above,
for an explanation.
......@@ -601,6 +605,87 @@ Example: stat C</wd> and dump out the data if successful.
fsid => 1810
}
Here is a (likely partial) list of fsid values used by Linux - it is safe
to hardcode these when the $^O is C<linux>:
0x0000adf5 adfs
0x0000adff affs
0x5346414f afs
0x09041934 anon-inode filesystem
0x00000187 autofs
0x42465331 befs
0x1badface bfs
0x42494e4d binfmt_misc
0x9123683e btrfs
0x0027e0eb cgroupfs
0xff534d42 cifs
0x73757245 coda
0x012ff7b7 coh
0x28cd3d45 cramfs
0x453dcd28 cramfs-wend (wrong endianness)
0x64626720 debugfs
0x00001373 devfs
0x00001cd1 devpts
0x0000f15f ecryptfs
0x00414a53 efs
0x0000137d ext
0x0000ef53 ext2/ext3
0x0000ef51 ext2
0x00004006 fat
0x65735546 fuseblk
0x65735543 fusectl
0x0bad1dea futexfs
0x01161970 gfs2
0x47504653 gpfs
0x00004244 hfs
0xf995e849 hpfs
0x958458f6 hugetlbfs
0x2bad1dea inotifyfs
0x00009660 isofs
0x000072b6 jffs2
0x3153464a jfs
0x6b414653 k-afs
0x0bd00bd0 lustre
0x0000137f minix
0x0000138f minix 30 char names
0x00002468 minix v2
0x00002478 minix v2 30 char names
0x00004d5a minix v3
0x19800202 mqueue
0x00004d44 msdos
0x0000564c novell
0x00006969 nfs
0x6e667364 nfsd
0x00003434 nilfs
0x5346544e ntfs
0x00009fa1 openprom
0x7461636F ocfs2
0x00009fa0 proc
0x6165676c pstorefs
0x0000002f qnx4
0x858458f6 ramfs
0x52654973 reiserfs
0x00007275 romfs
0x67596969 rpc_pipefs
0x73636673 securityfs
0xf97cff8c selinux
0x0000517b smb
0x534f434b sockfs
0x73717368 squashfs
0x62656572 sysfs
0x012ff7b6 sysv2
0x012ff7b5 sysv4
0x01021994 tmpfs
0x15013346 udf
0x00011954 ufs
0x54190100 ufs byteswapped
0x00009fa2 usbdevfs
0x01021997 v9fs
0xa501fcf5 vxfs
0xabba1974 xenfs
0x012ff7b4 xenix
0x58465342 xfs
0x012fd16d xia
=item aio_utime $fh_or_path, $atime, $mtime, $callback->($status)
......@@ -638,6 +723,22 @@ Examples:
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<fallocate> docuemntation for details.
C<$mode> can currently be C<0> or C<IO::AIO::FALLOC_FL_KEEP_SIZE>
to allocate space, or C<IO::AIO::FALLOC_FL_PUNCH_HOLE |
IO::AIO::FALLOC_FL_KEEP_SIZE>, to deallocate a file range.
The file system block size used by C<fallocate> is presumably the
C<f_bsize> returned by C<statvfs>.
If C<fallocate> isn't available or cannot be emulated (currently no
emulation will be attempted), passes C<-1> and sets C<$!> to C<ENOSYS>.
=item aio_chmod $fh_or_path, $mode, $callback->($status)
Works like perl's C<chmod> function.
......@@ -1259,9 +1360,9 @@ Example: asynchronously lock all current and future pages into memory.
=item aio_fiemap $fh, $start, $length, $flags, $count, $cb->(\@extents)
Queries the extents of the given file (by calling the Linux FIEMAP ioctl,
see L<http://cvs.schmorp.de/IO-AIO/doc/fiemap.txt> for details). If the
C<ioctl> is not available on your OS, then this rquiest will fail with
Queries the extents of the given file (by calling the Linux C<FIEMAP>
ioctl, see L<http://cvs.schmorp.de/IO-AIO/doc/fiemap.txt> for details). If
the ioctl is not available on your OS, then this request will fail with
C<ENOSYS>.
C<$start> is the starting offset to query extents for, C<$length> is the
......@@ -1274,9 +1375,9 @@ exported), and is normally C<0> or C<IO::AIO::FIEMAP_FLAG_SYNC> to query
the data portion.
C<$count> is the maximum number of extent records to return. If it is
C<undef>, then IO::AIO queries all extents of the file. As a very special
C<undef>, 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<errno> value C<IO::AIO::EBADR> is available to test for flag errors.
......@@ -1288,7 +1389,7 @@ following members:
[$logical, $physical, $length, $flags]
Flags is any combination of the following flag values (typically either C<0>
or C<IO::AIO::FIEMAP_EXTENT_LAST>):
or C<IO::AIO::FIEMAP_EXTENT_LAST> (1)):
C<IO::AIO::FIEMAP_EXTENT_LAST>, C<IO::AIO::FIEMAP_EXTENT_UNKNOWN>,
C<IO::AIO::FIEMAP_EXTENT_DELALLOC>, C<IO::AIO::FIEMAP_EXTENT_ENCODED>,
......@@ -1297,6 +1398,11 @@ C<IO::AIO::FIEMAP_EXTENT_DATA_INLINE>, C<IO::AIO::FIEMAP_EXTENT_DATA_TAIL>,
C<IO::AIO::FIEMAP_EXTENT_UNWRITTEN>, C<IO::AIO::FIEMAP_EXTENT_MERGED> or
C<IO::AIO::FIEMAP_EXTENT_SHARED>.
At the time of this writing (Linux 3.2), this requets is unreliable unless
C<$count> is C<undef>, 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
......@@ -1908,7 +2014,8 @@ ENOSYS, otherwise the return value of C<mprotect>.
=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<substr>/C<vec> that don't
change the string length, and most read-only operations such as copying it
......@@ -1977,6 +2084,9 @@ Calls the GNU/Linux C<splice(2)> syscall, if available. If C<$r_off> or
C<$w_off> are C<undef>, then C<NULL> 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<IO::AIO::SPLICE_F_MOVE>,
C<IO::AIO::SPLICE_F_NONBLOCK>, C<IO::AIO::SPLICE_F_MORE> and
C<IO::AIO::SPLICE_F_GIFT>.
......
......@@ -167,49 +167,86 @@ fiemap (eio_req *req)
req->result = -1;
#if HAVE_FIEMAP
/* assume some c99 */
struct fiemap *fiemap = 0;
size_t end_offset;
int count = req->int3;
/* heuristic: first try with 64 extents if we don't know how many, */
/* as most files have (hopefully) fewer than this many extents */
/* in fact, most should have <= 2, so maybe the 72 below is probably overkill */
req->flags |= EIO_FLAG_PTR1_FREE;
/* heuristic: start with 512 bytes (8 extents), and if that isn't enough, */
/* increase in 3.5kb steps */
if (count < 0)
count = 72; /* for what it's worth, 72 extents fit nicely into 4kb */
count = 8;
fiemap = malloc (sizeof (*fiemap) + sizeof (struct fiemap_extent) * count);
errno = ENOMEM;
if (!fiemap)
return;
req->ptr1 = fiemap;
fiemap->fm_start = req->offs;
fiemap->fm_length = req->size;
fiemap->fm_flags = req->int2;
fiemap->fm_extent_count = count;
if (ioctl (req->int1, FS_IOC_FIEMAP, fiemap) < 0)
return;
if (req->int3 >= 0 /* not autosizing */
|| !fiemap->fm_mapped_extents /* no more extents */
|| fiemap->fm_extents [fiemap->fm_mapped_extents - 1].fe_flags & FIEMAP_EXTENT_LAST /* hit eof */)
goto done;
/* else we have to loop -
* it would be tempting (atcually I tried that first) to just query the
* number of extents needed, but linux often feels like not returning all
* extents, without telling us it left any out. this complicates
* this quite a bit.
*/
end_offset = fiemap->fm_length + (fiemap->fm_length == FIEMAP_MAX_OFFSET ? 0 : fiemap->fm_start);
for (;;)
{
struct fiemap *fiemap = malloc (sizeof (*fiemap) + sizeof (struct fiemap_extent) * count);
errno = ENOMEM;
if (!fiemap)
return;
/* we go in 54 extent steps - 3kb, in the hope that this fits nicely on the eio stack (normally 16+ kb) */
char scratch[3072];
struct fiemap *incmap = (struct fiemap *)scratch;
req->ptr1 = fiemap;
req->flags |= EIO_FLAG_PTR1_FREE;
incmap->fm_start = fiemap->fm_extents [fiemap->fm_mapped_extents - 1].fe_logical
+ fiemap->fm_extents [fiemap->fm_mapped_extents - 1].fe_length;
incmap->fm_length = fiemap->fm_length - (incmap->fm_start - fiemap->fm_start);
incmap->fm_flags = fiemap->fm_flags;
incmap->fm_extent_count = (sizeof (scratch) - sizeof (struct fiemap)) / sizeof (struct fiemap_extent);
fiemap->fm_start = req->offs;
fiemap->fm_length = req->size;
fiemap->fm_flags = req->int2;
fiemap->fm_extent_count = count;
if (ioctl (req->int1, FS_IOC_FIEMAP, incmap) < 0)
return;
if (ioctl (req->int1, FS_IOC_FIEMAP, fiemap))
count = fiemap->fm_mapped_extents + incmap->fm_mapped_extents;
fiemap = realloc (fiemap, sizeof (*fiemap) + sizeof (struct fiemap_extent) * count);
errno = ENOMEM;
if (!fiemap)
return;
if (req->int3 >= 0)
break; /* when not autosizing we are done */
req->ptr1 = fiemap;
if (fiemap->fm_extents [fiemap->fm_mapped_extents - 1].fe_flags & FIEMAP_EXTENT_LAST)
break; /* autosizing successful, we are done */
for (count = 0; count < incmap->fm_mapped_extents; ++count)
{
struct fiemap_extent *e = incmap->fm_extents + count;
fiemap->fm_flags = req->int2;
fiemap->fm_extent_count = 0;
if (e->fe_logical + e->fe_length >= end_offset)
goto done;
if (ioctl (req->int1, FS_IOC_FIEMAP, fiemap))
return;
fiemap->fm_extents [fiemap->fm_mapped_extents++] = *e;
count = fiemap->fm_mapped_extents;
if (e->fe_flags & FIEMAP_EXTENT_LAST)
goto done;
free (fiemap);
}
}
done:
req->result = 0;
#else
......@@ -472,6 +509,11 @@ req_invoke (eio_req *req)
{
EIO_STRUCT_STATVFS *f = EIO_STATVFS_BUF (req);
HV *hv = newHV ();
/* POSIX requires fsid to be unsigned long, but AIX in its infinite wisdom
* chooses to make it a struct.
*/
unsigned long fsid = 0;
memcpy (&fsid, &f->f_fsid, sizeof (unsigned long) < sizeof (f->f_fsid) ? sizeof (unsigned long) : sizeof (f->f_fsid));
rv = sv_2mortal (newRV_noinc ((SV *)hv));
......@@ -483,7 +525,7 @@ req_invoke (eio_req *req)
hv_store (hv, "files" , sizeof ("files" ) - 1, newSVval64 (f->f_files ), 0);
hv_store (hv, "ffree" , sizeof ("ffree" ) - 1, newSVval64 (f->f_ffree ), 0);
hv_store (hv, "favail" , sizeof ("favail" ) - 1, newSVval64 (f->f_favail ), 0);
hv_store (hv, "fsid" , sizeof ("fsid" ) - 1, newSVval64 (f->f_fsid ), 0);
hv_store (hv, "fsid" , sizeof ("fsid" ) - 1, newSVval64 (fsid ), 0);
hv_store (hv, "flag" , sizeof ("flag" ) - 1, newSVval64 (f->f_flag ), 0);
hv_store (hv, "namemax", sizeof ("namemax") - 1, newSVval64 (f->f_namemax), 0);
}
......@@ -985,6 +1027,7 @@ BOOT:
const_eio (SYNC_FILE_RANGE_WAIT_AFTER)
const_eio (FALLOC_FL_KEEP_SIZE)
const_eio (FALLOC_FL_PUNCH_HOLE)
const_eio (READDIR_DENTS)
const_eio (READDIR_DIRS_FIRST)
......@@ -1095,7 +1138,7 @@ aio_fsync (SV *fh, SV *callback=&PL_sv_undef)
aio_syncfs = EIO_SYNCFS
PPCODE:
{
int fd = s_fileno_croak (fh, 0);
int fd = s_fileno_croak (fh, 0);
dREQ;
req->type = ix;
......@@ -1109,7 +1152,7 @@ void
aio_sync_file_range (SV *fh, off_t offset, size_t nbytes, UV flags, SV *callback=&PL_sv_undef)
PPCODE:
{
int fd = s_fileno_croak (fh, 0);
int fd = s_fileno_croak (fh, 0);
dREQ;
req->type = EIO_SYNC_FILE_RANGE;
......@@ -1123,10 +1166,10 @@ aio_sync_file_range (SV *fh, off_t offset, size_t nbytes, UV flags, SV *callback
}
void
aio_fallocate (SV *fh, int mode, off_t offset, size_t len, SV *callback=&PL_sv_undef)
aio_allocate (SV *fh, int mode, off_t offset, size_t len, SV *callback=&PL_sv_undef)
PPCODE:
{
int fd = s_fileno_croak (fh, 0);
int fd = s_fileno_croak (fh, 0);
dREQ;
req->type = EIO_FALLOCATE;
......@@ -1144,7 +1187,7 @@ aio_close (SV *fh, SV *callback=&PL_sv_undef)
PPCODE:
{
static int close_fd = -1; /* dummy fd to close fds via dup2 */
int fd = s_fileno_croak (fh, 0);
int fd = s_fileno_croak (fh, 0);
dREQ;
if (expect_false (close_fd < 0))
......@@ -1217,7 +1260,10 @@ aio_read (SV *fh, SV *offset, SV *length, SV8 *data, IV dataoffset, SV *callback
{
/* read: check type and grow scalar as necessary */
SvUPGRADE (data, SVt_PV);
svptr = SvGROW (data, len + dataoffset + 1);
if (SvLEN (data) >= SvCUR (data))
svptr = SvGROW (data, len + dataoffset + 1);
else if (SvCUR (data) < len + dataoffset)
croak ("length + dataoffset outside of scalar, and cannot grow");
}
{
......@@ -1261,8 +1307,8 @@ void
aio_sendfile (SV *out_fh, SV *in_fh, off_t in_offset, size_t length, SV *callback=&PL_sv_undef)
PPCODE:
{
int ifd = s_fileno_croak (in_fh , 0);
int ofd = s_fileno_croak (out_fh, 1);
int ifd = s_fileno_croak (in_fh , 0);
int ofd = s_fileno_croak (out_fh, 1);
dREQ;
req->type = EIO_SENDFILE;
......@@ -1280,7 +1326,7 @@ void
aio_readahead (SV *fh, off_t offset, size_t length, SV *callback=&PL_sv_undef)
PPCODE:
{
int fd = s_fileno_croak (fh, 0);
int fd = s_fileno_croak (fh, 0);
dREQ;
req->type = EIO_READAHEAD;
......@@ -1530,7 +1576,7 @@ void
aio_fiemap (SV *fh, off_t start, SV *length, U32 flags, SV *count, SV *callback=&PL_sv_undef)
PPCODE:
{
int fd = s_fileno_croak (fh, 0);
int fd = s_fileno_croak (fh, 0);
dREQ;
req->type = EIO_CUSTOM;
......@@ -1688,7 +1734,7 @@ sendfile (aio_wfd ofh, aio_rfd ifh, off_t offset, size_t count)
RETVAL
void
mmap (SV *scalar, size_t length, int prot, int flags, SV *fh, off_t offset = 0)
mmap (SV *scalar, size_t length, int prot, int flags, SV *fh = &PL_sv_undef, off_t offset = 0)
PPCODE:
sv_unmagic (scalar, MMAP_MAGIC);
{
......@@ -1731,7 +1777,7 @@ madvise (SV *scalar, off_t offset = 0, SV *length = &PL_sv_undef, IV advice_or_p
CODE:
{
STRLEN svlen;
void *addr = SvPVbyte (scalar, svlen);
void *addr = SvPVbyte (scalar, svlen);
size_t len = SvUV (length);
if (offset < 0)
......@@ -1760,7 +1806,7 @@ munlock (SV *scalar, off_t offset = 0, SV *length = &PL_sv_undef)
CODE:
{
STRLEN svlen;
void *addr = SvPVbyte (scalar, svlen);
void *addr = SvPVbyte (scalar, svlen);
size_t len = SvUV (length);
if (offset < 0)
......
......@@ -8,6 +8,36 @@ TODO: aio_mincore?
TODO: getxattr etc.?
TODO: F_DUPFD_CLOEXEC
TODO: emulation for splice?
TODO: eio_mmap|mlock|munmap|splice...
4.18 Thu Oct 11 07:01:26 CEST 2012
- fix unintended xthread_create by intentionalising it :)
4.17 Thu Oct 11 05:19:47 CEST 2012
- rename aio_fallocate to aio_allocate, to match documentation.
- add list of linux fsid values to aio_statvfs docs.
- work around a bug in btrfs' FIEMAP ioctl implementation.
- work around AIX bug: statvfs.f_fsid is a struct, not unsigned long
as per unix spec.
4.16 Tue Aug 14 05:39:03 CEST 2012
- aio_statvfs was wromgly marked for wd emulation, causing
it to malfunction for paths.
- fix a crash in aio_fiemap, when used on ranges without any
extents.
- work around linux kernel bug (at least in 3.2): kernel might
trash fiemap input arguments.
- work around linux kernel bug (at least in 3.2): kernel does not
set FIEMAP_EXTENT_LAST on last segment.
- work around linux kernel bug (at least in 3.2): kernel silently
truncates segment count if a file.
- make fh argument of IO::AIO::mmap optional, also add mmap/munmap
to quick overview.
- splice can corrupt data.
- (libeio) remove pread/pwrite emulation.
- do not grow mmaped scalars in aio_read.
- add FALLOC_FL_PUNCH_HOLE and document fallocate.
- provide pread/pwrite for win32, making it link again on native win32.
4.15 Tue Apr 10 06:59:00 CEST 2012
- always include linux/types.h for fiemap, for compatibility to
......
......@@ -37,5 +37,5 @@
}
},
"release_status" : "stable",
"version" : "4.15"
"version" : "4.18"
}
......@@ -19,4 +19,4 @@ no_index:
- inc
requires:
common::sense: 0
version: 4.15
version: 4.18
......@@ -16,7 +16,7 @@ if ($^O eq "MSWin32") {
*** also, the windows SDK is expected to be installed in /sdk
*** and visual C is expected to be installed in /vc98
***
*** You can set the INC and LIBS environment variables
*** Akternatively, set the INC and LIBS environment variables
*** accordingly before running Makeifle.PL, or you can
*** pass INC and LIBS arguments to Makefile.PL itself.
***
......
......@@ -148,8 +148,8 @@ REQUEST ANATOMY AND LIFETIME
FUNCTIONS
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)
......@@ -167,6 +167,8 @@ FUNCTIONS
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)
......@@ -218,6 +220,8 @@ FUNCTIONS
IO::AIO::sendfile $ofh, $ifh, $offset, $count
IO::AIO::fadvise $fh, $offset, $len, $advice
IO::AIO::mmap $scalar, $length, $prot, $flags[, $fh[, $offset]]
IO::AIO::munmap $scalar
IO::AIO::madvise $scalar, $offset, $length, $advice
IO::AIO::mprotect $scalar, $offset, $length, $protect
IO::AIO::munlock $scalar, $offset = 0, $length = undef
......@@ -295,7 +299,8 @@ FUNCTIONS
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.
newly created filehandle for the file (or "undef" in case of an
error).
The pathname passed to "aio_open" must be absolute. See API NOTES,
above, for an explanation.
......@@ -527,6 +532,88 @@ FUNCTIONS
fsid => 1810
}
Here is a (likely partial) list of fsid values used by Linux - it is
safe to hardcode these when the $^O is "linux":
0x0000adf5 adfs
0x0000adff affs
0x5346414f afs
0x09041934 anon-inode filesystem
0x00000187 autofs
0x42465331 befs
0x1badface bfs
0x42494e4d binfmt_misc
0x9123683e btrfs
0x0027e0eb cgroupfs
0xff534d42 cifs
0x73757245 coda
0x012ff7b7 coh
0x28cd3d45 cramfs
0x453dcd28 cramfs-wend (wrong endianness)
0x64626720 debugfs
0x00001373 devfs
0x00001cd1 devpts
0x0000f15f ecryptfs
0x00414a53 efs
0x0000137d ext
0x0000ef53 ext2/ext3
0x0000ef51 ext2
0x00004006 fat
0x65735546 fuseblk
0x65735543 fusectl
0x0bad1dea futexfs
0x01161970 gfs2
0x47504653 gpfs
0x00004244 hfs
0xf995e849 hpfs
0x958458f6 hugetlbfs
0x2bad1dea inotifyfs
0x00009660 isofs
0x000072b6 jffs2
0x3153464a jfs
0x6b414653 k-afs
0x0bd00bd0 lustre
0x0000137f minix
0x0000138f minix 30 char names
0x00002468 minix v2
0x00002478 minix v2 30 char names
0x00004d5a minix v3
0x19800202 mqueue
0x00004d44 msdos
0x0000564c novell
0x00006969 nfs
0x6e667364 nfsd
0x00003434 nilfs
0x5346544e ntfs
0x00009fa1 openprom
0x7461636F ocfs2
0x00009fa0 proc
0x6165676c pstorefs
0x0000002f qnx4
0x858458f6 ramfs
0x52654973 reiserfs
0x00007275 romfs
0x67596969 rpc_pipefs
0x73636673 securityfs
0xf97cff8c selinux
0x0000517b smb
0x534f434b sockfs
0x73717368 squashfs
0x62656572 sysfs
0x012ff7b6 sysv2
0x012ff7b5 sysv4
0x01021994 tmpfs
0x15013346 udf
0x00011954 ufs
0x54190100 ufs byteswapped
0x00009fa2 usbdevfs
0x01021997 v9fs
0xa501fcf5 vxfs
0xabba1974 xenfs
0x012ff7b4 xenix
0x58465342 xfs
0x012fd16d xia
aio_utime $fh_or_path, $atime, $mtime, $callback->($status)
Works like perl's "utime" function (including the special case of
$atime and $mtime being undef). Fractional times are supported if
......@@ -558,6 +645,20 @@ FUNCTIONS
aio_truncate $fh_or_path, $offset, $callback->($status)
Works like truncate(2) or ftruncate(2).
aio_allocate $fh, $mode, $offset, $len, $callback->($status)
Allocates or freed disk space according to the $mode argument. See
the linux "fallocate" docuemntation for details.
$mode can currently be 0 or "IO::AIO::FALLOC_FL_KEEP_SIZE" to
allocate space, or "IO::AIO::FALLOC_FL_PUNCH_HOLE |
IO::AIO::FALLOC_FL_KEEP_SIZE", to deallocate a file range.
The file system block size used by "fallocate" is presumably the
"f_bsize" returned by "statvfs".
If "fallocate" isn't available or cannot be emulated (currently no
emulation will be attempted), passes -1 and sets $! to "ENOSYS".
aio_chmod $fh_or_path, $mode, $callback->($status)
Works like perl's "chmod" function.
......@@ -887,10 +988,10 @@ FUNCTIONS
aio_mlockall IO::AIO::MCL_FUTURE;
aio_fiemap $fh, $start, $length, $flags, $count, $cb->(\@extents)
Queries the extents of the given file (by calling the Linux FIEMAP
Queries the extents of the given file (by calling the Linux "FIEMAP"
ioctl, see <http://cvs.schmorp.de/IO-AIO/doc/fiemap.txt> for
details). If the "ioctl" is not available on your OS, then this
rquiest will fail with "ENOSYS".
details). If the ioctl is not available on your OS, then this
request will fail with "ENOSYS".
$start is the starting offset to query extents for, $length is the
size of the range to query - if it is "undef", then the whole file
......@@ -902,9 +1003,10 @@ FUNCTIONS
query the data portion.
$count is the maximum number of extent records to return. If it is
"undef", then IO::AIO queries all extents of the file. As a very
"undef", then IO::AIO queries all extents of the range. As a very
special case, if it is 0, then the callback receives the number of
extents instead of the extents themselves.
extents instead of the extents themselves (which is unreliable, see
below).
If an error occurs, the callback receives no arguments. The special
"errno" value "IO::AIO::EBADR" is available to test for flag errors.
......@@ -916,7 +1018,7 @@ FUNCTIONS
[$logical, $physical, $length, $flags]
Flags is any combination of the following flag values (typically
either 0 or "IO::AIO::FIEMAP_EXTENT_LAST"):
either 0 or "IO::AIO::FIEMAP_EXTENT_LAST" (1)):
"IO::AIO::FIEMAP_EXTENT_LAST", "IO::AIO::FIEMAP_EXTENT_UNKNOWN",
"IO::AIO::FIEMAP_EXTENT_DELALLOC", "IO::AIO::FIEMAP_EXTENT_ENCODED",
......@@ -927,6 +1029,12 @@ FUNCTIONS
"IO::AIO::FIEMAP_EXTENT_UNWRITTEN", "IO::AIO::FIEMAP_EXTENT_MERGED"
or "IO::AIO::FIEMAP_EXTENT_SHARED".
At the time of this writing (Linux 3.2), this requets is unreliable
unless $count is "undef", 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 $count
is undef.
aio_group $callback->(...)
This is a very special aio request: Instead of doing something, it
is a container for other aio requests, which is useful if you want
......@@ -1476,7 +1584,8 @@ FUNCTIONS
IO::AIO::mmap $scalar, $length, $prot, $flags, $fh[, $offset]
Memory-maps a file (or anonymous memory range) and attaches it to
the given $scalar, which will act like a string scalar.
the given $scalar, which will act like a string scalar. Returns true
on success, and false otherwise.
The only operations allowed on the scalar are "substr"/"vec" that
don't change the string length, and most read-only operations such
......@@ -1542,6 +1651,9 @@ FUNCTIONS
$w_off are "undef", then "NULL" is passed for these, otherwise they
should be the file offset.
$r_fh and $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:
"IO::AIO::SPLICE_F_MOVE", "IO::AIO::SPLICE_F_NONBLOCK",
"IO::AIO::SPLICE_F_MORE" and "IO::AIO::SPLICE_F_GIFT".
......
......@@ -3984,42 +3984,6 @@ test $ac_cv_fdatasync = yes &&
$as_echo "#define HAVE_FDATASYNC 1" >>confdefs.h
{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for pread and pwrite" >&5
$as_echo_n "checking for pread and pwrite... " >&6; }
if test "${ac_cv_preadwrite+set}" = set; then :
$as_echo_n "(cached) " >&6
else
cat confdefs.h - <<_ACEOF >conftest.$ac_ext
/* end confdefs.h. */
#include <unistd.h>
int main (void)
{
int fd = 0;
size_t count = 1;
char buf;
off_t offset = 1;
ssize_t res;
res = pread (fd, &buf, count, offset);
res = pwrite (fd, &buf, count, offset);
return 0;
}
_ACEOF
if ac_fn_c_try_link "$LINENO"; then :
ac_cv_preadwrite=yes
else
ac_cv_preadwrite=no
fi
rm -f core conftest.err conftest.$ac_objext \
conftest$ac_exeext conftest.$ac_ext
fi
{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_preadwrite" >&5
$as_echo "$ac_cv_preadwrite" >&6; }
test $ac_cv_preadwrite = yes &&
$as_echo "#define HAVE_PREADWRITE 1" >>confdefs.h
{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for sendfile" >&5
$as_echo_n "checking for sendfile... " >&6; }
if test "${ac_cv_sendfile+set}" = set; then :
......@@ -4107,7 +4071,7 @@ $as_echo "#define HAVE_SYNC_FILE_RANGE 1" >>confdefs.h
{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for fallocate" >&5
$as_echo_n "checking for fallocate... " >&6; }
if test "${ac_cv_flinux_allocate+set}" = set; then :
if test "${ac_cv_linux_fallocate+set}" = set; then :
$as_echo_n "(cached) " >&6
else
cat confdefs.h - <<_ACEOF >conftest.$ac_ext
......@@ -4134,8 +4098,8 @@ fi
rm -f core conftest.err conftest.$ac_objext \
conftest$ac_exeext conftest.$ac_ext
fi
{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_flinux_allocate" >&5
$as_echo "$ac_cv_flinux_allocate" >&6; }
{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_linux_fallocate" >&5
$as_echo "$ac_cv_linux_fallocate" >&6; }