[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <20200129004609.GI18610@dread.disaster.area>
Date: Wed, 29 Jan 2020 11:46:09 +1100
From: Dave Chinner <david@...morbit.com>
To: Matthew Wilcox <willy@...radead.org>
Cc: linux-fsdevel@...r.kernel.org, linux-mm@...ck.org,
linux-kernel@...r.kernel.org, linux-btrfs@...r.kernel.org
Subject: Re: [PATCH 06/12] btrfs: Convert from readpages to readahead
On Fri, Jan 24, 2020 at 05:35:47PM -0800, Matthew Wilcox wrote:
> From: "Matthew Wilcox (Oracle)" <willy@...radead.org>
>
> Use the new readahead operation in btrfs
>
> Signed-off-by: Matthew Wilcox (Oracle) <willy@...radead.org>
> Cc: linux-btrfs@...r.kernel.org
> ---
> fs/btrfs/extent_io.c | 15 ++++-----------
> fs/btrfs/extent_io.h | 2 +-
> fs/btrfs/inode.c | 18 +++++++++---------
> 3 files changed, 14 insertions(+), 21 deletions(-)
>
> diff --git a/fs/btrfs/extent_io.c b/fs/btrfs/extent_io.c
> index 2f4802f405a2..b1e2acbec165 100644
> --- a/fs/btrfs/extent_io.c
> +++ b/fs/btrfs/extent_io.c
> @@ -4283,7 +4283,7 @@ int extent_writepages(struct address_space *mapping,
> return ret;
> }
>
> -int extent_readpages(struct address_space *mapping, struct list_head *pages,
> +unsigned extent_readahead(struct address_space *mapping, pgoff_t start,
> unsigned nr_pages)
> {
> struct bio *bio = NULL;
> @@ -4294,20 +4294,13 @@ int extent_readpages(struct address_space *mapping, struct list_head *pages,
> int nr = 0;
> u64 prev_em_start = (u64)-1;
>
> - while (!list_empty(pages)) {
> + while (nr_pages) {
> u64 contig_end = 0;
>
> - for (nr = 0; nr < ARRAY_SIZE(pagepool) && !list_empty(pages);) {
> - struct page *page = lru_to_page(pages);
> + for (nr = 0; nr < ARRAY_SIZE(pagepool) && nr_pages--;) {
What is stopping nr_pages from going negative here, and then looping
forever on the outer nr_pages loop? Perhaps "while(nr_pages > 0) {"
would be better there?
-Dave.
--
Dave Chinner
david@...morbit.com
Powered by blists - more mailing lists