0
0
Fork 0
mirror of https://github.com/matrix-construct/construct synced 2024-06-02 10:08:56 +02:00

ircd::fs: Use fallocate() rather than posix_fallocate(); add keep_size.

This commit is contained in:
Jason Volk 2018-08-23 22:35:01 -07:00
parent 6f2eeaec67
commit e0024b82ea
2 changed files with 6 additions and 1 deletions

View file

@ -46,6 +46,9 @@ struct ircd::fs::write_opts
/// Request priority (this option may be improved, avoid for now)
int16_t priority {0};
/// for allocate()
bool keep_size {false};
};
inline

View file

@ -388,7 +388,9 @@ ircd::fs::allocate(const fd &fd,
const size_t &size,
const write_opts &opts)
{
syscall(::posix_fallocate, fd, opts.offset, size);
int mode{0};
mode |= opts.keep_size? FALLOC_FL_KEEP_SIZE : 0;
syscall(::fallocate, fd, mode, opts.offset, size);
}
void