From mboxrd@z Thu Jan 1 00:00:00 1970 From: Wu Fengguang Subject: Re: [RFC][PATCH v3] readahead: introduce O_RANDOM for POSIX_FADV_RANDOM Date: Mon, 4 Jan 2010 20:16:42 +0800 Message-ID: <20100104121642.GA12266@localhost> References: <20091225000717.GA26949@yahoo-inc.com> <87aax18xms.fsf@basil.nowhere.org> <20091230051540.GA16308@localhost> <20091230052402.GB26364@localhost> <873a2s8hmp.fsf@basil.nowhere.org> <20100104045020.GA21021@localhost> <28c262361001032120v284e92b5ub1211f3d1fca6140@mail.gmail.com> Mime-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: QUOTED-PRINTABLE Cc: Andi Kleen , Andrew Morton , Quentin Barnes , "linux-kernel@vger.kernel.org" , "linux-fsdevel@vger.kernel.org" , Nick Piggin , Steven Whitehouse , David Howells , Al Viro , Jonathan Corbet , Christoph Hellwig To: Minchan Kim Return-path: Content-Disposition: inline In-Reply-To: <28c262361001032120v284e92b5ub1211f3d1fca6140@mail.gmail.com> Sender: linux-kernel-owner@vger.kernel.org List-Id: linux-fsdevel.vger.kernel.org Hi Minchan, On Mon, Jan 04, 2010 at 01:20:49PM +0800, Minchan Kim wrote: > > --- linux.orig/mm/readahead.c =C2=A0 2010-01-04 12:39:29.000000000 = +0800 > > +++ linux/mm/readahead.c =C2=A0 =C2=A0 =C2=A0 =C2=A02010-01-04 12:3= 9:30.000000000 +0800 > > @@ -501,6 +501,12 @@ void page_cache_sync_readahead(struct ad > > =C2=A0 =C2=A0 =C2=A0 =C2=A0if (!ra->ra_pages) > > =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0return; > > > > + =C2=A0 =C2=A0 =C2=A0 /* be dumb */ > > + =C2=A0 =C2=A0 =C2=A0 if (filp->f_flags & O_RANDOM) { > > + =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 force_page_cache= _readahead(mapping, filp, offset, req_size); > > + =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 return; > > + =C2=A0 =C2=A0 =C2=A0 } > > + >=20 > Let me have a dumb question. :) >=20 > How about testing O_RANDOM in front of ra_pages testing? >=20 > My intention is that although we turn off ra, it would be better to r= ead > contiguous block all at once than readpage() callback doing I/O > one page at a time. >=20 > Is it break some semantics or happen some problem in ondemand readahe= ad? Yes it will have some problem with shrink_readahead_size_eio(), which want to disable readahead and use ->readpage() when ra_pages=3D=3D0. Do you have specific use case in mind? The file systems that set ra_pages=3D0 seems to don't need readahead, too.=20 Thanks, =46engguang