Re: [RFC][PATCH v5] readahead: introduce O_RANDOM forPOSIX_FADV_RANDOM

From: Wu Fengguang
Date: Mon Jan 04 2010 - 22:27:27 EST


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 <fcntl.h>
#include <stdio.h>

#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
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/