From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1760169AbXGXGjX (ORCPT ); Tue, 24 Jul 2007 02:39:23 -0400 Received: (majordomo@vger.kernel.org) by vger.kernel.org id S1753672AbXGXGjQ (ORCPT ); Tue, 24 Jul 2007 02:39:16 -0400 Received: from smtp.ustc.edu.cn ([202.38.64.16]:48084 "HELO ustc.edu.cn" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with SMTP id S1753849AbXGXGjP (ORCPT ); Tue, 24 Jul 2007 02:39:15 -0400 Message-ID: <385259144.05062@ustc.edu.cn> X-EYOUMAIL-SMTPAUTH: wfg@mail.ustc.edu.cn Date: Tue, 24 Jul 2007 14:27:44 +0800 From: Fengguang Wu To: Andrew Morton Cc: linux-kernel@vger.kernel.org, Peter Zijlstra Subject: Re: [PATCH 03/10] readahead: combine file_ra_state.prev_index/prev_offset into prev_pos Message-ID: <20070724062744.GA6686@mail.ustc.edu.cn> Mail-Followup-To: Andrew Morton , linux-kernel@vger.kernel.org, Peter Zijlstra References: <20070724020009.677809022@mail.ustc.edu.cn> <385243122.57859@ustc.edu.cn> <20070723205535.d08338fc.akpm@linux-foundation.org> <385252215.04204@ustc.edu.cn> <20070723215310.0a032635.akpm@linux-foundation.org> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20070723215310.0a032635.akpm@linux-foundation.org> X-GPG-Fingerprint: 53D2 DDCE AB5C 8DC6 188B 1CB1 F766 DA34 8D8B 1C6D User-Agent: Mutt/1.5.13 (2006-08-11) Sender: linux-kernel-owner@vger.kernel.org X-Mailing-List: linux-kernel@vger.kernel.org On Mon, Jul 23, 2007 at 09:53:10PM -0700, Andrew Morton wrote: > On Tue, 24 Jul 2007 12:32:15 +0800 Fengguang Wu wrote: > > > On Mon, Jul 23, 2007 at 08:55:35PM -0700, Andrew Morton wrote: > > > On Tue, 24 Jul 2007 10:00:12 +0800 Fengguang Wu wrote: > > > > > > > @@ -342,11 +342,9 @@ ondemand_readahead(struct address_space > > > > bool hit_readahead_marker, pgoff_t offset, > > > > unsigned long req_size) > > > > { > > > > - int max; /* max readahead pages */ > > > > - int sequential; > > > > - > > > > - max = ra->ra_pages; > > > > - sequential = (offset - ra->prev_index <= 1UL) || (req_size > max); > > > > + int max = ra->ra_pages; /* max readahead pages */ > > > > + pgoff_t prev_offset; > > > > + int sequential; > > > > > > > > /* > > > > * It's the expected callback offset, assume sequential access. > > > > @@ -360,6 +358,9 @@ ondemand_readahead(struct address_space > > > > goto readit; > > > > } > > > > > > > > + prev_offset = ra->prev_pos >> PAGE_CACHE_SHIFT; > > > > + sequential = offset - prev_offset <= 1UL || req_size > max; > > > > > > It's a bit pointless using an opaque type for prev_offset here, and then > > > encoding the knowledge that it is implemented as "unsigned long". > > > > > > It's a minor thing, but perhaps just "<= 1" would make more sense here. > > > > Yeah, "<= 1" is OK. But the expression still requires pgoff_t to be > > 'unsigned' to work correctly. > > > > So what about "<= 1U"? > > umm, if one really cared one could do > > == 1 || == 0 Yeah, I'd prefer this if we are to change it. > or something. But whatever - let's leave it as-is.