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:
Kefu Chai 2016-11-25 23:01:07 +08:00 committed by GitHub
commit 42a126e3aa
2 changed files with 5 additions and 7 deletions

View File

@ -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;

View File

@ -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;