Neil Perrin wrote:
>> I also noticed (perhaps by design) that a copy with compression off almost
>> instantly returns, but the writes continue LONG after the cp process claims
>> to be done. Is this normal?
> 
> Yes this is normal. Unless the application is doing synchronous writes
> (eg DB) the file will be written to disk at the convenience of the FS.
> Most fs operate this way. It's too expensive to synchronously write
> out data, so it's batched up and written asynchronously.
> 
>> Wouldn't closing the file ensure it was written to disk?
> 
> No.
> 
>> Is that tunable somewhere?
> 
> No. For ZFS you can use sync(1M) which will force out all transactions
> for all files in the pool. That is expensive though. 
> 
> Neil.

Your application can call f[d]sync when it's done writing the file
and before it does the close if it wants all the data on disk.
This has been standard operating procedure for many, many
years.

 From TFMP:

DESCRIPTION
      The fsync() function moves all modified data and  attributes
      of  the  file  descriptor  fildes  to a storage device. When
      fsync() returns, all in-memory modified  copies  of  buffers
      associated  with  fildes  have  been written to the physical
      medium. The fsync() function is different from sync(), which
      schedules disk I/O for all files  but returns before the I/O
      completes. The fsync() function forces all outstanding  data
      operations  to  synchronized  file integrity completion (see
      fcntl.h(3HEAD) definition of O_SYNC.)

    ...

USAGE
      The fsync() function should be  used  by  applications  that
      require  that  a  file  be in a known state. For example, an
      application that  contains  a  simple  transaction  facility
      might  use   fsync() to ensure that all changes to a file or
      files caused by a  given  transaction  were  recorded  on  a
      storage medium.

- Bart

-- 
Bart Smaalders                  Solaris Kernel Performance
[EMAIL PROTECTED]               http://blogs.sun.com/barts
"You will contribute more with mercurial than with thunderbird."
_______________________________________________
zfs-discuss mailing list
[email protected]
http://mail.opensolaris.org/mailman/listinfo/zfs-discuss

Reply via email to