From mboxrd@z Thu Jan 1 00:00:00 1970 From: Wu Fengguang Subject: Re: [RFC][PATCH v5] readahead: introduce O_RANDOM for POSIX_FADV_RANDOM Date: Tue, 5 Jan 2010 11:27:15 +0800 Message-ID: <20100105032715.GA1044@localhost> References: <20091230052402.GB26364@localhost> <873a2s8hmp.fsf@basil.nowhere.org> <20100104045020.GA21021@localhost> <20100104161719.a0bb35ad.sfr@canb.auug.org.au> <20100104073328.GA3422@infradead.org> <20100104125620.GB12266@localhost> <20100105130322.006c03ee.sfr@canb.auug.org.au> <20100105022650.GB29428@localhost> <20100105132824.e6c0fb7f.sfr@canb.auug.org.au> <20100105031801.GA591@localhost> Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Cc: Christoph Hellwig , 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 , Eric Paris To: Stephen Rothwell Return-path: Content-Disposition: inline In-Reply-To: <20100105031801.GA591@localhost> Sender: linux-kernel-owner@vger.kernel.org List-Id: linux-fsdevel.vger.kernel.org On Tue, Jan 05, 2010 at 11:18:01AM +0800, Wu Fengguang wrote: > > +/* > + * usage of open(O_RANDOM) is disabled: __dentry_open() will nuke this bit > + */ > +#ifndef O_RANDOM > +#define O_RANDOM 0200000000 /* random access pattern hint */ > +#endif > + Tested with this program, output is flags=0x9001 O_SYNC=0x1000 O_RANDOM=0 My user space O_SYNC is still the old O_DSYNC. But should be OK to test the sparc O_SYNC. ------------------------------------------------------------------------------ #include #include #define O_RANDOM 040000000 /* random access pattern hint */ int main (void) { int fd, flags; fd = open("/tmp/fcntl-test", O_WRONLY | O_CREAT | O_SYNC | O_RANDOM, 0666); flags = fcntl(fd, F_GETFL, 0); printf("flags=%#lx O_SYNC=%#lx O_RANDOM=%#lx\n", flags, flags & O_SYNC, flags & O_RANDOM); } ------------------------------------------------------------------------------ Thanks, Fengguang