mirror of
https://github.com/matrix-construct/construct
synced 2024-09-27 11:18:51 +02:00
ircd::fs: Add write_opts for RWF_WRITE_LIFE_* support.
This commit is contained in:
parent
7f18bb17e2
commit
134bcc1bfb
3 changed files with 16 additions and 0 deletions
|
@ -83,6 +83,12 @@ struct ircd::fs::write_opts
|
|||
/// write with fsync(2)/fdsync(2) yourself.
|
||||
bool metadata {false};
|
||||
|
||||
/// RWH_WRITE_LIFE integer representation (see fcntl(2) since Linux 4.13) if
|
||||
/// supported; otherwise has no effect. As a write_opts option, this is only
|
||||
/// meaningful if pwritev2(2) is available and the kernel recognizes the
|
||||
/// RWF_WRITE_LIFE flag bits. See also fs::write_life(fd).
|
||||
uint8_t write_life {0};
|
||||
|
||||
write_opts(const off_t & = 0);
|
||||
};
|
||||
|
||||
|
|
|
@ -1317,6 +1317,11 @@ ircd::fs::flags(const write_opts &opts)
|
|||
ret |= RWF_SYNC;
|
||||
#endif
|
||||
|
||||
#ifdef RWF_WRITE_LIFE_SHIFT
|
||||
if(support_rwf_write_life && opts.write_life)
|
||||
ret |= (opts.write_life << (RWF_WRITE_LIFE_SHIFT));
|
||||
#endif
|
||||
|
||||
return ret;
|
||||
}
|
||||
|
||||
|
|
|
@ -276,6 +276,11 @@ ircd::fs::aio::request::write::write(const int &fd,
|
|||
if(support_sync && opts.sync && opts.metadata)
|
||||
aio_rw_flags |= RWF_SYNC;
|
||||
#endif
|
||||
|
||||
#ifdef RWF_WRITE_LIFE_SHIFT
|
||||
if(support_rwf_write_life && opts.write_life)
|
||||
aio_rw_flags |= (opts.write_life << (RWF_WRITE_LIFE_SHIFT));
|
||||
#endif
|
||||
}
|
||||
|
||||
size_t
|
||||
|
|
Loading…
Reference in a new issue