Skip to contentSkip to conversation

remove add_to_page_cache_unique()

PATCH In review Andrew Morton 2 participants 2 messages Jul 17, 2002

Subsystems (4)
lore
Share & tools
lore
#0 lore raw

PATCH 10/13 remove add_to_page_cache_unique()

A tasty patch from Hugh Dickens. radix_tree_insert() fails if something was already present at the target index, so that error can be propagated back through add_to_page_cache(). Hence add_to_page_cache_unique() is obsolete.

Hugh's patch removes add_to_page_cache_unique() and cleans up a bunch of stuff.

 fs/mpage.c              |    2 
 include/linux/pagemap.h |    2 
 mm/filemap.c            |  182 +++++++++++++-----------------------------------
 mm/readahead.c          |    2 
 mm/swap_state.c         |    3 
 5 files changed, 53 insertions(+), 138 deletions(-)
fs/mpage.c renamed from fs/mpage.c~hugh-add_to_page_cache +1 -1
@@ -268,7 +268,7 @@ mpage_readpages(struct address_space *ma
 
 		prefetchw(&page->flags);
 		list_del(&page->list);
-		if (!add_to_page_cache_unique(page, mapping, page->index))
+		if (!add_to_page_cache(page, mapping, page->index))
 			bio = do_mpage_readpage(bio, page,
 					nr_pages - page_idx,
 					&last_block_in_bio, get_block);
include/linux/pagemap.h renamed from include/linux/pagemap.h~hugh-add_to_page_cache +0 -2
@@ -52,8 +52,6 @@ extern struct page * read_cache_page(str
 
 extern int add_to_page_cache(struct page *page,
 		struct address_space *mapping, unsigned long index);
-extern int add_to_page_cache_unique(struct page *page,
-		struct address_space *mapping, unsigned long index);
 
 static inline void ___add_to_page_cache(struct page *page,
 		struct address_space *mapping, unsigned long index)
mm/filemap.c renamed from mm/filemap.c~hugh-add_to_page_cache +50 -132

292 lines not on this page · raw message

mm/readahead.c renamed from mm/readahead.c~hugh-add_to_page_cache +1 -1
@@ -43,7 +43,7 @@ read_pages(struct file *file, struct add
 	for (page_idx = 0; page_idx < nr_pages; page_idx++) {
 		struct page *page = list_entry(pages->prev, struct page, list);
 		list_del(&page->list);
-		if (!add_to_page_cache_unique(page, mapping, page->index))
+		if (!add_to_page_cache(page, mapping, page->index))
 			mapping->a_ops->readpage(file, page);
 		page_cache_release(page);
 	}
mm/swap_state.c renamed from mm/swap_state.c~hugh-add_to_page_cache +1 -2
@@ -75,8 +75,7 @@ int add_to_swap_cache(struct page *page,
 		INC_CACHE_INFO(noent_race);
 		return -ENOENT;
 	}
-
-	error = add_to_page_cache_unique(page, &swapper_space, entry.val);
+	error = add_to_page_cache(page, &swapper_space, entry.val);
 	if (error != 0) {
 		swap_free(entry);
 		if (error == -EEXIST)

.

#1 lore raw
Quoted 7 lines · Andrew Morton

A tasty patch from Hugh Dickens. radix_tree_insert() fails if something was already present at the target index, so that error can be propagated back through add_to_page_cache(). Hence add_to_page_cache_unique() is obsolete.

Hugh's patch removes add_to_page_cache_unique() and cleans up a bunch of stuff.

:-) A large bouquet to Hugh, and another to Momchil Velikov for recoring the whole interface in the first place.

Signature · 1 line
Daniel