umount/mount not flushing cache on 2.2.14 ?

From: bhartner@us.ibm.com
Date: Wed May 03 2000 - 17:22:56 EST


I am running a file system throughput benchmark on 2.2.14 and I need to
be able to flush the file system cache.

I thought that I could use umount/mount to flush the cache, but I am
getting throughput results that lead me to believe that umount/mount
is not flushing the file system cache on 2.2.14.

It is a fairly simple test.

(1) umount /usr3
(2) mkfs -t ext2 /dev/sdc1
(3) mount -t ext2 /dev/sdc1 /usr3
(4) create a 16,777,216 (65536 x 256) byte file.

(5) umount /usr3
(6) mount -t ext2 /dev/sdc1 /usr3
(7) read the entire file sequentially 256 bytes at a time (65536 reads).

(repeat steps (5)-(7) four times)

The file is read at about 52 MB/second.

If I reboot the system after creating the file,
then the throughput is about 7 MB/second.

In the 52 MB/second case, I am guessing that the dirty cache blocks
from the file creation were not flushed when the file system
was unmounted.

Any ideas ?

BTW, 2.3.99pre6 does not show this behavior.

Thanks, Bill Hartner

-----------

Here are the test programs for creating and reading the file :

createfile.c

#include <sys/types.h>
#include <sys/stat.h>
#include <unistd.h>
#include <fcntl.h>
#include <errno.h>
#include <sys/sem.h>
#include <sys/time.h>
#include <time.h>

typedef unsigned long long time_64;
#define cycle_read(ctr) \
{ \
    struct timeval tv; \
    gettimeofday(&tv,0); \
    ctr = ((time_64)tv.tv_sec * 1000000) + (time_64)tv.tv_usec; \
}

#define RECORD_SIZE 256
#define NUM_RECORDS 65536

main(int argc, char *argv[]) {

     char *filename = "/usr3/tfile";

     int filehandle;
     int rc;
     int i;
     char buffer[RECORD_SIZE];
     unsigned long long starttime;
     unsigned long long endtime;
     double x,y,z;

     filehandle = open(filename, O_CREAT | O_RDWR, 00777);
     if (filehandle == -1) {
             printf ("open failed, errno = %d\n", errno);
               goto error_exit;
     } else {
          cycle_read(starttime);
          for (i = 0 ; i < NUM_RECORDS ; i++) {
               rc = write(filehandle,buffer,RECORD_SIZE);
               if (rc != RECORD_SIZE) {
                    printf ("write failed, rc = %d, errno = %d\n", rc,
errno);
                    goto error_exit;
               }
             }
          cycle_read(endtime);
     }

     x = (double)(NUM_RECORDS*RECORD_SIZE);
     y = (double)(endtime-starttime);
     z = x/y;

     printf ("total time = %Lu\n", endtime-starttime);
     printf ("%10.3f MB/sec\n", z);

error_exit:

}

readfile.c

#include <sys/types.h>
#include <sys/stat.h>
#include <unistd.h>
#include <fcntl.h>
#include <errno.h>
#include <sys/sem.h>
#include <sys/time.h>
#include <time.h>

typedef unsigned long long time_64;
#define cycle_read(ctr) \
{ \
    struct timeval tv; \
    gettimeofday(&tv,0); \
    ctr = ((time_64)tv.tv_sec * 1000000) + (time_64)tv.tv_usec; \
}

#define RECORD_SIZE 256
#define NUM_RECORDS 65536

main(int argc, char *argv[]) {
     char *filename = "/usr3/tfile";
     int filehandle;
     int rc;
     int i;
     char buffer[RECORD_SIZE];
     unsigned long long starttime;
     unsigned long long endtime;
     double x,y,z;

     filehandle = open(filename, O_RDWR, 00777);
     if (filehandle == -1) {
             printf ("open failed, errno = %d\n", errno);
          goto error_exit;
     } else {
          cycle_read(starttime);
          for (i = 0 ; i < NUM_RECORDS ; i++) {
               rc = read(filehandle,buffer,RECORD_SIZE);
               if (rc != RECORD_SIZE) {
                    printf ("read failed, rc = %d, errno = %d\n", rc,
errno);
                    goto error_exit;
               }
             }
          cycle_read(endtime);
     }

     x = (double)(NUM_RECORDS*RECORD_SIZE);
     y = (double)(endtime-starttime);
     z = x/y;

     printf ("total time = %Lu\n", endtime-starttime);
     printf ("%10.3f MB/sec\n", z);

error_exit:

}

-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@vger.rutgers.edu
Please read the FAQ at http://www.tux.org/lkml/



This archive was generated by hypermail 2b29 : Sun May 07 2000 - 21:00:13 EST