lkml.org 
[lkml]   [2000]   [Sep]   [14]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
Patch in this message
/
Date
From
Subject[PATCH 2.4.0-test8] mm/filemap.c
Hi Linus,

Here's a small optimization for the mm/filemap.c file.

- The `head = &mapping->pages;' statement is useless inside the
repeat, since head isn't modified inside the loop.
- The `curr = curr->next;' statement doesn't need to be executed
if the repeat is taken. I changed the while() into a for() loop
to accomodate this better.

Share and enjoy!

--
|| Bill Wendling wendling@ganymede.isdn.uiuc.edu
--- linux-2.4.0-test8/mm/filemap.c Sat Sep 9 02:35:09 2000
+++ linux-2.4.0-test8-new/mm/filemap.c Thu Sep 14 03:14:06 2000
@@ -189,16 +189,14 @@
unsigned long start;

start = (lstart + PAGE_CACHE_SIZE - 1) >> PAGE_CACHE_SHIFT;
+ head = &mapping->pages;

repeat:
- head = &mapping->pages;
spin_lock(&pagecache_lock);
- curr = head->next;
- while (curr != head) {
+ for (curr = head->next; curr != head; curr = curr->next) {
unsigned long offset;

page = list_entry(curr, struct page, list);
- curr = curr->next;
offset = page->index;

/* Is one of the pages to truncate? */
\
 
 \ /
  Last update: 2005-03-22 12:38    [W:0.043 / U:0.148 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site