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

.

parent 46e7a7bd
......@@ -876,11 +876,11 @@ retry:
// - wconn.filehMu not locked
// - f.mmapMu not locked
error _FileH::_open() {
_FileH* f = this;
Conn wconn = f->wconn;
_FileH& f = *this;
Conn wconn = f.wconn;
error err;
tie(f->_headf, err)
tie(f._headf, err)
= wconn->_wc->_open(fmt::sprintf("head/bigfile/%s", v(foid)));
if (err != nil)
return err;
......@@ -888,18 +888,18 @@ error _FileH::_open() {
bool retok = false;
defer([&]() {
if (!retok)
f->_headf->close();
f._headf->close();
});
struct stat st;
err = f->_headf->stat(&st);
err = f._headf->stat(&st);
if (err != nil)
return err;
f->blksize = st.st_blksize;
f->_headfsize = st.st_size;
if (!(f->_headfsize % f->blksize == 0))
f.blksize = st.st_blksize;
f._headfsize = st.st_size;
if (!(f._headfsize % f.blksize == 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
// 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