mirror of
https://github.com/ceph/ceph
synced 2025-01-19 17:41:39 +00:00
Merge pull request #9062 from majianpeng/aio-pwritev
os/fs/FS: optimize aio::pwritev which make caller provide length. Reviewed-by: Loic Dachary <ldachary@redhat.com>
This commit is contained in:
commit
42a126e3aa
@ -449,7 +449,7 @@ int KernelDevice::aio_write(
|
||||
bl.hexdump(*_dout);
|
||||
*_dout << dendl;
|
||||
|
||||
_aio_log_start(ioc, off, bl.length());
|
||||
_aio_log_start(ioc, off, len);
|
||||
|
||||
#ifdef HAVE_LIBAIO
|
||||
if (aio && dio && !buffered) {
|
||||
@ -472,7 +472,7 @@ int KernelDevice::aio_write(
|
||||
<< " " << aio.iov[i].iov_len << dendl;
|
||||
}
|
||||
aio.bl.claim_append(bl);
|
||||
aio.pwritev(off);
|
||||
aio.pwritev(off, len);
|
||||
}
|
||||
dout(5) << __func__ << " 0x" << std::hex << off << "~" << len
|
||||
<< std::dec << " aio " << &aio << dendl;
|
||||
@ -492,7 +492,7 @@ int KernelDevice::aio_write(
|
||||
bl.prepare_iov(&iov);
|
||||
int r = ::pwritev(buffered ? fd_buffered : fd_direct,
|
||||
&iov[0], iov.size(), off);
|
||||
_aio_log_finish(ioc, off, bl.length());
|
||||
_aio_log_finish(ioc, off, len);
|
||||
|
||||
if (r < 0) {
|
||||
r = -errno;
|
||||
|
@ -68,12 +68,10 @@ public:
|
||||
memset(&iocb, 0, sizeof(iocb));
|
||||
}
|
||||
|
||||
void pwritev(uint64_t _offset) {
|
||||
void pwritev(uint64_t _offset, uint64_t len) {
|
||||
offset = _offset;
|
||||
length = len;
|
||||
io_prep_pwritev(&iocb, fd, &iov[0], iov.size(), offset);
|
||||
length = 0;
|
||||
for (unsigned u=0; u<iov.size(); ++u)
|
||||
length += iov[u].iov_len;
|
||||
}
|
||||
void pread(uint64_t _offset, uint64_t len) {
|
||||
offset = _offset;
|
||||
|
Loading…
Reference in New Issue
Block a user