summaryrefslogtreecommitdiff
path: root/ext2fs
diff options
context:
space:
mode:
authorThomas Bushnell <thomas@gnu.org>1999-06-16 16:56:40 +0000
committerThomas Bushnell <thomas@gnu.org>1999-06-16 16:56:40 +0000
commitd4d93723f01dbe8768e7fac92ce8e655aa499f0a (patch)
treeb3ebf7417099e0b7cb71690ec6be7b2107da6e10 /ext2fs
parent3e4ff0686906db15f48a1156d0814e8842f9df3f (diff)
Tue Jun 15 21:51:58 1999 Thomas Bushnell, BSG <tb@mit.edu>
* pager.c: Clamp the number of free pages we keep around to some reasonably small value. Patch from Mark Kettenis <kettenis@wins.uva.nl>. 1999-06-15 Thomas Bushnell, BSG <tb@mit.edu> * inode.c (diskfs_validate_flags_change): Invert sense of test wrt bits that haven't yet been defined. Reported by Kalle Olavi Niemitalo <tosi@ees2.oulu.fi>.
Diffstat (limited to 'ext2fs')
-rw-r--r--ext2fs/ChangeLog12
-rw-r--r--ext2fs/inode.c8
-rw-r--r--ext2fs/pager.c19
3 files changed, 32 insertions, 7 deletions
diff --git a/ext2fs/ChangeLog b/ext2fs/ChangeLog
index 322eb7c2..ec4cda87 100644
--- a/ext2fs/ChangeLog
+++ b/ext2fs/ChangeLog
@@ -1,3 +1,15 @@
+Tue Jun 15 21:51:58 1999 Thomas Bushnell, BSG <tb@mit.edu>
+
+ * pager.c: Clamp the number of free pages we keep around to some
+ reasonably small value. Patch from Mark Kettenis
+ <kettenis@wins.uva.nl>.
+
+1999-06-15 Thomas Bushnell, BSG <tb@mit.edu>
+
+ * inode.c (diskfs_validate_flags_change): Invert sense of test wrt
+ bits that haven't yet been defined. Reported by Kalle Olavi
+ Niemitalo <tosi@ees2.oulu.fi>.
+
1999-05-23 Roland McGrath <roland@baalperazim.frob.com>
* ialloc.c (diskfs_alloc_node): Frob printf format to suppress warning.
diff --git a/ext2fs/inode.c b/ext2fs/inode.c
index 0e3d01c9..909131d4 100644
--- a/ext2fs/inode.c
+++ b/ext2fs/inode.c
@@ -1,6 +1,6 @@
/* Inode management routines
- Copyright (C) 1994, 1995, 1996, 1997, 1998 Free Software Foundation, Inc.
+ Copyright (C) 1994, 1995, 1996, 1997, 1998, 1999 Free Software Foundation, Inc.
Converted for ext2fs by Miles Bader <miles@gnu.ai.mit.edu>
@@ -373,10 +373,10 @@ diskfs_validate_author_change (struct node *np, uid_t author)
error_t
diskfs_validate_flags_change (struct node *np, int flags)
{
- if (flags & (UF_NODUMP | UF_IMMUTABLE | UF_APPEND))
- return 0;
- else
+ if (flags & ~(UF_NODUMP | UF_IMMUTABLE | UF_APPEND))
return EINVAL;
+ else
+ return 0;
}
/* Writes everything from NP's inode to the disk image, and returns a pointer
diff --git a/ext2fs/pager.c b/ext2fs/pager.c
index ff42ab63..9ff36205 100644
--- a/ext2fs/pager.c
+++ b/ext2fs/pager.c
@@ -68,8 +68,11 @@ do { spin_lock (&ext2s_pager_stats.lock); \
#define STAT_INC(field) /* nop */0
#endif /* STATS */
+#define MAX_FREE_PAGE_BUFS 32
+
static spin_lock_t free_page_bufs_lock = SPIN_LOCK_INITIALIZER;
static void *free_page_bufs = 0;
+static int num_free_page_bufs = 0;
/* Returns a single page page-aligned buffer. */
static void *
@@ -92,6 +95,7 @@ get_page_buf ()
else
{
free_page_bufs = *(void **)buf;
+ num_free_page_bufs--;
spin_unlock (&free_page_bufs_lock);
}
@@ -103,9 +107,18 @@ static void
free_page_buf (void *buf)
{
spin_lock (&free_page_bufs_lock);
- *(void **)buf = free_page_bufs;
- free_page_bufs = buf;
- spin_unlock (&free_page_bufs_lock);
+ if (num_free_page_bufs < MAX_FREE_PAGE_BUFS)
+ {
+ *(void **)buf = free_page_bufs;
+ free_page_bufs = buf;
+ num_free_page_bufs++;
+ spin_unlock (&free_page_bufs_lock);
+ }
+ else
+ {
+ spin_unlock (&free_page_bufs_lock);
+ vm_deallocate (mach_task_self (), (vm_address_t *)buf, vm_page_size);
+ }
}
/* Find the location on disk of page OFFSET in NODE. Return the disk block