From: Ming Zhang <mingz@ele.uri.edu>
To: LKML <linux-kernel@vger.kernel.org>
Subject: Re: very weired random io behavior
Date: Fri, 26 Aug 2005 16:18:48 -0400 [thread overview]
Message-ID: <1125087528.5549.123.camel@localhost.localdomain> (raw)
In-Reply-To: <1125086927.5549.121.camel@localhost.localdomain>
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;
> }
>
prev parent reply other threads:[~2005-08-26 20:18 UTC|newest]
Thread overview: 2+ messages / expand[flat|nested] mbox.gz Atom feed top
2005-08-26 20:08 Ming Zhang
2005-08-26 20:18 ` Ming Zhang [this message]
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=1125087528.5549.123.camel@localhost.localdomain \
--to=mingz@ele.uri.edu \
--cc=linux-kernel@vger.kernel.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
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®