Messages in this thread | | | Date | Fri, 9 May 1997 09:22:31 +0100 (GMT/BST) | From | Mike Jagdis <> | Subject | Re: Raw devices (Was:Re: NTFS, FAT32, etc.) |
| |
On Thu, 8 May 1997, Martin von Loewis wrote:
> > O_SYNC gives synchronous writes but using O_SYNC is not the same > > as having raw devices. Raw device writes skip the buffer cache > > but may or may not be completed before return depending whether > > the kernel uses an intermediate buffer or not. > > Now it's getting weird. So you are saying that the kernel might have > an extra internal buffer, which is not counted as buffer cache for > raw devices (this sounds like a terminology issue: any internal buffer > of the kernel for writing could be considered a 'cache').
I was thinking of cases where, for instance, a bounce buffer might need to be used for DMA requirements. If the copy has to occur anyway it makes sense (on some systems) for that buffer to be registered with the buffer cache and for the write to return a completion. After all, if you didn't ask for O_SYNC then the most reasonable action is to signal completion as soon as the user buffer is no longer needed, isn't it?
> Anyway, so raw devices do *not* guarantee IO finalization, which means > that in case of a crash, data written to a raw device might get lost? > This does not sound like a very usefull device...
If you want that behaviour ask for it with O_SYNC. Raw devices and O_SYNC implement two different behaviours. If you don't want your data wasting buffer cache space unnecessarily use raw devices. If you want data committed before you get a return set O_SYNC. You can open a raw device with or without O_SYNC.
Of course, it isn't necessarily clear whether O_SYNC commits right down to the device or not. Modern caching controllers can have more write back cache than you have RAM in the main box and modern hard drives often have their own cache. This is a different issue however so let's not start a thread on it - again...
Mike
-- .----------------------------------------------------------------------. | Mike Jagdis | Internet: mailto:mike@roan.co.uk | | Roan Technology Ltd. | | | 54A Peach Street, Wokingham | Telephone: +44 118 989 0403 | | RG40 1XG, ENGLAND | Fax: +44 118 989 1195 | `----------------------------------------------------------------------'
| |