Marcus Brinkmann <[EMAIL PROTECTED]> writes:
> FAT is divided in a meta data area at the beginning of the fs, and a file
> area (including directories) following it. I use file pagers for the
> directories to parse the directory entries, as ext2fs. However, as all node
> information is stored in directory records, write_node wants to scribble in
> the file pagers area for this directory. I can think of several solutions:
>
> 1) Not handling directories through file pagers at all, but use the disk
> pager (as is done in isofs and fatfs 0.1). This obviously avoids the
> problem and might be the simplest solution. One would hope for a better
> solution, as directories are really much like files (and using the file
> pager is very handy).
This is acceptable, but you are right that it's not very optimal.
> 2) Not writing to directory records through the disk pager at all (clipping
> the disk pager to the meta data area). This requires to use the directory
> file pager in write_node, for example by using diskfs_node_rdwr. Is this
> acceptable performance wise? This solution would require me to make the
> directory's node and record offset accesible to the file node, which has all
> sort of nasty problems attached to it, although it is not much worse than
> the current problem of making the directory record offset within disk image
> accesible to the file node.
This is exactly what I would suggest doing; it's the most natural
thing to do.
> 3) Serializing disk pager writes to the file area and file pager writes for
> directory nodes (in short: all file pager writes). Sounds like the "let's
> chop the arm off" solution with worst impact on performance. Would this
> actually work (will the pager take notice of modified disk pages in the file
> pager?)
That is not safe at all unless you were to also purge the affected
pages from the kernel's cache. In other words, even if you serialize,
you should never allow two copies of the same disk page to live at
once in the kernel with different contents in different pagers; you
are asking for disaster if you do that.