Re: [RFC] readdir mess

!MAILaRCHIVE_VOTE_RePLACE
Previous message: [thread] [date] [author]
Next message: [thread] [date] [author]
To: Al Viro <viro@...>
Cc: OGAWA Hirofumi <hirofumi@...>, <linux-fsdevel@...>, <linux-kernel@...>
Date: Tuesday, August 12, 2008 - 9:51 pm

On Wed, 13 Aug 2008, Al Viro wrote:

Well, the parsing has to be done by the low-level filesystem code, yes.

However, the whole thing with races with "f_pos" and all the locking - 
that's only because we see the filesystem "readdir" code as being the 
primary source of data.

Quite frankly, if we had a "readdir page cache", the low-level filesystem 
would still have to parse the insane low-level data with corruption 
issues, but we could make it totally independent of f_pos (because we 
would never use in the _real_ file->f_pos - we would just populate the 
cache), and the locking issues would be only a cold-cache issue, with the 
hot-cache hopefully needing little locking at all.

For an exmple of that: you did a good job with all the "seq_file" helpers, 
which meant that the low-level "filesystem" ops didn't need to know 
_anything_ about partial results etc, and it automatically did the right 
thing wrt f_pos updates and lseek etc.

I'm not saying that readdir() would use the _same_ model, but I do suspect 
that a common format in between the disk format and the eventual readdir() 
output, that also could be cached, might mitigate a lot of the problems.

As to the issues with lookup() - yes, a lookup would need to get the lock 
for writing, but only for the last entry, and only if O_CREAT is set. 
There's nothing wrogn with concurrent read-only lookups, I think (apart 
from having to protect the dentries from being duplicated, of course, but 
that would be a per-dentry lock flag, not a directory lock, methinks).

I dunno.

That said, I think you are right that we could also just improve on the 
current non-caching version with soem higher-level semantics. Including 
flags like "yes, we've seen the end", so that we don't need to always call 
into the low-level filesystem one extra time to see that final zero 
return.

So yes, instead of separate "filldir_t" and "void *data" things, having a 
"struct filldir_t" with several fields in common might be worth it.

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

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