lkml.org 
[lkml]   [2000]   [Aug]   [20]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
Patch in this message
/
Date
From
Subject[PATCH] __add_to_page_cache() - remove redundant code
Hi,

Looking at 2.4.0-test7pre5, but the code (which adds no value - not even
sanity) has been present for sometime.

__add_to_page_cache(), in mm/filemap.c, is re-checking the page cache
after adding a new entry (obviously, as a sanity check);

__add_to_page_cache(...)
{
....
add-new-page-to-cache;
alias = __find_page_nolock(mapping, offset, *hash);
if (alias != page)
BUG();
}

As new pages are always be added to the head of a chain in the page
cache, and the search always start at a head, the alias check isn't
much of a sanity check; it will always find the page just added - and
never an alias, which will be further down the chain.

The attached patch removes the dead code.

Mark


diff -ur -X ignore --new-file linux-2.4.0-test7pre5/mm/filemap.c markhe-2.4.0-test7pre5/mm/filemap.c
--- linux-2.4.0-test7pre5/mm/filemap.c Sun Aug 20 15:45:37 2000
+++ markhe-2.4.0-test7pre5/mm/filemap.c Sun Aug 20 18:00:17 2000
@@ -513,7 +513,6 @@
struct address_space *mapping, unsigned long offset,
struct page **hash)
{
- struct page *alias;
unsigned long flags;

if (PageLocked(page))
@@ -526,9 +525,6 @@
add_page_to_inode_queue(mapping, page);
__add_page_to_hash_queue(page, hash);
lru_cache_add(page);
- alias = __find_page_nolock(mapping, offset, *hash);
- if (alias != page)
- BUG();
}

void add_to_page_cache(struct page * page, struct address_space * mapping, unsigned long offset)
\
 
 \ /
  Last update: 2005-03-22 12:37    [W:0.020 / U:4.220 seconds]
©2003-2018 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site