Revert "ircd::db::database::env: Reduce file size system calls with cache pattern."

This reverts commit 671120415f.
This commit is contained in:
Jason Volk 2022-06-23 13:27:49 -07:00
parent 7918605d72
commit 4bf297e5e7
2 changed files with 5 additions and 35 deletions

View File

@ -1344,8 +1344,6 @@ noexcept try
};
#endif
assert(logical_size == -1UL || logical_size == fs::size(fd));
fd = fs::fd{};
return Status::OK();
}
@ -1615,7 +1613,6 @@ noexcept try
wopts.nodelay = nodelay;
wopts.interruptible = false;
fs::truncate(fd, size, wopts);
logical_size = size;
return Status::OK();
}
catch(const std::system_error &e)
@ -1667,9 +1664,6 @@ noexcept try
};
#endif
if(likely(logical_size != -1UL) && offset + length > logical_size)
logical_size = -1UL;
if(opts.direct)
return Status::OK();
@ -1734,14 +1728,7 @@ noexcept try
data(s), size(s)
};
const const_buffer appended
{
fs::append(fd, buf, wopts)
};
if(likely(logical_size != -1UL))
logical_size += size(appended);
fs::append(fd, buf, wopts);
return Status::OK();
}
catch(const std::system_error &e)
@ -1807,19 +1794,7 @@ noexcept try
data(s), size(s)
};
const const_buffer appended
{
fs::append(fd, buf, wopts)
};
const auto append_break
{
offset + size(appended)
};
if(likely(logical_size != -1UL) && append_break > logical_size)
logical_size = append_break;
fs::append(fd, buf, wopts);
return Status::OK();
}
catch(const std::system_error &e)
@ -2063,18 +2038,14 @@ noexcept try
#ifdef RB_DEBUG_DB_ENV
log::debug
{
log, "[%s] wfile:%p fd:%d get file size; cached:%zd",
log, "[%s] wfile:%p fd:%d get file size",
d.name,
this,
int(fd),
logical_size,
int(fd)
};
#endif
if(logical_size == -1UL)
logical_size = fs::size(fd);
return logical_size;
return fs::size(fd);
}
catch(const std::exception &e)
{

View File

@ -227,7 +227,6 @@ ircd::db::database::env::writable_file
bool nodelay {false};
WriteLifeTimeHint hint {WriteLifeTimeHint::WLTH_NOT_SET};
fs::fd fd;
size_t logical_size {-1UL};
size_t preallocation_block_size {0};
ssize_t preallocation_last_block {-1};