[patch] Re: stalled 'sync' on ext3+quota over drbd

Stephen C. Tweedie sct at redhat.com
Fri Apr 16 21:19:23 UTC 2004


Hi,

On Tue, 2004-04-06 at 13:50, Eugene Crosser wrote:
> More representative statistics for my "quota on ext3" trouble:
> 
> after moving about 10,000 files and setting quota for a million
> groupids, and then several hours of inactivity(!) I zeroed profile
> counters (readprofile -r), ran `time sync' and then `readprofile'.  Here
> are the results.  Yes, that's true, it took 3 (three) hours for `sync'
> to complete!

Turns out there's a nasty O(N^2) behaviour in vfs_quota_sync().  That
function walks the dquot list looking for things to sync, and it drops
the lock when doing the actual syncing --- so each item synced causes it
to start again at the beginning of the list.  If each item starts off
dirty, then the list walk is N^2.

An obvious cure is to shift the start of the list to point just after
the item just synced.  I've done only limited testing of this patch, but
does it help for you?

2.4 and 2.6 seem to share this problem.

Cheers,
 Stephen

-------------- next part --------------
--- linux-2.4/fs/dquot.c.=K0000=.orig
+++ linux-2.4/fs/dquot.c
@@ -397,6 +397,10 @@ restart:
 			wait_on_dquot(dquot);
 		if (dquot_dirty(dquot))
 			sb->dq_op->write_dquot(dquot);
+		/* Move the inuse_list head pointer to just after the
+		 * current dquot, so that we'll restart the list walk
+		 * after this point on the next pass. */
+		list_move(&inuse_list, &dquot->dq_inuse);
 		dqput(dquot);
 		goto restart;
 	}


More information about the Ext3-users mailing list