Re: [Ext2-devel] Re: [PATCH] concurrent block allocation for ext2 against 2.5.64

From: Alex Tomas (bzzz@tmi.comex.ru)
Date: Sat Mar 15 2003 - 03:16:10 EST


>>>>> Andrew Morton (AM) writes:

 AM> Nope. What we're trying to measure here is pure in-memory lock
 AM> contention, locked bus traffic, context switches, etc, etc. To
 AM> do that we need to get the IO system out of the picture.

I simple use own pretty simple test. btw, you may disable preallocation
to increase allocation rate

bash-script:
============================================================
#!/bin/sh

# args:
# 1 - how many processes to create
# 2 - how many blocks in file to be written
# 3 - how many times to repeat (write+truncate)
# for example: cd.sh 2 32 100000

let i=0
while let "i < $1"; do
        if [ ! -d /mnt/$i ]; then
                mkdir /mnt/$i
        fi
        rm -rf /mnt/$i/*
        let "i=i+1"
done

sync
sync

let i=0
while let "i < $1"; do
        time /root/cdsingle $2 $3 /mnt/$i/1 &
        let "i=i+1"
done

wait
============================================================

C programm, which does loop over writes and truncate:

#include <stdio.h>
#include <sys/types.h>
#include <sys/stat.h>
#include <fcntl.h>

main (int argc, char ** argv)
{
        int i, j, num, siz, err, k;
        int fd[1024];

        num = atoi(argv[2]);
        siz = atoi(argv[1]);
        
        for (i = 3; i < argc; i++) {
                fd[i] = creat(argv[i], 0666);
                if (fd[i] < 0) {
                        perror("can't create");
                        exit(1);
                }
        }

        for (j = 0; j < num; j++) {
                for (i = 3; i < argc; i++) {
                        for (k = 0; k < siz; k++)
                                if ((err = write(fd[i], main, 4096)) < 0) {
                                        printf("err=%d\n", err);
                                        perror("can't write");
                                        exit(1);
                                }
                }
                for (i = 3; i < argc; i++) {
                        ftruncate(fd[i], 0);
                        lseek(fd[i], 0, SEEK_SET);
                }
        }

        for(i = 3; i < argc; i++) {
                close(fd[i]);
                if (unlink(argv[i]) < 0)
                        perror("can't unlink");
        }
}

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



This archive was generated by hypermail 2b29 : Sat Mar 15 2003 - 22:00:42 EST