lkml.org 
[lkml]   [2004]   [Oct]   [7]   [last100]   RSS Feed
Views: [more markup]  [less markup]  [headers]  [forward] 
 
Messages in this thread
/
DateThu, 7 Oct 2004 07:12:13 -0300
FromMarcelo Tosatti <>
SubjectRe: [patch rfc] towards supporting O_NONBLOCK on regular files
On Thu, Oct 07, 2004 at 04:31:35AM +0100, Stephen C. Tweedie wrote:
> Hi,
> 
> On Wed, 2004-10-06 at 09:01 -0300, Marcelo Tosatti wrote:

> > >  o If O_NONBLOCK is set, read( ) shall return -1 and set errno to [EAGAIN].
> > 
> > This implies read(O_NONBLOCK) should never block.
> 
> The spec is usually pretty careful never to come straight out and
> require that in all cases, even for true AIO.
>
> > Maybe your code should pass down __GFP_FAIL in the gfp_mask 
> > to the page_cache_alloc() to avoid blocking reclaiming pages,
> > and possibly pass info down to the block layer 
> > "if this is going to block, fail".
> 
> It's not just the page allocation that can block, though.  Readahead
> requires us to map the buffers being read before we submit the async
> read, so we can still block reading indirect blocks.  If we want to
> avoid submitting that extra synchronous IO, then either O_NONBLOCK needs
> to avoid readahead entirely for non-present pages, or the readahead
> itself needs to know that it's a O_NONBLOCK IO and fail cleanly if the
> metadata is not in cache.

Hi Stephen!

Oh yes, theres also the indirect blocks which we might need to read from
disk.

Now the question is, how strict should the O_NONBLOCK implementation be 
in reference to "not blocking" ?

Maybe Jeff's currently implementation is just fine avoiding the 
potential block at !PageUptodate.
-
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/

\
 
 \ /
  Last update: 2005-03-22 14:06    [from the cache]
©2003-2008