All of lore.kernel.org
 help / color / mirror / Atom feed
* [patch?] RAMFS
@ 2001-02-03 19:02 Mike Galbraith
  2001-02-04  6:32 ` Mike Galbraith
  0 siblings, 1 reply; 4+ messages in thread
From: Mike Galbraith @ 2001-02-03 19:02 UTC (permalink / raw)
  To: linux-kernel; +Cc: Alan Cox

Hi,

With the patch below, ramfs will withstand make -j20 (binutils)
even while an iozone is running, and cp /dev/zero zero.  These
fail as is.  The problem seems to be in the way writepage() is
called.. ClearPageDirty(); writepage().  That screws up ramfs's
beancounting and makes it wipe pages and do double accounting.
(df;cp /dev/zero zero;rm zero;df to see accounting woes).

Accounting only from ramfs_prepare_write() seems to be enough for
the page limit to function (whodathunkit;)

	-Mike

--- linux-2.4.1.ac2/fs/ramfs/inode.c.org	Sat Feb  3 10:29:54 2001
+++ linux-2.4.1.ac2/fs/ramfs/inode.c	Sat Feb  3 19:22:08 2001
@@ -173,11 +173,8 @@
 	       (inode->i_data.nrpages <= rsb->max_file_pages) ) ) {
 		inode->i_blocks += IBLOCKS_PER_PAGE;
 		rsb->free_pages--;
-		SetPageDirty(page);
-	} else {
-		ClearPageUptodate(page);
+	} else
 		ret = 0;
-	}
 	
 	unlock_rsb(rsb);
 
@@ -259,13 +256,7 @@
  */
 static int ramfs_writepage(struct page *page)
 {
-	struct inode *inode = (struct inode *)page->mapping->host;
-
-	if (! ramfs_alloc_page(inode, page))
-	{
-		UnlockPage(page);
-		return -ENOSPC;
-	}
+	SetPageDirty(page);
 	UnlockPage(page);
 	return 0;
 }
@@ -275,9 +266,8 @@
 	struct inode *inode = (struct inode *)page->mapping->host;
 	void *addr;
 	
-	if (! ramfs_alloc_page(inode, page)) {
+	if (! ramfs_alloc_page(inode, page))
 		return -ENOSPC;
-	}
 
 	addr = (void *) kmap(page);
 	if (!Page_Uptodate(page)) {
@@ -285,6 +275,7 @@
 		flush_dcache_page(page);
 		SetPageUptodate(page);
 	}
+	SetPageDirty(page);
 	return 0;
 }
 

-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@vger.kernel.org
Please read the FAQ at http://www.tux.org/lkml/

^ permalink raw reply	[flat|nested] 4+ messages in thread

end of thread, other threads:[~2001-02-04 13:48 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2001-02-03 19:02 [patch?] RAMFS Mike Galbraith
2001-02-04  6:32 ` Mike Galbraith
2001-02-04  9:53   ` Christoph Rohland
2001-02-04 13:48     ` David Woodhouse

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.