Commit 439dcf16 authored by Kirill Smelkov's avatar Kirill Smelkov

.

parent 46e7a7bd
...@@ -876,11 +876,11 @@ retry: ...@@ -876,11 +876,11 @@ retry:
// - wconn.filehMu not locked // - wconn.filehMu not locked
// - f.mmapMu not locked // - f.mmapMu not locked
error _FileH::_open() { error _FileH::_open() {
_FileH* f = this; _FileH& f = *this;
Conn wconn = f->wconn; Conn wconn = f.wconn;
error err; error err;
tie(f->_headf, err) tie(f._headf, err)
= wconn->_wc->_open(fmt::sprintf("head/bigfile/%s", v(foid))); = wconn->_wc->_open(fmt::sprintf("head/bigfile/%s", v(foid)));
if (err != nil) if (err != nil)
return err; return err;
...@@ -888,18 +888,18 @@ error _FileH::_open() { ...@@ -888,18 +888,18 @@ error _FileH::_open() {
bool retok = false; bool retok = false;
defer([&]() { defer([&]() {
if (!retok) if (!retok)
f->_headf->close(); f._headf->close();
}); });
struct stat st; struct stat st;
err = f->_headf->stat(&st); err = f._headf->stat(&st);
if (err != nil) if (err != nil)
return err; return err;
f->blksize = st.st_blksize; f.blksize = st.st_blksize;
f->_headfsize = st.st_size; f._headfsize = st.st_size;
if (!(f->_headfsize % f->blksize == 0)) if (!(f._headfsize % f.blksize == 0))
return fmt::errorf("wcfs bug: %s size (%d) %% blksize (%d) != 0", return fmt::errorf("wcfs bug: %s size (%d) %% blksize (%d) != 0",
v(f->_headf->name()), f->_headfsize, f->blksize); v(f._headf->name()), f._headfsize, f.blksize);
// start watching f // start watching f
// NOTE we are _not_ holding wconn.filehMu nor f.mmapMu - only wconn.atMu to rely on wconn.at being stable. // NOTE we are _not_ holding wconn.filehMu nor f.mmapMu - only wconn.atMu to rely on wconn.at being stable.
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment