[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <20111129122951.GA17432@localhost>
Date: Tue, 29 Nov 2011 20:29:51 +0800
From: Wu Fengguang <fengguang.wu@...el.com>
To: Andrew Morton <akpm@...ux-foundation.org>
Cc: Linux Memory Management List <linux-mm@...ck.org>,
"linux-fsdevel@...r.kernel.org" <linux-fsdevel@...r.kernel.org>,
Ingo Molnar <mingo@...e.hu>,
Jens Axboe <jens.axboe@...cle.com>,
Peter Zijlstra <a.p.zijlstra@...llo.nl>,
Rik van Riel <riel@...hat.com>,
LKML <linux-kernel@...r.kernel.org>,
Andi Kleen <andi@...stfloor.org>
Subject: Re: [PATCH 5/8] readahead: add /debug/readahead/stats
> int force_page_cache_readahead(struct address_space *mapping, struct file *filp,
> pgoff_t offset, unsigned long nr_to_read)
> {
> + struct file_ra_state fadvice_ra = {
> + .pattern = RA_PATTERN_FADVISE,
> + };
> int ret = 0;
>
> if (unlikely(!mapping->a_ops->readpage && !mapping->a_ops->readpages))
> @@ -222,8 +397,9 @@ int force_page_cache_readahead(struct ad
>
> if (this_chunk > nr_to_read)
> this_chunk = nr_to_read;
> - err = __do_page_cache_readahead(mapping, filp,
> - offset, this_chunk, 0);
> + fadvice_ra.start = offset;
> + fadvice_ra.size = this_chunk;
> + err = ra_submit(&fadvice_ra, mapping, filp, offset, nr_to_read);
> if (err < 0) {
> ret = err;
> break;
It looks that we can safely use filp->f_ra:
@@ -214,6 +386,7 @@ int force_page_cache_readahead(struct ad
if (unlikely(!mapping->a_ops->readpage && !mapping->a_ops->readpages))
return -EINVAL;
+ filp->f_ra.pattern = RA_PATTERN_FADVISE;
nr_to_read = max_sane_readahead(nr_to_read);
while (nr_to_read) {
int err;
@@ -222,8 +395,9 @@ int force_page_cache_readahead(struct ad
if (this_chunk > nr_to_read)
this_chunk = nr_to_read;
- err = __do_page_cache_readahead(mapping, filp,
- offset, this_chunk, 0);
+ filp->f_ra.start = offset;
+ filp->f_ra.size = this_chunk;
+ err = ra_submit(&filp->f_ra, mapping, filp, offset, nr_to_read);
if (err < 0) {
ret = err;
break;
But still, it adds one more function call to the fadvise path.
Thanks,
Fengguang
--
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