mirror of
https://github.com/matrix-construct/construct
synced 2025-01-13 16:33:53 +01:00
ircd::fs: Use fallocate() rather than posix_fallocate(); add keep_size.
This commit is contained in:
parent
6f2eeaec67
commit
e0024b82ea
2 changed files with 6 additions and 1 deletions
|
@ -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
|
||||
|
|
|
@ -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
|
||||
|
|
Loading…
Reference in a new issue