linux-mm.kvack.org archive mirror
 help / color / mirror / Atom feed
From: Jens Axboe <axboe@suse.de>
To: Linux Kernel <linux-kernel@vger.kernel.org>
Cc: Andrew Morton <akpm@digeo.com>, linux-mm@kvack.org
Subject: Re: VM BUG, set_page_dirty() buggy?
Date: Fri, 25 Oct 2002 11:52:45 +0200	[thread overview]
Message-ID: <20021025095245.GL4153@suse.de> (raw)
In-Reply-To: <20021025094715.GF12628@suse.de>

[-- Attachment #1: Type: text/plain, Size: 325 bytes --]

On Fri, Oct 25 2002, Jens Axboe wrote:
> I've attached oread in its simplicity. System being tested here is a
> dual P3-800MHz, not using preempt (never do). It doesn't matter if the
> input is on /dev/sda or ide disk, scsi cdrom, or atapi cdrom. It behaves
> the same way, data is lost.

Well here it is...

-- 
Jens Axboe


[-- Attachment #2: oread.c --]
[-- Type: text/plain, Size: 973 bytes --]

#include <stdio.h>
#include <unistd.h>
#include <fcntl.h>
#include <stdlib.h>

#ifndef O_DIRECT
#define O_DIRECT	040000
#endif

#define READ_SIZE	(65536)
#define ALIGN(buf)	(char *) (((unsigned long) (buf) + 4095) & ~(4095))

int main(int argc, char *argv[])
{
	char *buffer, *ptr;
	int fd_in, fd_out, ret;

	if (argc < 3) {
		printf("%s: <infile> <outfile>\n", argv[0]);
		return 1;
	}

	printf("%s: infile: %s -> outfile %s\n", argv[0],argv[1],argv[2]);

	fd_in = open(argv[1], O_RDONLY | O_DIRECT);
	if (fd_in == -1) {
		perror("open infile");
		return 2;
	}

	fd_out = open(argv[2], O_WRONLY | O_CREAT | O_TRUNC, 0644);
	if (fd_out == -1) {
		perror("open outfile");
		return 3;
	}

	ptr = malloc(READ_SIZE + 4095);
	buffer = ALIGN(ptr);

	do {
		ret = read(fd_in, buffer, READ_SIZE);
		if (!ret)
			break;
		else if (ret < 0) {
			perror("read infile");
			break;
		}
		write(fd_out, buffer, ret);
	} while (1);

	free(ptr);
	close(fd_in); close(fd_out);
	return 0;
}

  reply	other threads:[~2002-10-25  9:52 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2002-10-25  9:47 Jens Axboe
2002-10-25  9:52 ` Jens Axboe [this message]
2002-10-28  3:38 ` Andrew Morton

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=20021025095245.GL4153@suse.de \
    --to=axboe@suse.de \
    --cc=akpm@digeo.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-mm@kvack.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