["Stephen C. Tweedie" ] Re: O_DSYNC flag for open

Поиск
Список
Период
Сортировка
От Doug McNaught
Тема ["Stephen C. Tweedie" ] Re: O_DSYNC flag for open
Дата
Msg-id m3ae6lhhin.fsf@belphigor.mcnaught.org
обсуждение исходный текст
Ответы Re: ["Stephen C. Tweedie" ] Re: O_DSYNC flag for open  (Tom Lane <tgl@sss.pgh.pa.us>)
Список pgsql-hackers
Just a quick delurk to pass along this tidbit from linux-kernel on
Linux *sync() behavior, since we've been talking about it a lot...

-Doug

Hi,

On Wed, Mar 14, 2001 at 10:26:42PM -0500, Tom Vier wrote:
> 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.

> 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.

> #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

В списке pgsql-hackers по дате отправления:

Предыдущее
От: Thomas Lockhart
Дата:
Сообщение: Re: AW: Allowing WAL fsync to be done via O_SYNC
Следующее
От: Bruce Momjian
Дата:
Сообщение: Re: Re[2]: Allowing WAL fsync to be done via O_SYNC