Skip to contentSkip to conversation

O_DSYNC flag for open

DISCUSSION Denis Perchine 3 participants 3 messages Mar 10, 2001 – Mar 16, 2001

lore
Share & tools
lore
#0 lore raw

Hello,

one small question... Will O_DSYNC flag be available in Linux?
It is available at least on AIX, and HP-UX. The difference with O_SYNC is the same as between fsync and fdatasync.

Any comments?

Signature · 8 lines
Sincerely Yours,
Denis Perchine

----------------------------------
E-Mail: [email protected]
HomePage: http://www.perchine.com/dyp/
FidoNet: 2:5000/120.5
----------------------------------
#1 lore raw

fdatasync() is the same as fsync(), in linux. until fdatasync() is implimented (ie, syncs the data only), there's no reason to define O_DSYNC. just use:

#ifndef O_DSYNC

# define O_DSYNC O_SYNC
#endif
Quoted 3 lines · Denis Perchine

one small question... Will O_DSYNC flag be available in Linux?
It is available at least on AIX, and HP-UX. The difference with O_SYNC is the same as between fsync and fdatasync.

Signature · 2 lines
Tom Vier <[email protected]>
DSA Key id 0x27371A2C
#2 lore raw
In reply to Denis Perchine

Hi,

Quoted 1 line · Tom Vier

fdatasync() is the same as fsync(), in linux.

No, in 2.4 fdatasync does the right thing and skips the inode flush if only the timestamps have changed.

Quoted 2 lines

until fdatasync() is
implimented (ie, syncs the data only)

fdatasync is required to sync more than just the data: it has to sync the inode too if any fields other than the timestamps have changed. So, for appending to files or writing new files from scratch, fsync == fdatasync (because each write also changes the inode size). Only for updating existing files in place does fdatasync behave differently.

Quoted 3 lines

#ifndef O_DSYNC

# define O_DSYNC O_SYNC
#endif

2.4's O_SYNC actually does a fdatasync internally. This is also the default behaviour of HPUX, which requires you to set a sysctl variable if you want O_SYNC to flush timestamp changes to disk.

Cheers,
Stephen