diff options
author | Dan Goodliffe <dan@randomdan.homeip.net> | 2022-04-19 00:34:07 +0100 |
---|---|---|
committer | Dan Goodliffe <dan@randomdan.homeip.net> | 2022-04-19 00:34:07 +0100 |
commit | 9c434e791e3982386d601c5cf4c9407ec6841f79 (patch) | |
tree | 2a5f5731a633b2716756df101b0d241b2b5c1cf6 /netfs/fuse | |
parent | Move construct ReqEnv from mapper values (diff) | |
download | netfs-9c434e791e3982386d601c5cf4c9407ec6841f79.tar.bz2 netfs-9c434e791e3982386d601c5cf4c9407ec6841f79.tar.xz netfs-9c434e791e3982386d601c5cf4c9407ec6841f79.zip |
Use cpp:array on write data, prevents copying
Diffstat (limited to 'netfs/fuse')
-rw-r--r-- | netfs/fuse/fuseFiles.cpp | 7 |
1 files changed, 4 insertions, 3 deletions
diff --git a/netfs/fuse/fuseFiles.cpp b/netfs/fuse/fuseFiles.cpp index 9f7bf5e..6b1ad1a 100644 --- a/netfs/fuse/fuseFiles.cpp +++ b/netfs/fuse/fuseFiles.cpp @@ -171,11 +171,12 @@ namespace NetFS { try { auto of = getProxy<OpenFilePtr>(fi->fh); auto remote = of->remote; + auto bytes = reinterpret_cast<const ::Ice::Byte *>(buf); if (fcr->Async) { - waitOnWriteRangeAndThen<void>(s, o, of, [o, s, buf, &of, remote](const auto & key) { + waitOnWriteRangeAndThen<void>(s, o, of, [o, s, bytes, &of, remote](const auto & key) { auto p = std::make_shared<OpenFile::WriteState>(); remote->writeAsync( - o, safe {s}, Buffer(buf, buf + s), + o, safe {s}, std::make_pair(bytes, bytes + s), [p, of, key]() { p->promise.set_value(); ScopeLock(of->mutex) { @@ -192,7 +193,7 @@ namespace NetFS { }); } else { - remote->write(o, safe {s}, Buffer(buf, buf + s)); + remote->write(o, safe {s}, std::make_pair(bytes, bytes + s)); } return safe {s}; } |