Re: [RFC][PATCH 2/2] readahead: avoid page-by-page reads on POSIX_FADV_RANDOM

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Wu Fengguang <fengguang.wu@xxxxxxxxx> writes:
>   * the ra fields can be accessed concurrently in a racy way.
> --- linux.orig/mm/fadvise.c	2009-12-30 13:02:03.000000000 +0800
> +++ linux/mm/fadvise.c	2009-12-30 13:23:05.000000000 +0800
> @@ -77,12 +77,14 @@ SYSCALL_DEFINE(fadvise64_64)(int fd, lof
>  	switch (advice) {
>  	case POSIX_FADV_NORMAL:
>  		file->f_ra.ra_pages = bdi->ra_pages;
> +		file->f_ra.flags &= ~RA_FLAG_RANDOM;
>  		break;
>  	case POSIX_FADV_RANDOM:
> -		file->f_ra.ra_pages = 0;
> +		file->f_ra.flags |= RA_FLAG_RANDOM;

What prevents this from racing with a parallel readahead
state modification, losing the bits?

-Andi

-- 
ak@xxxxxxxxxxxxxxx -- Speaking for myself only.
--
To unsubscribe from this list: send the line "unsubscribe linux-fsdevel" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at  http://vger.kernel.org/majordomo-info.html

[Index of Archives]     [Linux Ext4 Filesystem]     [Union Filesystem]     [Filesystem Testing]     [Ceph Users]     [Ecryptfs]     [AutoFS]     [Kernel Newbies]     [Share Photos]     [Security]     [Netfilter]     [Bugtraq]     [Yosemite News]     [MIPS Linux]     [ARM Linux]     [Linux Security]     [Linux Cachefs]     [Reiser Filesystem]     [Linux RAID]     [Samba]     [Device Mapper]     [CEPH Development]
  Powered by Linux