Whamcloud - gitweb
Delete thread patch. First, tried to "fake out" the VFS by twiddling bits in
the inode to keep it around after it should have been destroyed, but no dice.
Then, I tried to allocate a "mock inode" and copy over the existing inode to
that and use it only for the unlink code. Sadly, copying list_head,
semaphore, etc does not work, so you have to end up re-initializing the whole
thing anyways, and it would just break on 2.5 anyways.
Finally, I did the "right" thing - read the same inode into a new struct
inode with iget(), and then flag that inode for "real" destruction and
have the delete thread just do an iput. Very simple, very easy.[*]
I also split the orphan list handling out of the superblock lock into
its own lock, so that we don't get stuck behind the delete thread (which
holds it for long periods doing truncates) when we are trying to add new
inodes to the truncate list.
This code passes basic acceptance testing under UML, but I'm not checking
in the Makefile.am changes that activate it until I give it a shot with
dbench 20 or "rm -r directory_full_of_large_files" so on DEV. Other
people testing it is of course welcome (just add extN-delete_thread.diff
and ext3-orphan_lock.diff to the end of EXTNP).
[*] It reminds me about a story I heard once, where an engineer who had
retired, but was on retainer for his old company in case they needed
him for consulting. Sure enough, the company's complex oil refinery
was not working properly, and after the company engineers couldn't
figure out what was wrong they called the retiree for assistance.
The retiree walked around the refinery, asking questions, looking at
valves and guages, etc., until finally he asked for a hammer, gave a
pipe a swift blow, and told them to fire up the plant again. Sure
enough, all was working properly again, and the company was happy.
Until they got the invoice - $25,000. In an outrage, they called the
retiree up and asked how he could charge $25,000 for just hitting a
pipe with a hammer. In reply, the engineer said "Hitting the pipe
with the hammer was only $10, the other $24,990 was for knowing where
to hit it."