[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[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)

この情報があなたの探していたものかどうか選択してください。
yes/まさにこれだ!   no/違うなぁ   part/一部見つかった   try/これで試してみる

あなたが探していた情報はどのようなことか、ご自由に記入下さい。特に「まさにこれだ!」と言う場合は記入をお願いします。
例:「複数のマシンからCATV経由でipmasqueradeを利用してWebを参照したい場合の設定について」