Hello,
Just purging the diffs of my tree. Here's an obvious micro-optimization.
Can't say it had much effect here.
--- linux-2.4.0-test8-pre4/fs/inode.c Mon Aug 28 00:46:38 2000
+++ linux-2.4.0-t8p4-stream/fs/inode.c Tue Sep 5 21:38:34 2000
@@ -182,6 +182,21 @@
inodes_stat.nr_unused--;
}
+static inline void __sync_one(struct inode *inode, int sync, struct list_head *list)
+{
+ list_del(&inode->i_list);
+ list_add(&inode->i_list, list);
+ /* Set I_LOCK, reset I_DIRTY */
+ inode->i_state ^= I_DIRTY | I_LOCK;
+ spin_unlock(&inode_lock);
+
+ write_inode(inode, sync);
+
+ spin_lock(&inode_lock);
+ inode->i_state &= ~I_LOCK;
+ wake_up(&inode->i_wait);
+}
+
static inline void sync_one(struct inode *inode, int sync)
{
if (inode->i_state & I_LOCK) {
@@ -191,22 +206,14 @@
iput(inode);
spin_lock(&inode_lock);
} else {
- list_del(&inode->i_list);
- list_add(&inode->i_list, atomic_read(&inode->i_count)
- ? &inode_in_use
- : &inode_unused);
- /* Set I_LOCK, reset I_DIRTY */
- inode->i_state ^= I_DIRTY | I_LOCK;
- spin_unlock(&inode_lock);
-
- write_inode(inode, sync);
-
- spin_lock(&inode_lock);
- inode->i_state &= ~I_LOCK;
- wake_up(&inode->i_wait);
+ __sync_one(inode, sync, atomic_read(&inode->i_count)
+ ? &inode_in_use
+ : &inode_unused);
}
}
+
+
static inline void sync_list(struct list_head *head)
{
struct list_head * tmp;
@@ -215,6 +222,18 @@
sync_one(list_entry(tmp, struct inode, i_list), 0);
}
+
+static inline void sync_list_unused(struct list_head *head)
+{
+ struct list_head * tmp;
+
+ while ((tmp = head->prev) != head) {
+ struct inode *inode = list_entry(tmp, struct inode, i_list);
+ if (!atomic_read(&inode->i_count) && !(inode->i_state & I_LOCK))
+ __sync_one(inode, 0, &inode_unused);
+ }
+}
+
/**
* sync_inodes
* @dev: device to sync the inodes from.
@@ -248,13 +267,13 @@
/*
* Called with the spinlock already held..
*/
-static void sync_all_inodes(void)
+static void sync_unused_inodes(void)
{
struct super_block * sb = sb_entry(super_blocks.next);
for (; sb != sb_entry(&super_blocks); sb = sb_entry(sb->s_list.next)) {
if (!sb->s_dev)
continue;
- sync_list(&sb->s_dirty);
+ sync_list_unused(&sb->s_dirty);
}
}
@@ -423,8 +442,7 @@
struct inode * inode;
spin_lock(&inode_lock);
- /* go simple and safe syncing everything before starting */
- sync_all_inodes();
+ sync_unused_inodes();
entry = inode_unused.prev;
while (entry != &inode_unused)
--
D.
-
To unsubscribe from this list: send the line "unsubscribe linux-fsdevel" in
the body of a message to [EMAIL PROTECTED]