2001-02-03 19:03:08

by Mike Galbraith

[permalink] [raw]
Subject: [patch?] RAMFS

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;
}



2001-02-04 06:33:04

by Mike Galbraith

[permalink] [raw]
Subject: Re: [patch?] RAMFS

On Sat, 3 Feb 2001, Mike Galbraith wrote:

> Hi,
>
> With the patch below...

However, tmpfs appears to cover the functionality provided by ramfs.
Are there any uses for ramfs which can't be handled by tmpfs?

The only thing I could think of was "what if you don't have a
swap device up and running". Seems it doesn't need one :))

-Mike

2001-02-04 09:48:20

by Christoph Rohland

[permalink] [raw]
Subject: Re: [patch?] RAMFS

Mike Galbraith <[email protected]> writes:

> However, tmpfs appears to cover the functionality provided by ramfs.
> Are there any uses for ramfs which can't be handled by tmpfs?

Nothing I know of.

> The only thing I could think of was "what if you don't have a
> swap device up and running". Seems it doesn't need one :))

Yes and no. tmpfs has a little bit overhead for the noswap case but
this overhead is in the kernel anyways for shared anon mappings. The
whole vm is using swap unconditionally.

Greetings
Christoph



2001-02-04 13:48:57

by David Woodhouse

[permalink] [raw]
Subject: Re: [patch?] RAMFS

On 4 Feb 2001, Christoph Rohland wrote:

> Yes and no. tmpfs has a little bit overhead for the noswap case but
> this overhead is in the kernel anyways for shared anon mappings. The
> whole vm is using swap unconditionally.

I'm hoping that'll end up conditional on CONFIG_BLK_DEV or CONFIG_SWAP.

--
dwmw2