MCPcopy Create free account
hub / github.com/axboe/liburing / test_huge

Function test_huge

test/file-register.c:526–580  ·  view source on GitHub ↗

* Register 8K of sparse files, update one at a random spot, then do some * file IO to verify it works. */

Source from the content-addressed store, hash-verified

524 * file IO to verify it works.
525 */
526static int test_huge(struct io_uring *ring)
527{
528 int *files;
529 int ret;
530
531 adjust_nfiles(16384);
532
533 files = open_files(0, 8192, 0);
534 ret = io_uring_register_files(ring, files, 8192);
535 if (ret) {
536 /* huge sets not supported */
537 if (ret == -EMFILE) {
538 fprintf(stdout, "%s: No huge file set support, skipping\n", __FUNCTION__);
539 goto out;
540 }
541 fprintf(stderr, "%s: register ret=%d\n", __FUNCTION__, ret);
542 goto err;
543 }
544
545 files[7193] = open(".reg.7193", O_RDWR | O_CREAT, 0644);
546 if (files[7193] < 0) {
547 fprintf(stderr, "%s: open=%d\n", __FUNCTION__, errno);
548 goto err;
549 }
550
551 ret = io_uring_register_files_update(ring, 7193, &files[7193], 1);
552 if (ret != 1) {
553 fprintf(stderr, "%s: update ret=%d\n", __FUNCTION__, ret);
554 goto err;
555 }
556
557 if (test_fixed_read_write(ring, 7193))
558 goto err;
559
560 ret = io_uring_unregister_files(ring);
561 if (ret) {
562 fprintf(stderr, "%s: unregister ret=%d\n", __FUNCTION__, ret);
563 goto err;
564 }
565
566 if (files[7193] != -1) {
567 close(files[7193]);
568 unlink(".reg.7193");
569 }
570out:
571 free(files);
572 return 0;
573err:
574 if (files[7193] != -1) {
575 close(files[7193]);
576 unlink(".reg.7193");
577 }
578 free(files);
579 return 1;
580}
581
582static int test_skip(struct io_uring *ring)
583{

Callers 1

mainFunction · 0.85

Calls 6

adjust_nfilesFunction · 0.85
io_uring_register_filesFunction · 0.85
test_fixed_read_writeFunction · 0.85
open_filesFunction · 0.70

Tested by

no test coverage detected