public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
From: Jens Axboe <axboe@suse.de>
To: Mathieu Segaud <matt@minas-morgul.org>
Cc: Andrew Morton <akpm@osdl.org>,
	jfannin1@columbus.rr.com, agk@redhat.com, christophe@saout.de,
	linux-kernel@vger.kernel.org, bzolnier@gmail.com
Subject: Re: 2.6.9-mm1: LVM stopped working (dio-handle-eof.patch)
Date: Tue, 2 Nov 2004 15:55:41 +0100	[thread overview]
Message-ID: <20041102145541.GV6821@suse.de> (raw)
In-Reply-To: <20041102143919.GT6821@suse.de>

On Tue, Nov 02 2004, Jens Axboe wrote:
> On Wed, Oct 27 2004, Mathieu Segaud wrote:
> > Jens Axboe <axboe@suse.de> disait dernièrement que :
> > 
> > 
> > > This feels pretty icky, but should suffice for testing. Does it make a
> > > difference?
> > >
> > > --- /opt/kernel/linux-2.6.10-rc1-mm1/fs/direct-io.c	2004-10-27 08:29:51.866931262 +0200
> > > +++ linux-2.6.10-rc1-mm1/fs/direct-io.c	2004-10-27 08:41:20.292172299 +0200
> > > @@ -987,8 +987,8 @@
> > >  	isize = i_size_read(inode);
> > >  	if (bytes_todo > (isize - offset))
> > >  		bytes_todo = isize - offset;
> > > -	if (!bytes_todo)
> > > -		return 0;
> > > +	if (bytes_todo < PAGE_SIZE)
> > > +		bytes_todo = PAGE_SIZE;
> > >  
> > >  	for (seg = 0; seg < nr_segs && bytes_todo; seg++) {
> > >  		user_addr = (unsigned long)iov[seg].iov_base;
> > 
> > As 2.6.10-rc1-mm1 failed (as expected), I tried tour fix applied upon
> > 2.6.10-rc1-mm1. This did not make any difference.
> > The only workaround for now is backing out dio-handle-eof-fix.patch and
> > dio-handle-eof.patch
> > I am willing to test anything you could send :)
> 
> Does this work, on top of 2.6.0-rc1-mm1?
> 
> --- /opt/kernel/linux-2.6.10-rc1-mm1/fs/direct-io.c	2004-10-27 08:29:51.000000000 +0200
> +++ linux-2.6.10-rc1-mm1/fs/direct-io.c	2004-11-02 15:36:51.864411244 +0100
> @@ -985,10 +985,12 @@
>  	}
>  
>  	isize = i_size_read(inode);
> -	if (bytes_todo > (isize - offset))
> -		bytes_todo = isize - offset;
> -	if (!bytes_todo)
> -		return 0;
> +	if (bytes_todo > (isize - offset)) {
> +		if ((isize - offset))
> +			bytes_todo = isize - offset;
> +		if (bytes_todo > PAGE_SIZE)
> +			bytes_todo = PAGE_SIZE;
> +	}

Ehm, that should be

		if ((isize - offset))
			bytes_todo = isize - offset;
		else if (bytes_todo > PAGE_SIZE)
			bytes_todo = PAGE_SIZE;


--- /opt/kernel/linux-2.6.10-rc1-mm1/fs/direct-io.c	2004-10-27 08:29:51.000000000 +0200
+++ linux-2.6.10-rc1-mm1/fs/direct-io.c	2004-11-02 15:55:27.918459070 +0100
@@ -985,10 +985,12 @@
 	}
 
 	isize = i_size_read(inode);
-	if (bytes_todo > (isize - offset))
-		bytes_todo = isize - offset;
-	if (!bytes_todo)
-		return 0;
+	if (bytes_todo > (isize - offset)) {
+		if ((isize - offset))
+			bytes_todo = isize - offset;
+		else if (bytes_todo > PAGE_SIZE)
+			bytes_todo = PAGE_SIZE;
+	}
 
 	for (seg = 0; seg < nr_segs && bytes_todo; seg++) {
 		user_addr = (unsigned long)iov[seg].iov_base;
@@ -1008,10 +1010,9 @@
 		dio->curr_page = 0;
 
 		dio->total_pages = 0;
-		if (user_addr & (PAGE_SIZE-1)) {
+		if (user_addr & (PAGE_SIZE-1))
 			dio->total_pages++;
-			bytes -= PAGE_SIZE - (user_addr & (PAGE_SIZE - 1));
-		}
+
 		dio->total_pages += (bytes + PAGE_SIZE - 1) / PAGE_SIZE;
 		dio->curr_user_address = user_addr;
 	

-- 
Jens Axboe


  reply	other threads:[~2004-11-02 15:10 UTC|newest]

Thread overview: 36+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2004-10-23 23:06 2.6.9-mm1: LVM stopped working Mathieu Segaud
2004-10-25 19:03 ` Christophe Saout
2004-10-25 22:31   ` Mathieu Segaud
2004-10-26 11:00   ` Mathieu Segaud
2004-10-26 12:36   ` jfannin1
2004-10-26 13:55     ` Jeff Chua
2004-10-26 14:09       ` Alasdair G Kergon
2004-10-26 13:59     ` Alasdair G Kergon
2004-10-26 21:37       ` 2.6.9-mm1: LVM stopped working (dio-handle-eof.patch) jfannin1
2004-10-26 22:15         ` Andrew Morton
2004-10-27  4:36           ` Mathieu Segaud
2004-10-27  5:26             ` Andrew Morton
2004-10-27  5:47               ` Jens Axboe
2004-10-27  6:41                 ` Jens Axboe
2004-10-27 15:03                   ` Joseph Fannin
2004-10-27 15:29                     ` Alasdair G Kergon
2004-10-27 15:36                   ` Mathieu Segaud
2004-10-27 20:24                     ` Andrew Morton
2004-10-27 20:37                       ` Mathieu Segaud
2004-10-28  4:52                       ` Jeff Chua
2004-10-28 14:56                         ` Alasdair G Kergon
2004-10-29  4:58                           ` Jeff Chua
2004-10-29  5:31                             ` Bernd Eckenfels
2004-10-28 15:49                     ` Valdis.Kletnieks
2004-11-02 14:39                     ` Jens Axboe
2004-11-02 14:55                       ` Jens Axboe [this message]
2004-11-02 15:03                         ` Mathieu Segaud
2004-11-02 17:03                         ` Mathieu Segaud
2004-11-05  6:49                         ` Valdis.Kletnieks
2004-10-27 15:42                   ` Alasdair G Kergon
2004-10-27 18:13                     ` Jeff Chua
2004-10-26 14:00 ` 2.6.9-mm1: LVM stopped working Bartlomiej Zolnierkiewicz
2004-10-26 17:07   ` Bartlomiej Zolnierkiewicz
2004-10-26 17:21     ` Mathieu Segaud
2004-10-26 17:54     ` Mathieu Segaud
2004-10-26 18:04       ` Mathieu Segaud

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=20041102145541.GV6821@suse.de \
    --to=axboe@suse.de \
    --cc=agk@redhat.com \
    --cc=akpm@osdl.org \
    --cc=bzolnier@gmail.com \
    --cc=christophe@saout.de \
    --cc=jfannin1@columbus.rr.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=matt@minas-morgul.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