*** src/tools/fsync/test_fsync.c.orig Wed Feb 14 14:00:40 2007 --- src/tools/fsync/test_fsync.c Thu Oct 18 16:40:04 2007 *************** *** 72,78 **** gettimeofday(&start_t, NULL); for (i = 0; i < loops; i++) { ! if ((tmpfile = open(filename, O_RDWR)) == -1) die("Cannot open output file."); if (write(tmpfile, buf, WRITE_SIZE/2) != WRITE_SIZE/2) die("write failed"); --- 72,78 ---- gettimeofday(&start_t, NULL); for (i = 0; i < loops; i++) { ! if ((tmpfile = open(filename, O_RDWR, 0)) == -1) die("Cannot open output file."); if (write(tmpfile, buf, WRITE_SIZE/2) != WRITE_SIZE/2) die("write failed"); *************** *** 90,103 **** gettimeofday(&start_t, NULL); for (i = 0; i < loops; i++) { ! if ((tmpfile = open(filename, O_RDWR)) == -1) die("Cannot open output file."); if (write(tmpfile, buf, WRITE_SIZE/2) != WRITE_SIZE/2) die("write failed"); if (fsync(tmpfile) != 0) die("fsync failed"); close(tmpfile); ! if ((tmpfile = open(filename, O_RDWR)) == -1) die("Cannot open output file."); /* do nothing but the open/close the tests are consistent. */ close(tmpfile); --- 90,103 ---- gettimeofday(&start_t, NULL); for (i = 0; i < loops; i++) { ! if ((tmpfile = open(filename, O_RDWR, 0)) == -1) die("Cannot open output file."); if (write(tmpfile, buf, WRITE_SIZE/2) != WRITE_SIZE/2) die("write failed"); if (fsync(tmpfile) != 0) die("fsync failed"); close(tmpfile); ! if ((tmpfile = open(filename, O_RDWR, 0)) == -1) die("Cannot open output file."); /* do nothing but the open/close the tests are consistent. */ close(tmpfile); *************** *** 111,123 **** gettimeofday(&start_t, NULL); for (i = 0; i < loops; i++) { ! if ((tmpfile = open(filename, O_RDWR)) == -1) die("Cannot open output file."); if (write(tmpfile, buf, WRITE_SIZE/2) != WRITE_SIZE/2) die("write failed"); close(tmpfile); /* reopen file */ ! if ((tmpfile = open(filename, O_RDWR)) == -1) die("Cannot open output file."); if (fsync(tmpfile) != 0) die("fsync failed"); --- 111,123 ---- gettimeofday(&start_t, NULL); for (i = 0; i < loops; i++) { ! if ((tmpfile = open(filename, O_RDWR, 0)) == -1) die("Cannot open output file."); if (write(tmpfile, buf, WRITE_SIZE/2) != WRITE_SIZE/2) die("write failed"); close(tmpfile); /* reopen file */ ! if ((tmpfile = open(filename, O_RDWR, 0)) == -1) die("Cannot open output file."); if (fsync(tmpfile) != 0) die("fsync failed"); *************** *** 132,138 **** #ifdef OPEN_SYNC_FLAG /* 16k o_sync write */ ! if ((tmpfile = open(filename, O_RDWR | OPEN_SYNC_FLAG)) == -1) die("Cannot open output file."); gettimeofday(&start_t, NULL); for (i = 0; i < loops; i++) --- 132,138 ---- #ifdef OPEN_SYNC_FLAG /* 16k o_sync write */ ! if ((tmpfile = open(filename, O_RDWR | OPEN_SYNC_FLAG, 0)) == -1) die("Cannot open output file."); gettimeofday(&start_t, NULL); for (i = 0; i < loops; i++) *************** *** 145,151 **** printf("\n"); /* 2*8k o_sync writes */ ! if ((tmpfile = open(filename, O_RDWR | OPEN_SYNC_FLAG)) == -1) die("Cannot open output file."); gettimeofday(&start_t, NULL); for (i = 0; i < loops; i++) --- 145,151 ---- printf("\n"); /* 2*8k o_sync writes */ ! if ((tmpfile = open(filename, O_RDWR | OPEN_SYNC_FLAG, 0)) == -1) die("Cannot open output file."); gettimeofday(&start_t, NULL); for (i = 0; i < loops; i++) *************** *** 169,175 **** #ifdef OPEN_DATASYNC_FLAG /* open_dsync, write */ ! if ((tmpfile = open(filename, O_RDWR | O_DSYNC)) == -1) die("Cannot open output file."); gettimeofday(&start_t, NULL); for (i = 0; i < loops; i++) --- 169,175 ---- #ifdef OPEN_DATASYNC_FLAG /* open_dsync, write */ ! if ((tmpfile = open(filename, O_RDWR | O_DSYNC, 0)) == -1) die("Cannot open output file."); gettimeofday(&start_t, NULL); for (i = 0; i < loops; i++) *************** *** 182,188 **** printf("\n"); #ifdef OPEN_SYNC_FLAG /* open_fsync, write */ ! if ((tmpfile = open(filename, O_RDWR | OPEN_SYNC_FLAG)) == -1) die("Cannot open output file."); gettimeofday(&start_t, NULL); for (i = 0; i < loops; i++) --- 182,188 ---- printf("\n"); #ifdef OPEN_SYNC_FLAG /* open_fsync, write */ ! if ((tmpfile = open(filename, O_RDWR | OPEN_SYNC_FLAG, 0)) == -1) die("Cannot open output file."); gettimeofday(&start_t, NULL); for (i = 0; i < loops; i++) *************** *** 200,206 **** #ifdef HAVE_FDATASYNC /* write, fdatasync */ ! if ((tmpfile = open(filename, O_RDWR)) == -1) die("Cannot open output file."); gettimeofday(&start_t, NULL); for (i = 0; i < loops; i++) --- 200,206 ---- #ifdef HAVE_FDATASYNC /* write, fdatasync */ ! if ((tmpfile = open(filename, O_RDWR, 0)) == -1) die("Cannot open output file."); gettimeofday(&start_t, NULL); for (i = 0; i < loops; i++) *************** *** 219,225 **** printf("\n"); /* write, fsync, close */ ! if ((tmpfile = open(filename, O_RDWR)) == -1) die("Cannot open output file."); gettimeofday(&start_t, NULL); for (i = 0; i < loops; i++) --- 219,225 ---- printf("\n"); /* write, fsync, close */ ! if ((tmpfile = open(filename, O_RDWR, 0)) == -1) die("Cannot open output file."); gettimeofday(&start_t, NULL); for (i = 0; i < loops; i++) *************** *** 239,245 **** #ifdef OPEN_DATASYNC_FLAG /* open_dsync, write */ ! if ((tmpfile = open(filename, O_RDWR | O_DSYNC)) == -1) die("Cannot open output file."); gettimeofday(&start_t, NULL); for (i = 0; i < loops; i++) --- 239,245 ---- #ifdef OPEN_DATASYNC_FLAG /* open_dsync, write */ ! if ((tmpfile = open(filename, O_RDWR | O_DSYNC, 0)) == -1) die("Cannot open output file."); gettimeofday(&start_t, NULL); for (i = 0; i < loops; i++) *************** *** 260,266 **** #ifdef OPEN_SYNC_FLAG /* open_fsync, write */ ! if ((tmpfile = open(filename, O_RDWR | OPEN_SYNC_FLAG)) == -1) die("Cannot open output file."); gettimeofday(&start_t, NULL); for (i = 0; i < loops; i++) --- 260,266 ---- #ifdef OPEN_SYNC_FLAG /* open_fsync, write */ ! if ((tmpfile = open(filename, O_RDWR | OPEN_SYNC_FLAG, 0)) == -1) die("Cannot open output file."); gettimeofday(&start_t, NULL); for (i = 0; i < loops; i++) *************** *** 279,285 **** #ifdef HAVE_FDATASYNC /* write, fdatasync */ ! if ((tmpfile = open(filename, O_RDWR)) == -1) die("Cannot open output file."); gettimeofday(&start_t, NULL); for (i = 0; i < loops; i++) --- 279,285 ---- #ifdef HAVE_FDATASYNC /* write, fdatasync */ ! if ((tmpfile = open(filename, O_RDWR, 0)) == -1) die("Cannot open output file."); gettimeofday(&start_t, NULL); for (i = 0; i < loops; i++) *************** *** 300,306 **** printf("\n"); /* write, fsync, close */ ! if ((tmpfile = open(filename, O_RDWR)) == -1) die("Cannot open output file."); gettimeofday(&start_t, NULL); for (i = 0; i < loops; i++) --- 300,306 ---- printf("\n"); /* write, fsync, close */ ! if ((tmpfile = open(filename, O_RDWR, 0)) == -1) die("Cannot open output file."); gettimeofday(&start_t, NULL); for (i = 0; i < loops; i++)