Re: Why doesn't (open ... :if-exists) support :truncate?



Richard M Kreuter <kreuter@xxxxxxxxx> wrote:
+---------------
| "Steven M. Haflich" <smh@xxxxxxxxxxxx> writes:
| > Your "direct I/O" reference doesn't really mean anything.
| > Perhaps you should explain.
|
| I was trying to come up with a story according to which some Lisp
| could do all the OPEN :IF-EXISTS actions, but be unable to to a
| truncating open. The entries for :OVERWRITE and :APPEND say "[o]utput
| operations on the stream destructively modify the existing file",
| which I take to mean that the existing file is to be scribbled on, and
| not replaced by a new file. I can't think of a way to do this without
| at some point doing I/O directly to the existing file. By contrast,
| :NEW-VERSION, :SUPESEDE, :RENAME, :RENAME-AND-DELETE need not do I/O
| to an existing file (unless a file system requires I/O to a file in
| order to replace the file with another one, I suppose).
+---------------

Don't use the term "Direct I/O" for this -- that term is already
in standard use in the Unix/Linux/POSIX world [following SGI's
original use of the term in the XFS filesystem on Irix] for file
I/O which goes "directly" from (to) the user program's address
space to (from) the I/O device without going through the operating
system's buffer cache. E.g., from "man 2 open" on FreeBSD:

O_DIRECT may be used to minimize or eliminate the cache effects
of reading and writing. The system will attempt to avoid caching
the data you read or write. If it cannot avoid caching the data,
it will minimize the impact the data has on the cache. Use of this
flag can drastically reduce performance if not used with care.

and on Linux:

O_DIRECT
Try to minimize cache effects of the I/O to and from this file.
In general this will degrade performance, but it is useful in
special situations, such as when applications do their own
caching. File I/O is done directly to/from user space buffers.
The I/O is synchronous, i.e., at the completion of the read(2)
or write(2) system call, data is guaranteed to have been trans-
ferred. Under Linux 2.4 transfer sizes, and the alignment of
user buffer and file offset must all be multiples of the logical
block size of the file system. Under Linux 2.6 alignment to
512-byte boundaries suffices.
A semantically similar interface for block devices is described
in raw(8).

"Direct I/O" usually implies (but does not guarantee) "zero-copy DMA".


-Rob

-----
Rob Warnock <rpw3@xxxxxxxx>
627 26th Avenue <URL:http://rpw3.org/>
San Mateo, CA 94403 (650)572-2607

.



Relevant Pages

  • Re: HoffmanLabs: High-performance Interconnects, MPI?
    ... I/O on OpenVMS, ... It's entirely feasible for Dark Helmet to set I/O engines for ludicrous speed here -- if you're willing to go around the file system and around the C standard library calls -- but then you're supporting it all yourself, right up and into the application stack. ... If I went to a Linux HPTC vendor, I could very likely see a lower price-point, and I can probably find specific 1U or blade configurations and cheaper hardware and roll a Beowulf myself -- if I don't factor in my own time. ...
    (comp.os.vms)
  • Re: Treads in the new 6 core CPU from Intel
    ... Why do you think six cores are "fighting" for resources? ... implications of an asymmetric I/O bus structure on file system I/O? ... Why do you think the file I/O is not taking advantage of the File System Cache? ... What, in fact, do you mean by the phrase "database ...
    (microsoft.public.vc.mfc)
  • Re: [RFC] Block IO Controller V2 - some results
    ... 12 Ext3 file systems, ... 'ioc no idle' - means the ioc kernel w/ CGROUP stuff enabled ... The first thing to do is to check for correctness: when the I/O ...
    (Linux-Kernel)
  • Re: [RFC] Block IO Controller V2 - some results
    ... 12 Ext3 file systems, ... 'ioc no idle' - means the ioc kernel w/ CGROUP stuff enabled ... The first thing to do is to check for correctness: when the I/O ... Mode RdWr N base ioc off ioc no idle ioc idle ...
    (Linux-Kernel)
  • Re: Read/Write to storage class device using sector/block addresses
    ... Well, any time you are writing directly to the disk, I would hope that there ... open just one partition raw and have a file system driver on another. ... class driver and should only be used for infrequent I/O processing. ...
    (microsoft.public.win32.programmer.kernel)