~vadim-tk/sysbench/sysbench-pareto-merge

« back to all changes in this revision

Viewing changes to sysbench/tests/fileio/sb_fileio.c

  • Committer: Alexey Kopytov
  • Date: 2011-06-19 16:15:59 UTC
  • Revision ID: akopytov@gmail.com-20110619161559-335mj3yvhg84wsbu
* fixed bug #797756 "sequential write test not working correctly"
* advancing position for sequential tests is actually a good idea
* replaced LOG_INFO with LOG_NOTICE for test setup messages to make them
  visible by default

Show diffs side-by-side

added added

removed removed

Lines of Context:
434
434
    return sb_req;
435
435
  }
436
436
 
437
 
  req_performed++;
438
 
 
439
437
  /* See whether it's time to fsync file(s) */
440
438
  if (file_fsync_freq != 0 && file_req->operation == FILE_OP_TYPE_WRITE &&
441
 
      req_performed % file_fsync_freq == 0)
 
439
      is_dirty && req_performed % file_fsync_freq == 0)
442
440
  {
443
441
    file_req->operation = FILE_OP_TYPE_FSYNC;
444
442
    file_req->file_id = fsynced_file;
446
444
    file_req->size = 0;
447
445
    fsynced_file++;
448
446
    if (fsynced_file == num_files)
 
447
    {
449
448
      fsynced_file = 0;
 
449
      is_dirty = 0;
 
450
    }
450
451
 
451
452
    SB_THREAD_MUTEX_UNLOCK();
452
453
    return sb_req;
453
454
  }
454
 
  
 
455
 
 
456
  req_performed++;
 
457
 
 
458
  if (file_req->operation == FILE_OP_TYPE_WRITE)
 
459
    is_dirty = 1;
 
460
 
455
461
  /* Rewind to the first file if all files are processed */
456
462
  if (current_file == num_files)
457
463
  {
474
480
    file_req->file_id = current_file;
475
481
    file_req->pos = position;
476
482
  }
477
 
  
 
483
 
 
484
  position += file_req->size;
 
485
 
478
486
  /* scroll to the next file if not already out of bound */
479
487
  if (position == file_size)
480
488
  {
735
743
{
736
744
  char sizestr[16];
737
745
  
738
 
  log_text(LOG_INFO, "Extra file open flags: %x", file_extra_flags);
739
 
  log_text(LOG_INFO, "%d files, %sb each", num_files,
 
746
  log_text(LOG_NOTICE, "Extra file open flags: %x", file_extra_flags);
 
747
  log_text(LOG_NOTICE, "%d files, %sb each", num_files,
740
748
           sb_print_value_size(sizestr, sizeof(sizestr), file_size));
741
 
  log_text(LOG_INFO, "%sb total file size",
 
749
  log_text(LOG_NOTICE, "%sb total file size",
742
750
           sb_print_value_size(sizestr, sizeof(sizestr),
743
751
                               file_size * num_files));
744
 
  log_text(LOG_INFO, "Block size %sb",
 
752
  log_text(LOG_NOTICE, "Block size %sb",
745
753
           sb_print_value_size(sizestr, sizeof(sizestr), file_block_size));
746
754
  if (file_merged_requests > 0)
747
 
    log_text(LOG_INFO, "Merging requests  up to %sb for sequential IO.",
 
755
    log_text(LOG_NOTICE, "Merging requests  up to %sb for sequential IO.",
748
756
             sb_print_value_size(sizestr, sizeof(sizestr),
749
757
                                 file_max_request_size));
750
758
 
753
761
    case MODE_RND_WRITE:
754
762
    case MODE_RND_READ:
755
763
    case MODE_RND_RW:
756
 
      log_text(LOG_INFO, "Number of IO requests: %d",
 
764
      log_text(LOG_NOTICE, "Number of IO requests: %d",
757
765
               sb_globals.max_requests);
758
 
      log_text(LOG_INFO,
 
766
      log_text(LOG_NOTICE,
759
767
               "Read/Write ratio for combined random IO test: %2.2f",
760
768
               file_rw_ratio);
761
769
      break;
764
772
  }
765
773
 
766
774
  if (file_fsync_freq > 0)
767
 
    log_text(LOG_INFO,
 
775
    log_text(LOG_NOTICE,
768
776
             "Periodic FSYNC enabled, calling fsync() each %d requests.",
769
777
             file_fsync_freq);
770
778
 
771
779
  if (file_fsync_end)
772
 
    log_text(LOG_INFO, "Calling fsync() at the end of test, Enabled.");
 
780
    log_text(LOG_NOTICE, "Calling fsync() at the end of test, Enabled.");
773
781
 
774
782
  if (file_fsync_all)
775
 
    log_text(LOG_INFO, "Calling fsync() after each write operation.");
 
783
    log_text(LOG_NOTICE, "Calling fsync() after each write operation.");
776
784
 
777
 
  log_text(LOG_INFO, "Using %s I/O mode", get_io_mode_str(file_io_mode));
 
785
  log_text(LOG_NOTICE, "Using %s I/O mode", get_io_mode_str(file_io_mode));
778
786
 
779
787
  if (sb_globals.validate)
780
 
    log_text(LOG_INFO, "Using checksums validation.");
 
788
    log_text(LOG_NOTICE, "Using checksums validation.");
781
789
  
782
 
  log_text(LOG_INFO, "Doing %s test", get_test_mode_str(test_mode));
 
790
  log_text(LOG_NOTICE, "Doing %s test", get_test_mode_str(test_mode));
783
791
}
784
792
 
785
793
 
895
903
  char               file_name[512];
896
904
  long long          offset;
897
905
 
898
 
  log_text(LOG_INFO, "%d files, %ldKb each, %ldMb total", num_files,
 
906
  log_text(LOG_NOTICE, "%d files, %ldKb each, %ldMb total", num_files,
899
907
           (long)(file_size / 1024),
900
908
           (long)((file_size * num_files) / (1024 * 1024)));
901
 
  log_text(LOG_INFO, "Creating files for the test...");
902
 
  log_text(LOG_INFO, "Extra file open flags: %x", file_extra_flags);
 
909
  log_text(LOG_NOTICE, "Creating files for the test...");
 
910
  log_text(LOG_NOTICE, "Extra file open flags: %x", file_extra_flags);
903
911
  for (i=0; i < num_files; i++) {
904
912
    snprintf(file_name, sizeof(file_name), "test_file.%d",i);
905
913
    unlink(file_name);
949
957
  unsigned int i;
950
958
  char         file_name[512];
951
959
  
952
 
  log_text(LOG_INFO, "Removing test files...");
 
960
  log_text(LOG_NOTICE, "Removing test files...");
953
961
  
954
962
  for (i = 0; i < num_files; i++)
955
963
  {