summaryrefslogtreecommitdiff
path: root/fs
diff options
context:
space:
mode:
authorAndrew Morton <akpm@zip.com.au>2002-04-09 21:29:59 -0700
committerLinus Torvalds <torvalds@penguin.transmeta.com>2002-04-09 21:29:59 -0700
commitefa1c8b5f358f105122ad7ef2c47a2474098ce4a (patch)
tree652007bc602639cc5e7df5f2cb3b518d00b6b6e4 /fs
parent1ed704e93c0ba1dd930f8a451765f054ba218f1b (diff)
[PATCH] use pdflush for unused inode writeback
This is pdflush's first application! The writeback of the unused inodes list by keventd is removed, and a pdflush thread is dispatched instead. There is a need for exclusion - to prevent all the pdflush threads from working against the same request queue. This is implemented locally. And this is a problem, because other pdflush threads can be dispatched to writeback other filesystem objects, and they don't know that there's already a pdflush thread working that request queue. So moving the exclusion into the request queue itself is on my things-to-do-list. But the code as-is works OK - under a `dbench 100' load the number of pdflush instances can grow as high as four or five. Some fine tuning is needed...
Diffstat (limited to 'fs')
-rw-r--r--fs/inode.c18
1 files changed, 11 insertions, 7 deletions
diff --git a/fs/inode.c b/fs/inode.c
index 29ba87e29414..c6d3a3b864c0 100644
--- a/fs/inode.c
+++ b/fs/inode.c
@@ -433,7 +433,7 @@ void sync_inodes(void)
}
}
-static void try_to_sync_unused_inodes(void * arg)
+static void try_to_sync_unused_inodes(unsigned long pexclusive)
{
struct super_block * sb;
int nr_inodes = inodes_stat.nr_unused;
@@ -450,10 +450,9 @@ static void try_to_sync_unused_inodes(void * arg)
}
spin_unlock(&sb_lock);
spin_unlock(&inode_lock);
+ clear_bit(0, (unsigned long *)pexclusive);
}
-static struct tq_struct unused_inodes_flush_task;
-
/**
* write_inode_now - write an inode to disk
* @inode: inode to write to disk
@@ -746,8 +745,15 @@ void prune_icache(int goal)
* from here or we're either synchronously dogslow
* or we deadlock with oom.
*/
- if (goal)
- schedule_task(&unused_inodes_flush_task);
+ if (goal) {
+ static unsigned long exclusive;
+
+ if (!test_and_set_bit(0, &exclusive)) {
+ if (pdflush_operation(try_to_sync_unused_inodes,
+ (unsigned long)&exclusive))
+ clear_bit(0, &exclusive);
+ }
+ }
}
/*
* This is called from kswapd when we think we need some
@@ -1173,8 +1179,6 @@ void __init inode_init(unsigned long mempages)
NULL);
if (!inode_cachep)
panic("cannot create inode slab cache");
-
- unused_inodes_flush_task.routine = try_to_sync_unused_inodes;
}
static inline void do_atime_update(struct inode *inode)