/**
* write_inode_now - write an inode to disk
@@ -753,7 +754,7 @@ int invalidate_device(kdev_t dev, int do
!inode_has_buffers(inode))
#define INODE(entry) (list_entry(entry, struct inode, i_list))
dispose_list(freeable);
-
- /*
- * If we didn't freed enough clean inodes schedule
- * a sync of the dirty inodes, we cannot do it
- * from here or we're either synchronously dogslow
- * or we deadlock with oom.
- */
+ kmem_cache_shrink(inode_cachep);
if (goal)
- schedule_task(&unused_inodes_flush_task);
+ try_to_sync_unused_inodes();
+}
+
+void prune_icache(int goal) {
+ atomic_add(goal, &kinoded_goal);
+ if (atomic_read(&kinoded_goal) > 16) {
+ wake_up_interruptible(&kinoded_wait);
+ }
}
int shrink_icache_memory(int priority, int gfp_mask)
{
int count = 0;
-
- /*
- * Nasty deadlock avoidance..
- *
- * We may hold various FS locks, and we don't
- * want to recurse into the FS that called us
- * in clear_inode() and friends..
- */
- if (!(gfp_mask & __GFP_FS))
- return 0;
-
count = inodes_stat.nr_unused / priority;
-
prune_icache(count);
- return kmem_cache_shrink(inode_cachep);
+ return 0;
}
/*
@@ -1198,6 +1188,35 @@ int bmap(struct inode * inode, int block
return res;
}
- unused_inodes_flush_task.routine = try_to_sync_unused_inodes;
+/* we need to start a thread, and inode_init happens too early for that
+** to work. So, add a second init func through module_init
+*/
+static int __init inode_mod_init(void)
+{
+ static struct completion startup __initdata = COMPLETION_INITIALIZER(startup);
+ kernel_thread(kinoded, &startup, CLONE_FS | CLONE_FILES | CLONE_SIGNAL);
+ wait_for_completion(&startup);
+ return 0;
}