add patch avoid-drop-reference-to-iloc.bh-twice
[ext4-patch-queue.git] / fix-prefetchw-of-NULL-page
bloba3154cf8e1eaa163e2aa588606f8b336c7b2c3ac
1 ext4: fix prefetchw of NULL page
3 From: Liu Xiang <liu.xiang6@zte.com.cn>
5 In ext4_mpage_readpages(), if the parameter pages is not NULL, another
6 parameter page is NULL. At the first time prefetchw(&page->flags)
7 works on NULL. From second time, prefetchw(&page->flags) always works on
8 the last consumed page. This might do little improvment for handling
9 current page. So prefetchw() should be called while the page pointer
10 has just been updated.
12 Signed-off-by: Liu Xiang <liu.xiang6@zte.com.cn>
13 Signed-off-by: Theodore Ts'o <tytso@mit.edu>
14 ---
16 Changes in v2:
17  remove prefetchw() when pages is NULL and change comment
19  fs/ext4/readpage.c | 3 ++-
20  1 file changed, 2 insertions(+), 1 deletion(-)
22 diff --git a/fs/ext4/readpage.c b/fs/ext4/readpage.c
23 index 6aa282e..f138c47 100644
24 --- a/fs/ext4/readpage.c
25 +++ b/fs/ext4/readpage.c
26 @@ -126,9 +126,10 @@ int ext4_mpage_readpages(struct address_space *mapping,
27                 int fully_mapped = 1;
28                 unsigned first_hole = blocks_per_page;
30 -               prefetchw(&page->flags);
31                 if (pages) {
32                         page = lru_to_page(pages);
34 +                       prefetchw(&page->flags);
35                         list_del(&page->lru);
36                         if (add_to_page_cache_lru(page, mapping, page->index,
37                                   readahead_gfp_mask(mapping)))
38 -- 
39 1.9.1