[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-Id: <20111121153624.dea4f320.akpm@linux-foundation.org>
Date: Mon, 21 Nov 2011 15:36:24 -0800
From: Andrew Morton <akpm@...ux-foundation.org>
To: Wu Fengguang <fengguang.wu@...el.com>
Cc: Linux Memory Management List <linux-mm@...ck.org>,
<linux-fsdevel@...r.kernel.org>, Rik van Riel <riel@...hat.com>,
Linus Torvalds <torvalds@...ux-foundation.org>,
LKML <linux-kernel@...r.kernel.org>,
Andi Kleen <andi@...stfloor.org>
Subject: Re: [PATCH 8/8] readahead: dont do start-of-file readahead after
lseek()
On Mon, 21 Nov 2011 17:18:27 +0800
Wu Fengguang <fengguang.wu@...el.com> wrote:
> Some applications (eg. blkid, id3tool etc.) seek around the file
> to get information. For example, blkid does
>
> seek to 0
> read 1024
> seek to 1536
> read 16384
>
> The start-of-file readahead heuristic is wrong for them, whose
> access pattern can be identified by lseek() calls.
ah, there we are.
> Acked-by: Rik van Riel <riel@...hat.com>
> Acked-by: Linus Torvalds <torvalds@...ux-foundation.org>
> Signed-off-by: Wu Fengguang <fengguang.wu@...el.com>
> ---
> fs/read_write.c | 4 ++++
> include/linux/fs.h | 1 +
> mm/readahead.c | 3 +++
> 3 files changed, 8 insertions(+)
>
> --- linux-next.orig/mm/readahead.c 2011-11-20 22:02:01.000000000 +0800
> +++ linux-next/mm/readahead.c 2011-11-20 22:02:03.000000000 +0800
> @@ -629,6 +629,8 @@ ondemand_readahead(struct address_space
> * start of file
> */
> if (!offset) {
> + if ((ra->ra_flags & READAHEAD_LSEEK) && req_size < max)
> + goto random_read;
> ra_set_pattern(ra, RA_PATTERN_INITIAL);
> goto initial_readahead;
> }
> @@ -707,6 +709,7 @@ ondemand_readahead(struct address_space
> if (try_context_readahead(mapping, ra, offset, req_size, max))
> goto readit;
>
> +random_read:
> /*
> * standalone, small random read
> */
> --- linux-next.orig/fs/read_write.c 2011-11-20 22:02:01.000000000 +0800
> +++ linux-next/fs/read_write.c 2011-11-20 22:02:03.000000000 +0800
> @@ -47,6 +47,10 @@ static loff_t lseek_execute(struct file
> file->f_pos = offset;
> file->f_version = 0;
> }
> +
> + if (!(file->f_ra.ra_flags & READAHEAD_LSEEK))
> + file->f_ra.ra_flags |= READAHEAD_LSEEK;
> +
> return offset;
> }
Confused. How does READAHEAD_LSEEK get cleared again?
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@...r.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/
Powered by blists - more mailing lists