mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
* very weired random io behavior
@ 2005-08-26 20:08 Ming Zhang
  2005-08-26 20:18 ` Ming Zhang
  0 siblings, 1 reply; 2+ messages in thread
From: Ming Zhang @ 2005-08-26 20:08 UTC (permalink / raw)
  To: LKML

I ran a small test program on a 400GB SATA disk connected to Marvel
chip. Using 2.6.11.12 kernel and get this strange behavior.


# iostat -k -p /dev/sdj
Linux 2.6.11.12 (bakstor2u.localdomain)         08/26/2005

avg-cpu:  %user   %nice    %sys %iowait   %idle
           0.11    0.00    6.63   54.75   38.51

Device:            tps    kB_read/s    kB_wrtn/s    kB_read    kB_wrtn
sdj               0.00         0.01         0.00         36          0

start with no io. run program with /dev/sdj and count 10240. i supposed
it should only write 40MB data and no read should be generated. but
result is quite weired. there are almost same amount of read and total
size is around 80MB.


# iostat -k -p /dev/sdj
Linux 2.6.11.12 (bakstor2u.localdomain)         08/26/2005

avg-cpu:  %user   %nice    %sys %iowait   %idle
           0.11    0.00    6.48   55.65   37.77

Device:            tps    kB_read/s    kB_wrtn/s    kB_read    kB_wrtn
sdj               4.26        11.31        11.47      80476      81640


pls cc to me.

Thanks!

Ming

---------------------------------------------------
#define _LARGEFILE64_SOURCE

#include <stdlib.h>
#include <sys/types.h>
#include <unistd.h>
#include <fcntl.h>
#include <sys/types.h>
#include <sys/stat.h>

int main(int argc, char *argv[])
{
        int n;
        int i, count;
        char *name;
        char buf[4096];
        int fd;

        if (argc != 3) {
                printf("%s name count\n", argv[0]);
                exit(1);
        }
        name = argv[1];
        count = atoi(argv[2]);

        fd = open(name, O_CREAT|O_WRONLY, S_IRWXU);
        for (i = 0; i < count; i++) {
                unsigned long x;

                x = (rand() >> 1) << 1;
                lseek64(fd, x, SEEK_SET);
                write(fd, buf, 4096);
        }
        printf("done\n");
        close(fd);
        return 0;
}



^ permalink raw reply	[flat|nested] 2+ messages in thread

* Re: very weired random io behavior
  2005-08-26 20:08 very weired random io behavior Ming Zhang
@ 2005-08-26 20:18 ` Ming Zhang
  0 siblings, 0 replies; 2+ messages in thread
From: Ming Zhang @ 2005-08-26 20:18 UTC (permalink / raw)
  To: LKML

sorry. my dumb.

here is not 
x = (rand() >> 1) << 1;
but
x = (rand() >> 10) << 10;

file is in bytes while lba is in sector. ;P

ming



On Fri, 2005-08-26 at 16:08 -0400, Ming Zhang wrote:

> ---------------------------------------------------
> #define _LARGEFILE64_SOURCE
> 
> #include <stdlib.h>
> #include <sys/types.h>
> #include <unistd.h>
> #include <fcntl.h>
> #include <sys/types.h>
> #include <sys/stat.h>
> 
> int main(int argc, char *argv[])
> {
>         int n;
>         int i, count;
>         char *name;
>         char buf[4096];
>         int fd;
> 
>         if (argc != 3) {
>                 printf("%s name count\n", argv[0]);
>                 exit(1);
>         }
>         name = argv[1];
>         count = atoi(argv[2]);
> 
>         fd = open(name, O_CREAT|O_WRONLY, S_IRWXU);
>         for (i = 0; i < count; i++) {
>                 unsigned long x;
> 
>                 x = (rand() >> 1) << 1;
>                 lseek64(fd, x, SEEK_SET);
>                 write(fd, buf, 4096);
>         }
>         printf("done\n");
>         close(fd);
>         return 0;
> }
> 


^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2005-08-26 20:18 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2005-08-26 20:08 very weired random io behavior Ming Zhang
2005-08-26 20:18 ` Ming Zhang

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox

all inboxes | Powered by JetHome®