X-Git-Url: https://gerrit.opnfv.org/gerrit/gitweb?a=blobdiff_plain;f=src%2Fceph%2Fsrc%2Fcommon%2FSloppyCRCMap.h;fp=src%2Fceph%2Fsrc%2Fcommon%2FSloppyCRCMap.h;h=0000000000000000000000000000000000000000;hb=7da45d65be36d36b880cc55c5036e96c24b53f00;hp=d8d1561123e1ff04a52d3330fbf777b9b296be6e;hpb=691462d09d0987b47e112d6ee8740375df3c51b2;p=stor4nfv.git diff --git a/src/ceph/src/common/SloppyCRCMap.h b/src/ceph/src/common/SloppyCRCMap.h deleted file mode 100644 index d8d1561..0000000 --- a/src/ceph/src/common/SloppyCRCMap.h +++ /dev/null @@ -1,73 +0,0 @@ -// -*- mode:C++; tab-width:8; c-basic-offset:2; indent-tabs-mode:t -*- -// vim: ts=8 sw=2 smarttab - -#ifndef CEPH_COMMON_SLOPPYCRCMAP_H -#define CEPH_COMMON_SLOPPYCRCMAP_H - -#include "include/encoding.h" -#include "common/Formatter.h" - -/** - * SloppyCRCMap - * - * Opportunistically track CRCs on any reads or writes that cover full - * blocks. Verify read results when we have CRC data available for - * the given extent. - */ -class SloppyCRCMap { - static const int crc_iv = 0xffffffff; - - std::map crc_map; // offset -> crc(-1) - uint32_t block_size; - uint32_t zero_crc; - -public: - SloppyCRCMap(uint32_t b=0) { - set_block_size(b); - } - - void set_block_size(uint32_t b) { - block_size = b; - //zero_crc = ceph_crc32c(0xffffffff, NULL, block_size); - if (b) { - bufferlist bl; - bl.append_zero(block_size); - zero_crc = bl.crc32c(crc_iv); - } else { - zero_crc = crc_iv; - } - } - - /// update based on a write - void write(uint64_t offset, uint64_t len, const bufferlist& bl, - std::ostream *out = NULL); - - /// update based on a truncate - void truncate(uint64_t offset); - - /// update based on a zero/punch_hole - void zero(uint64_t offset, uint64_t len); - - /// update based on a zero/punch_hole - void clone_range(uint64_t offset, uint64_t len, uint64_t srcoff, const SloppyCRCMap& src, - std::ostream *out = NULL); - - /** - * validate a read result - * - * @param offset offset - * @param length length - * @param bl data read - * @param err option ostream to describe errors in detail - * @returns error count, 0 for success - */ - int read(uint64_t offset, uint64_t len, const bufferlist& bl, std::ostream *err); - - void encode(bufferlist& bl) const; - void decode(bufferlist::iterator& bl); - void dump(Formatter *f) const; - static void generate_test_instances(std::list& ls); -}; -WRITE_CLASS_ENCODER(SloppyCRCMap) - -#endif