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.279 by root, Fri Sep 6 22:03:45 2019 UTC vs.
Revision 1.283 by root, Thu Sep 3 17:20:45 2020 UTC

344 int count = req->int3; 344 int count = req->int3;
345 345
346 req->flags |= EIO_FLAG_PTR1_FREE; 346 req->flags |= EIO_FLAG_PTR1_FREE;
347 347
348 /* heuristic: start with 512 bytes (8 extents), and if that isn't enough, */ 348 /* heuristic: start with 512 bytes (8 extents), and if that isn't enough, */
349 /* increase in 3.5kb steps */ 349 /* increase in fixed steps */
350 if (count < 0) 350 if (count < 0)
351 count = 8; 351 count = 8;
352 352
353 fiemap = malloc (sizeof (*fiemap) + sizeof (struct fiemap_extent) * count); 353 fiemap = malloc (sizeof (*fiemap) + sizeof (struct fiemap_extent) * count);
354 errno = ENOMEM; 354 errno = ENOMEM;
407 407
408 for (count = 0; count < incmap->fm_mapped_extents; ++count) 408 for (count = 0; count < incmap->fm_mapped_extents; ++count)
409 { 409 {
410 struct fiemap_extent *e = incmap->fm_extents + count; 410 struct fiemap_extent *e = incmap->fm_extents + count;
411 411
412 fiemap->fm_extents [fiemap->fm_mapped_extents++] = *e;
413
412 if (e->fe_logical + e->fe_length >= end_offset) 414 if (e->fe_logical + e->fe_length >= end_offset)
413 goto done; 415 goto done;
414
415 fiemap->fm_extents [fiemap->fm_mapped_extents++] = *e;
416 416
417 if (e->fe_flags & FIEMAP_EXTENT_LAST) 417 if (e->fe_flags & FIEMAP_EXTENT_LAST)
418 goto done; 418 goto done;
419 419
420 } 420 }
2528 retval = &PL_sv_undef; 2528 retval = &PL_sv_undef;
2529#endif 2529#endif
2530 XPUSHs (retval); 2530 XPUSHs (retval);
2531} 2531}
2532 2532
2533int 2533ssize_t
2534splice (aio_rfd rfh, SV *off_in, aio_wfd wfh, SV *off_out, size_t length, unsigned int flags) 2534splice (aio_rfd rfh, SV *off_in, aio_wfd wfh, SV *off_out, size_t length, unsigned int flags)
2535 CODE: 2535 CODE:
2536{ 2536{
2537#if HAVE_LINUX_SPLICE 2537#if HAVE_LINUX_SPLICE
2538 loff_t off_in_, off_out_; 2538 loff_t off_in_, off_out_;
2546#endif 2546#endif
2547} 2547}
2548 OUTPUT: 2548 OUTPUT:
2549 RETVAL 2549 RETVAL
2550 2550
2551int 2551ssize_t
2552tee (aio_rfd rfh, aio_wfd wfh, size_t length, unsigned int flags) 2552tee (aio_rfd rfh, aio_wfd wfh, size_t length, unsigned int flags)
2553 CODE: 2553 CODE:
2554#if HAVE_LINUX_SPLICE 2554#if HAVE_LINUX_SPLICE
2555 RETVAL = tee (rfh, wfh, length, flags); 2555 RETVAL = tee (rfh, wfh, length, flags);
2556#else 2556#else
2727 if (0 == setrlimit (RLIMIT_NOFILE, &rl)) 2727 if (0 == setrlimit (RLIMIT_NOFILE, &rl))
2728 XSRETURN_YES; 2728 XSRETURN_YES;
2729 2729
2730 if (errno == EPERM) 2730 if (errno == EPERM)
2731 { 2731 {
2732 /* setlimit failed with EPERM - maybe we can't raise the hardlimit, or maybe */ 2732 /* setrlimit failed with EPERM - maybe we can't raise the hardlimit, or maybe */
2733 /* our limit overflows a system-wide limit */ 2733 /* our limit overflows a system-wide limit */
2734 /* try an adaptive algorithm, but do not lower the hardlimit */ 2734 /* try an adaptive algorithm, but do not lower the hardlimit */
2735 rl.rlim_max = 0; 2735 rl.rlim_max = 0;
2736 for (bit = 0x40000000U; bit; bit >>= 1) 2736 for (bit = 0x40000000U; bit; bit >>= 1)
2737 { 2737 {
2738 rl.rlim_max |= bit; 2738 rl.rlim_max |= bit;
2739 rl.rlim_cur = rl.rlim_max; 2739 rl.rlim_cur = rl.rlim_max;
2740 2740
2741 /* nevr decrease the hard limit */ 2741 /* never decrease the hard limit */
2742 if (rl.rlim_max < orig_rlim_max) 2742 if (rl.rlim_max < orig_rlim_max)
2743 break; 2743 break;
2744 2744
2745 if (0 != setrlimit (RLIMIT_NOFILE, &rl)) 2745 if (0 != setrlimit (RLIMIT_NOFILE, &rl))
2746 rl.rlim_max &= ~bit; /* too high, remove bit again */ 2746 rl.rlim_max &= ~bit; /* too high, remove bit again */

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines