On Wed, 11 Nov 2015, Ning Yao wrote: > 2015-11-11 21:13 GMT+08:00 Sage Weil <sage@xxxxxxxxxxxx>: > > On Wed, 11 Nov 2015, Ning Yao wrote: > >> >>>the code logic would touch crc cache is bufferlist::crc32c and invalidate_crc. > >> >>Also for pg_log::_write_log(), but seems it is always miss and use at > >> >>once, no need to cache crc actually? > >> > Oh, no, it will be hit in FileJournal writing > >> Still miss as buffer::ptr length diff with ::encode(crc, bl), right? > >> So the previous ebl.crc32c(0) calculation would be also no need to > >> cache. > > > > How about just skipping the cache logic if the raw length is less than > > some threshold? Say, 16KB or something? That would cover the _write_log > > case (small buffer) and more generally avoid the fixed overhead of caching > > when recalculating is cheap. > > > > This was originally added with large writes in mind to avoid the crc > > recalculation during journaling on armv7l. It is presumably also helping > > now that we have the opportunistic whole-object checksums for full or > > sequential writes. > > Reasonable, and we may also reconsider whether > map<pair<size_t,size_t>, <int, int> > is really needed. The common > case seems always use the same offset and length. Is it better for us > to just cache the last crc result (only one item is enough efficient)? Yeah, or maybe a fixed size array with a #define size of maybe 2 or 3. 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