[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <20200119030123.GA223124@architecture4>
Date: Sun, 19 Jan 2020 11:01:25 +0800
From: Gao Xiang <gaoxiang25@...wei.com>
To: "yukuai (C)" <yukuai3@...wei.com>
CC: Matthew Wilcox <willy@...radead.org>, <hch@...radead.org>,
<darrick.wong@...cle.com>, <linux-xfs@...r.kernel.org>,
<linux-fsdevel@...r.kernel.org>, <linux-kernel@...r.kernel.org>,
<houtao1@...wei.com>, <zhengbin13@...wei.com>,
<yi.zhang@...wei.com>
Subject: Re: [RFC] iomap: fix race between readahead and direct write
On Sun, Jan 19, 2020 at 10:51:37AM +0800, yukuai (C) wrote:
>
>
> Then, there might be a problem in your implementation.
> if 'use_list' is set to true here:
> + bool use_list = mapping->a_ops->readpages;
>
> Your code do not call add_to_page_cache_lru for the page.
IMO, if use_list == true, it will call read_pages -> .readpages
and go just like the current implementation.
->.readahead is just alloc_page and then add_to_page_cache_lru
right after in time and in principle it saves some extra page
allocation.
Thanks,
Gao Xiang
> + if (use_list) {
> + page->index = page_offset;
> + list_add(&page->lru, &page_pool);
> + } else if (!add_to_page_cache_lru(page, mapping, page_offset,
> + gfp_mask)) {
> + if (nr_pages)
> + read_pages(mapping, filp, &page_pool,
> + page_offset - nr_pages,
> + nr_pages);
> + nr_pages = 0;
> + continue;
> + }
>
Powered by blists - more mailing lists