diff --git a/file/read_write_util.cc b/file/read_write_util.cc index 8614fcaa8..892499b8c 100644 --- a/file/read_write_util.cc +++ b/file/read_write_util.cc @@ -58,4 +58,9 @@ bool ReadOneLine(std::istringstream* iss, SequentialFile* seq_file, return *has_data || has_complete_line; } +#ifndef NDEBUG +bool IsFileSectorAligned(const size_t off, size_t sector_size) { + return off % sector_size == 0; +} +#endif // NDEBUG } // namespace rocksdb diff --git a/file/read_write_util.h b/file/read_write_util.h index 7c344728f..be975e854 100644 --- a/file/read_write_util.h +++ b/file/read_write_util.h @@ -26,4 +26,7 @@ extern Status NewWritableFile(Env* env, const std::string& fname, bool ReadOneLine(std::istringstream* iss, SequentialFile* seq_file, std::string* output, bool* has_data, Status* result); +#ifndef NDEBUG +bool IsFileSectorAligned(const size_t off, size_t sector_size); +#endif // NDEBUG } // namespace rocksdb diff --git a/file/readahead_raf.cc b/file/readahead_raf.cc index 5c5582d14..dc005b900 100644 --- a/file/readahead_raf.cc +++ b/file/readahead_raf.cc @@ -11,19 +11,11 @@ #include #include +#include "file/read_write_util.h" #include "util/aligned_buffer.h" #include "util/rate_limiter.h" namespace rocksdb { - -#ifndef NDEBUG -namespace { -bool IsFileSectorAligned(const size_t off, size_t sector_size) { - return off % sector_size == 0; -} -} // namespace -#endif - namespace { class ReadaheadRandomAccessFile : public RandomAccessFile { public: diff --git a/file/sequence_file_reader.cc b/file/sequence_file_reader.cc index f9b20d067..be766a68b 100644 --- a/file/sequence_file_reader.cc +++ b/file/sequence_file_reader.cc @@ -12,6 +12,7 @@ #include #include +#include "file/read_write_util.h" #include "monitoring/histogram.h" #include "monitoring/iostats_context_imp.h" #include "port/port.h" @@ -21,15 +22,6 @@ #include "util/rate_limiter.h" namespace rocksdb { - -#ifndef NDEBUG -namespace { -bool IsFileSectorAligned(const size_t off, size_t sector_size) { - return off % sector_size == 0; -} -} // namespace -#endif - Status SequentialFileReader::Read(size_t n, Slice* result, char* scratch) { Status s; if (use_direct_io()) {