Hi,
On Thu, 8 Jul 1999 00:30:51 -0600 (MDT), Andreas Dilger
<[EMAIL PROTECTED]> said:
> I've been looking through the code in fs/ext2, mostly super.c, and I'm a
> bit confused as to how the kernel handles updating all of the superblock
> copies on the disk.
It doesn't. Only the primary superblock gets updated dynamically: the
dynamic parts of the superblock data can always be recovered by fsck
anyway if we lose the primary superblock.
> I haven't really worked much with the kernel, but it appears that the
> ext2 code essentially does a "mmap" of the disk blocks (using bread()),
> and leaves it up to some other kernel functions to flush the data to
> disk as it is changed and/or marked dirty.
No, bread has nothing to do with mmaping: it just reads a buffer into
memory, but the buffer goes nowhere near the virtual memory system.
> Race conditions aside, if a disk block is mmaped into the kernel (via bread()
> into a buffer_head), and a user-space process writes to this block on disk,
> what is the end result?
The user-space IO is done via the same buffer that the kernel is using,
so there is no cache coherency problem.
--Stephen