Subject: softdep improvement
To: None <tech-kern@netbsd.org>
From: Matthias Drochner <M.Drochner@fz-juelich.de>
List: tech-kern
Date: 06/28/2006 19:40:22
This is a multipart MIME message.
--==_Exmh_9338396144360
Content-Type: text/plain; charset=us-ascii
Hi -
here is a patch to softdep code which appears to have a good effect
on recovery after crashes for me. I've been running it on my laptop
for a couple of days, and haven't seen any bad effect, whether the
box was running or crashing.
How about pulling this in?
Here is the original changelog, with a paragraph about background fsck
left out:
> revision 1.185 date: 2005/09/29 21:50:26; author: truckman; state:
> Exp; lines: +2 -0
> After a rmdir()ed directory has been truncated,
> force an update of the directory's inode after queuing the dirrem that
> will decrement the parent directory's link count. This will force the
> update of the parent directory's actual link to actually be scheduled.
> Without this change the parent directory's actual link count would
> not be updated until ufs_inactive() cleared the inode of the newly
> removed directory, which might be deferred indefinitely.
> ufs_inactive() will not be called as long as any process holds a
> reference to the removed directory, and ufs_inactive() will not clear
> the inode if the link count is non-zero, which could be the result of
> an earlier system crash.
> [...]
> This change has the fortunate side effect of more quickly cleaning up
> the large number dirrem structures that linger for an extended time
> after the removal of a large directory tree. It also fixes a
> potential problem with the shutdown of the syncer thread timing out if
> the system is rebooted immediately after removing a large directory
> tree.
best regards
Matthias
--==_Exmh_9338396144360
Content-Type: text/plain ; name="dirsd.txt"; charset=us-ascii
Content-Description: dirsd.txt
Content-Disposition: attachment; filename="dirsd.txt"
Index: ffs_softdep.c
===================================================================
RCS file: /cvsroot/src/sys/ufs/ffs/ffs_softdep.c,v
retrieving revision 1.75
diff -u -p -r1.75 ffs_softdep.c
--- ffs_softdep.c 12 Jun 2006 16:37:00 -0000 1.75
+++ ffs_softdep.c 28 Jun 2006 16:46:29 -0000
@@ -3346,6 +3346,8 @@ handle_workitem_remove(dirrem)
}
WORKLIST_INSERT(&inodedep->id_inowait, &dirrem->dm_list);
FREE_LOCK(&lk);
+ ip->i_flag |= IN_CHANGE;
+ ffs_update(vp, NULL, NULL, 0);
vput(vp);
}
--==_Exmh_9338396144360--