Softupdate on UFS and "sometimes" slow flash disk

Luca Pizzamiglio l.pizzamiglio at bally-wulff.de
Thu Dec 9 15:42:09 UTC 2010


Hi list,

I'm writing here, hoping this is the right list.

We're using a PC with a Flash PATA module (4GB, non properly a SSD).
The disk is 2.8 GB used (more or less) and the root partition is around 
3.8 GB.
During the update/restore procedure (based on restore(8)) I encountered 
a "disk full message" when the procedure is around 1 GB. After this 
message, the procedure continues without any other problem. At the end, 
disk has, as usual, 1 GB available space.

I investigate deeply the problem and I monitored the 
softdep_request_cleanup() function that frees pending blocks. In one 
case of my scenario it return without freeing nothing, but there are a 
lot of free pending blocks.
After further analysis I discovered that my flash module sometimes is 
dramatically slow (I don't know what the controller is doing...).

softdep_request_cleanup() implements a time control system. Before to 
free blocks, it invokes ffs_update() in a blocking manner. On my 
"sometimes" slow flash module this ffs_update() takes more than 2 
seconds and softdep_request_cleanup() return without freeing.
Other invocations are not so slow and everything is fine.

I know that probably there is some problem inside my flash module, but I 
guess that the initialization of the time control mechanism should be 
made after the ffs_update().

I propose here a patch, that should correct that behavior.

Best regards

Luca Pizzamiglio
-------------- next part --------------
Index: ffs_softdep.c
===================================================================
--- ffs_softdep.c	(revision 3162)
+++ ffs_softdep.c	(working copy)
@@ -5796,7 +5796,6 @@
 	ump = VTOI(vp)->i_ump;
 	mtx_assert(UFS_MTX(ump), MA_OWNED);
 	needed = fs->fs_cstotal.cs_nbfree + fs->fs_contigsumsize;
-	starttime = time_second + tickdelay;
 	/*
 	 * If we are being called because of a process doing a
 	 * copy-on-write, then it is not safe to update the vnode
@@ -5809,6 +5808,7 @@
 		if (error != 0)
 			return (0);
 	}
+	starttime = time_second + tickdelay;
 	while (fs->fs_pendingblocks > 0 && fs->fs_cstotal.cs_nbfree <= needed) {
 		if (time_second > starttime)
 			return (0);


More information about the freebsd-fs mailing list