Skip to content

Commit

Permalink
Make linux file write life time hinting work (all the time)
Browse files Browse the repository at this point in the history
The life time hint fcntl takes a 64-bit unsigned int,
so make sure to pass a uint64_t when doing the syscall.

Signed-off-by: Hans Holmberg <hans.holmberg@wdc.com>
  • Loading branch information
yhr committed May 2, 2024
1 parent d80e1d9 commit b9f388f
Showing 1 changed file with 3 additions and 1 deletion.
4 changes: 3 additions & 1 deletion env/io_posix.cc
Original file line number Diff line number Diff line change
Expand Up @@ -1441,10 +1441,12 @@ void PosixWritableFile::SetWriteLifeTimeHint(Env::WriteLifeTimeHint hint) {
#ifdef OS_LINUX
// Suppress Valgrind "Unimplemented functionality" error.
#ifndef ROCKSDB_VALGRIND_RUN
uint64_t fcntl_hint = hint;

if (hint == write_hint_) {
return;
}
if (fcntl(fd_, F_SET_RW_HINT, &hint) == 0) {
if (fcntl(fd_, F_SET_RW_HINT, &fcntl_hint)) {
write_hint_ = hint;
}
#else
Expand Down

0 comments on commit b9f388f

Please sign in to comment.