Mercurial > dovecot > core-2.2
changeset 15740:397253f15f36
lib-fs: Changed FS_OPEN_FLAG_UNIMPORTANT to a reversed FS_OPEN_FLAG_FSYNC.
This explains its behavior better.
author | Timo Sirainen <tss@iki.fi> |
---|---|
date | Tue, 05 Feb 2013 03:37:47 +0200 |
parents | e7e95d2d2b37 |
children | 03a0af22100d |
files | src/lib-fs/fs-api.h src/lib-fs/fs-posix.c src/lib-storage/index/index-attachment.c |
diffstat | 3 files changed, 6 insertions(+), 6 deletions(-) [+] |
line wrap: on
line diff
--- a/src/lib-fs/fs-api.h Tue Feb 05 03:30:01 2013 +0200 +++ b/src/lib-fs/fs-api.h Tue Feb 05 03:37:47 2013 +0200 @@ -40,9 +40,9 @@ }; enum fs_open_flags { - /* File being written isn't very important, performance is more - important than actually guaranteeing that the file gets saved */ - FS_OPEN_FLAG_UNIMPORTANT = 0x10, + /* File is important and writing must call fsync() or have equivalent + behavior. */ + FS_OPEN_FLAG_FSYNC = 0x10, /* Asynchronous writes: fs_write() will fail with EAGAIN if it needs to be called again (the retries can use size=0). For streams fs_write_stream_finish() may request retrying with 0.
--- a/src/lib-fs/fs-posix.c Tue Feb 05 03:30:01 2013 +0200 +++ b/src/lib-fs/fs-posix.c Tue Feb 05 03:37:47 2013 +0200 @@ -350,7 +350,7 @@ { int ret; - if ((file->open_flags & FS_OPEN_FLAG_UNIMPORTANT) == 0) { + if ((file->open_flags & FS_OPEN_FLAG_FSYNC) != 0) { if (fdatasync(file->fd) < 0) { fs_set_error(file->file.fs, "fdatasync(%s) failed: %m", file->file.path);
--- a/src/lib-storage/index/index-attachment.c Tue Feb 05 03:30:01 2013 +0200 +++ b/src/lib-storage/index/index-attachment.c Tue Feb 05 03:37:47 2013 +0200 @@ -87,8 +87,8 @@ i_assert(attach->cur_file == NULL); - if (storage->set->parsed_fsync_mode == FSYNC_MODE_NEVER) - flags |= FS_OPEN_FLAG_UNIMPORTANT; + if (storage->set->parsed_fsync_mode != FSYNC_MODE_NEVER) + flags |= FS_OPEN_FLAG_FSYNC; if (strlen(digest) < 4) { /* make sure we can access first 4 bytes without accessing