mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: Bruno Diniz de Paula <diniz@cs.rutgers.edu>
To: Andrew Morton <akpm@digeo.com>
Cc: cw@f00f.org, linux-kernel@vger.kernel.org
Subject: Re: O_DIRECT foolish question
Date: 13 Feb 2003 17:45:17 -0500	[thread overview]
Message-ID: <1045176317.938.1.camel@urca.rutgers.edu> (raw)
In-Reply-To: <20030213093144.23ff268e.akpm@digeo.com>

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

Hi Andrew,

it worked perfectly on my box. Now I am going to try in my experiments
environment and I'll let you know if everything was ok.

Thanks a lot,

Bruno.

PS: BTW, is this patch going to be added to 2.4 kernel?

On Thu, 2003-02-13 at 12:31, Andrew Morton wrote:
> Bruno Diniz de Paula <diniz@cs.rutgers.edu> wrote:
> >
> > Thanks, Andrew. So, no chances of getting this working correctly on 2.4
> > kernel for now (I mean, reading files with size != n*block_size), and
> > I'd better give up on this... Is it the case, or you think there is
> > still something to do to get this working on ext2 and 2.4 kernel?
> > 
> 
> Oh I think we can probably fix this up.  Can you test this diff?
> 
> 
> diff -puN fs/buffer.c~o_direct-length-fix fs/buffer.c
> --- 24/fs/buffer.c~o_direct-length-fix	2003-02-13 09:23:34.000000000 -0800
> +++ 24-akpm/fs/buffer.c	2003-02-13 09:24:39.000000000 -0800
> @@ -2107,7 +2107,7 @@ int generic_direct_IO(int rw, struct ino
>  	int length;
>  
>  	length = iobuf->length;
> -	nr_blocks = length / blocksize;
> +	nr_blocks = (length + blocksize - 1) / blocksize;
>  	/* build the blocklist */
>  	for (i = 0; i < nr_blocks; i++, blocknr++) {
>  		struct buffer_head bh;
> @@ -2148,6 +2148,10 @@ int generic_direct_IO(int rw, struct ino
>  	retval = brw_kiovec(rw, 1, &iobuf, inode->i_dev, iobuf->blocks, blocksize);
>  	/* restore orig length */
>  	iobuf->length = length;
> +
> +	/* Return correct value for reads at eof */
> +	if (retval > 0 && retval > length)
> +		retval = length;
>   out:
>  
>  	return retval;
> 
> _
> 
> -
> 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/
-- 
Bruno Diniz de Paula <diniz@cs.rutgers.edu>
Rutgers University

[-- Attachment #2: This is a digitally signed message part --]
[-- Type: application/pgp-signature, Size: 189 bytes --]

  reply	other threads:[~2003-02-13 22:35 UTC|newest]

Thread overview: 19+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2003-02-12 21:19 Bruno Diniz de Paula
2003-02-12 22:03 ` Andrew Morton
2003-02-12 22:29   ` Bruno Diniz de Paula
2003-02-12 22:42     ` Chris Wedgwood
2003-02-12 23:02       ` Bruno Diniz de Paula
2003-02-12 23:22         ` Bruno Diniz de Paula
2003-02-13  1:46           ` Randy.Dunlap
2003-02-12 23:24         ` Chris Wedgwood
2003-02-12 23:33           ` Bruno Diniz de Paula
2003-02-12 23:38             ` Chris Wedgwood
2003-02-12 23:49               ` Bruno Diniz de Paula
2003-02-12 23:51                 ` Chris Wedgwood
     [not found]                   ` <1045094589.4767.106.camel@urca.rutgers.edu>
     [not found]                     ` <20030213001302.GA13833@f00f.org>
2003-02-13  0:36                       ` Bruno Diniz de Paula
2003-02-13  5:12                         ` Andrew Morton
2003-02-13 15:22                           ` Bruno Diniz de Paula
2003-02-13 17:31                             ` Andrew Morton
2003-02-13 22:45                               ` Bruno Diniz de Paula [this message]
2003-02-12 23:33           ` Chris Wedgwood
2003-02-12 22:07 ` Chris Wedgwood

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=1045176317.938.1.camel@urca.rutgers.edu \
    --to=diniz@cs.rutgers.edu \
    --cc=akpm@digeo.com \
    --cc=cw@f00f.org \
    --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®