On Tue, 19 Mar 2013, Chris Mason wrote: > Quoting Alexandre Oliva (2013-03-19 01:20:10) > > On Mar 18, 2013, Chris Mason <chris.mason@xxxxxxxxxxxx> wrote: > > > > > A few questions. Does leveldb use O_DIRECT and mmap together? > > > > No, it doesn't use O_DIRECT at all. Its I/O interface is very > > simplified: it just opens each new file (database chunks limited to 2MB) > > with O_CREAT|O_RDWR|O_TRUNC, and then uses ftruncate, mmap, msync, > > munmap and fdatasync. It doesn't seem to modify data once it's written; > > it only appends. Reading data back from it uses a completely different > > class interface, using separate descriptors and using pread only. > > > > > (the source of a write being pages that are mmap'd from somewhere > > > else) > > > > AFAICT the source of the memcpy()s that append to the file are > > malloc()ed memory. > > > > > That's the most likely place for this kind of problem. Also, you > > > mention crc errors. Are those reported by btrfs or are they application > > > level crcs. > > > > These are CRCs leveldb computes and writes out after each db block. No > > btrfs CRC errors are reported in this process. > > Ok, so we have three moving pieces here. > > 1) leveldb truncating the files > 2) leveldb using mmap to write > 3) btrfs snapshots > > My guess is the truncate is creating a orphan item that is being > processed inside the snapshot. > > Is it possible to create a smaller leveldb unit test that we might use > to exercise all of this? There is a set of unit tests in the leveldb source tree that ought to do the trick: git clone https://code.google.com/p/leveldb/ sage -- To unsubscribe from this list: send the line "unsubscribe ceph-devel" in the body of a message to majordomo@xxxxxxxxxxxxxxx More majordomo info at http://vger.kernel.org/majordomo-info.html