patch-2.4.15 linux/mm/shmem.c

Next file: linux/mm/swap.c
Previous file: linux/mm/page_io.c
Back to the patch index
Back to the overall index

diff -u --recursive --new-file v2.4.14/linux/mm/shmem.c linux/mm/shmem.c
@@ -428,11 +428,15 @@
 
 	if (!PageLocked(page))
 		BUG();
+	if (!PageLaunder(page))
+		return fail_writepage(page);
 
 	mapping = page->mapping;
 	index = page->index;
 	inode = mapping->host;
 	info = SHMEM_I(inode);
+	if (info->locked)
+		return fail_writepage(page);
 getswap:
 	swap = get_swap_page();
 	if (!swap.val)
@@ -579,8 +583,6 @@
 
 	/* We have the page */
 	SetPageUptodate(page);
-	if (info->locked)
-		page_cache_get(page);
 	return page;
 no_space:
 	spin_unlock (&sbinfo->stat_lock);
@@ -639,26 +641,9 @@
 {
 	struct inode * inode = file->f_dentry->d_inode;
 	struct shmem_inode_info * info = SHMEM_I(inode);
-	struct page * page;
-	unsigned long idx, size;
 
 	down(&info->sem);
-	if (info->locked == lock) 
-		goto out;
 	info->locked = lock;
-	size = (inode->i_size + PAGE_CACHE_SIZE - 1) >> PAGE_CACHE_SHIFT;
-	for (idx = 0; idx < size; idx++) {
-		page = find_lock_page(inode->i_mapping, idx);
-		if (!page)
-			continue;
-		if (!lock) {
-			/* release the extra count and our reference */
-			page_cache_release(page);
-			page_cache_release(page);
-		}
-		UnlockPage(page);
-	}
-out:
 	up(&info->sem);
 }
 

FUNET's LINUX-ADM group, linux-adm@nic.funet.fi
TCL-scripts by Sam Shen (who was at: slshen@lbl.gov)