Re: [RFC] readdir mess

Previous message: [thread] [date] [author]
Next message: [thread] [date] [author]
From: Brad Boyer
Date: Wednesday, August 13, 2008 - 1:36 am

On Wed, Aug 13, 2008 at 01:04:33AM +0100, Al Viro wrote:

I don't work on this code anymore, but I wrote the original version which
makes me a bit curious about some of the critcism here. The function
hfs_bnode_read is declared void, so it doesn't return any errors. The
only thing inside it that I could even think of failing is kmap, but
I was under the impression that kmap would sleep until it could
complete. The actual disk read happens earlier and is saved in the
page cache as long as the bnode object exists.

Is there any reason that hfs_mac2asc would not be safe? I can't think
of any good way to avoid that call even if it is unsafe, since the
readdir will expect UTF8 strings rather than the mac (or UTF16 for
hfsplus) encoding found on disk.

The open_dir_list stuff is a little odd I admit, and I think you are
right about the locking issue in release. However, I feel like I should
explain the way hfs and hfsplus use f_pos on directories. The on-disk
format requires that the directory entries be sorted in order by
filename and does not allow any holes in the list. Because of this,
adding and removing entries will move all the items that are later
in the order to make room or eliminate the hole. The manipulation
of f_pos is intended to make it act more like a standard unix
filesystem where removing an item doesn't usually make a pending
readdir skip an unrelated item. The value of f_pos for a directory
is only incremented by one for each entry to make seeking work
in a more sane fashion. Because of this, an increment moves to the
next item and decrement moves to the previous one.

As a side note about the complexity of making hfs and hfsplus fit
into a unix model, there is just one file that contains the equivalent
of every directory and the entire inode table. Because of this, the
directory code is very synthetic. I tried to make it look as much as
possible like a normal unix filesystem, including making i_nlink on
the directory inodes reflect the number of child directories. It
makes for some code that is admittedly a little hard to follow.

	Brad Boyer
	flar@allandria.com


--
Previous message: [thread] [date] [author]
Next message: [thread] [date] [author]

Messages in current thread:
[RFC] readdir mess, Al Viro, (Mon Aug 11, 11:22 pm)
Re: [RFC] readdir mess, OGAWA Hirofumi, (Tue Aug 12, 10:02 am)
Re: [RFC] readdir mess, Linus Torvalds, (Tue Aug 12, 10:18 am)
Re: [RFC] readdir mess, Al Viro, (Tue Aug 12, 11:10 am)
Re: [RFC] readdir mess, Al Viro, (Tue Aug 12, 11:22 am)
Re: [RFC] readdir mess, Al Viro, (Tue Aug 12, 11:37 am)
Re: [RFC] readdir mess, Al Viro, (Tue Aug 12, 12:24 pm)
Re: [RFC] readdir mess, OGAWA Hirofumi, (Tue Aug 12, 12:45 pm)
Re: [RFC] readdir mess, Linus Torvalds, (Tue Aug 12, 1:02 pm)
Re: [RFC] readdir mess, Linus Torvalds, (Tue Aug 12, 1:05 pm)
Re: [RFC] readdir mess, Linus Torvalds, (Tue Aug 12, 1:21 pm)
Re: [RFC] readdir mess, Al Viro, (Tue Aug 12, 1:38 pm)
Re: [RFC] readdir mess, Al Viro, (Tue Aug 12, 1:59 pm)
Re: [RFC] readdir mess, Linus Torvalds, (Tue Aug 12, 2:04 pm)
Re: [RFC] readdir mess, Linus Torvalds, (Tue Aug 12, 2:24 pm)
Re: [RFC] readdir mess, Alan Cox, (Tue Aug 12, 2:47 pm)
Re: [RFC] readdir mess, Al Viro, (Tue Aug 12, 2:54 pm)
Re: [RFC] readdir mess, Linus Torvalds, (Tue Aug 12, 3:04 pm)
Re: [RFC] readdir mess, Alan Cox, (Tue Aug 12, 3:10 pm)
Re: [RFC] readdir mess, Linus Torvalds, (Tue Aug 12, 3:20 pm)
Re: [RFC] readdir mess, Al Viro, (Tue Aug 12, 5:04 pm)
Re: [RFC] readdir mess, Linus Torvalds, (Tue Aug 12, 5:28 pm)
Re: [RFC] readdir mess, Al Viro, (Tue Aug 12, 6:19 pm)
Re: [RFC] readdir mess, Linus Torvalds, (Tue Aug 12, 6:51 pm)
Re: [RFC] readdir mess, Brad Boyer, (Wed Aug 13, 1:36 am)
Re: [RFC] readdir mess, Al Viro, (Wed Aug 13, 9:19 am)
Re: [RFC] readdir mess, J. Bruce Fields, (Wed Aug 13, 9:20 am)
Re: [RFC] readdir mess, Jan Harkes, (Thu Aug 14, 10:06 pm)
Re: [RFC] readdir mess, Al Viro, (Thu Aug 14, 10:34 pm)
Re: [RFC] readdir mess, Linus Torvalds, (Fri Aug 15, 9:58 am)
Re: [RFC] readdir mess, Al Viro, (Sun Aug 24, 3:10 am)
Re: [RFC] readdir mess, Al Viro, (Sun Aug 24, 4:03 am)
Re: [RFC] readdir mess, Linus Torvalds, (Sun Aug 24, 10:20 am)
Re: [RFC] readdir mess, Al Viro, (Sun Aug 24, 12:59 pm)
Re: [RFC] readdir mess, Linus Torvalds, (Sun Aug 24, 4:51 pm)
Re: [RFC] readdir mess, Al Viro, (Sun Aug 24, 6:33 pm)
Re: [RFC] readdir mess, Al Viro, (Sun Aug 24, 6:44 pm)
Re: [RFC] readdir mess, J. Bruce Fields, (Mon Aug 25, 9:16 am)