lkml.org 
[lkml]   [2020]   [Jan]   [28]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
/
Date
From
SubjectRe: [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@infradead.org>
>
> Use the new readahead operation in btrfs
>
> Signed-off-by: Matthew Wilcox (Oracle) <willy@infradead.org>
> Cc: linux-btrfs@vger.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@fromorbit.com

\
 
 \ /
  Last update: 2020-01-29 01:47    [W:0.289 / U:0.100 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site