]> git-server-git.apps.pok.os.sepia.ceph.com Git - ceph.git/commitdiff
os/bluestore: kill buf param in BlueFS::read 34421/head
authorIgor Fedotov <ifedotov@suse.com>
Mon, 6 Apr 2020 13:43:06 +0000 (16:43 +0300)
committerIgor Fedotov <ifedotov@suse.com>
Mon, 6 Apr 2020 13:43:06 +0000 (16:43 +0300)
This param is redundant as it's accessible via FileReader instance.

Signed-off-by: Igor Fedotov <ifedotov@suse.com>
src/os/bluestore/BlueFS.cc
src/os/bluestore/BlueFS.h
src/os/bluestore/BlueRocksEnv.cc
src/os/bluestore/bluestore_tool.cc
src/test/objectstore/test_bluefs.cc

index fbb5958e108e915205a07db495f273a235403ae5..003e581d6f61b3c3fe7fd0ec46700c4a2d658403 100644 (file)
@@ -1006,7 +1006,7 @@ int BlueFS::_replay(bool noop, bool to_stdout)
     uint64_t read_pos = pos;
     bufferlist bl;
     {
-      int r = _read(log_reader, &log_reader->buf, read_pos, super.block_size,
+      int r = _read(log_reader, read_pos, super.block_size,
                    &bl, NULL);
       ceph_assert(r == (int)super.block_size);
       read_pos += r;
@@ -1059,7 +1059,7 @@ int BlueFS::_replay(bool noop, bool to_stdout)
       dout(20) << __func__ << " need 0x" << std::hex << more << std::dec
                << " more bytes" << dendl;
       bufferlist t;
-      int r = _read(log_reader, &log_reader->buf, read_pos, more, &t, NULL);
+      int r = _read(log_reader, read_pos, more, &t, NULL);
       if (r < (int)more) {
        derr  << __func__ << " 0x" << std::hex << pos
               << ": stop: len is 0x" << bl.length() + more << std::dec
@@ -1129,7 +1129,7 @@ int BlueFS::_replay(bool noop, bool to_stdout)
          uint64_t skip = offset - read_pos;
          if (skip) {
            bufferlist junk;
-           int r = _read(log_reader, &log_reader->buf, read_pos, skip, &junk,
+           int r = _read(log_reader, read_pos, skip, &junk,
                          NULL);
            if (r != (int)skip) {
              dout(10) << __func__ << " 0x" << std::hex << read_pos
@@ -1960,12 +1960,13 @@ int BlueFS::_read_random(
 
 int BlueFS::_read(
   FileReader *h,         ///< [in] read from here
-  FileReaderBuffer *buf, ///< [in] reader state
   uint64_t off,          ///< [in] offset
   size_t len,            ///< [in] this many bytes
   bufferlist *outbl,     ///< [out] optional: reference the result here
   char *out)             ///< [out] optional: or copy it here
 {
+  FileReaderBuffer *buf = &(h->buf);
+
   bool prefetch = !outbl && !out;
   dout(10) << __func__ << " h " << h
            << " 0x" << std::hex << off << "~" << len << std::dec
index 4de478bb9a8d0ce3149a6d76b4153e8748955534..708741cf84474899c40c500633d0b1a2a43188be 100644 (file)
@@ -390,7 +390,6 @@ private:
 
   int _read(
     FileReader *h,   ///< [in] read from here
-    FileReaderBuffer *buf, ///< [in] reader state
     uint64_t offset, ///< [in] offset
     size_t len,      ///< [in] this many bytes
     ceph::buffer::list *outbl,   ///< [out] optional: reference the result here
@@ -557,12 +556,12 @@ public:
     std::unique_lock l(lock);
     return _fsync(h, l);
   }
-  int read(FileReader *h, FileReaderBuffer *buf, uint64_t offset, size_t len,
+  int read(FileReader *h, uint64_t offset, size_t len,
           ceph::buffer::list *outbl, char *out) {
     // no need to hold the global lock here; we only touch h and
     // h->file, and read vs write or delete is already protected (via
     // atomics and asserts).
-    return _read(h, buf, offset, len, outbl, out);
+    return _read(h, offset, len, outbl, out);
   }
   int read_random(FileReader *h, uint64_t offset, size_t len,
                  char *out) {
index 7f2f8991b9e12e141c5c4d5c62f6f66aae99ec56..3397104dc36bd73a28c7efc30e0a63fe44a5da57 100644 (file)
@@ -47,7 +47,7 @@ class BlueRocksSequentialFile : public rocksdb::SequentialFile {
   //
   // REQUIRES: External synchronization
   rocksdb::Status Read(size_t n, rocksdb::Slice* result, char* scratch) override {
-    int r = fs->read(h, &h->buf, h->buf.pos, n, NULL, scratch);
+    int r = fs->read(h, h->buf.pos, n, NULL, scratch);
     ceph_assert(r >= 0);
     *result = rocksdb::Slice(scratch, r);
     return rocksdb::Status::OK();
@@ -123,7 +123,7 @@ class BlueRocksRandomAccessFile : public rocksdb::RandomAccessFile {
 
   // Readahead the file starting from offset by n bytes for caching.
   rocksdb::Status Prefetch(uint64_t offset, size_t n) override {
-    fs->read(h, &h->buf, offset, n, nullptr, nullptr);
+    fs->read(h, offset, n, nullptr, nullptr);
     return rocksdb::Status::OK();
   }
 
index 66b5a796dde294f4a68ff2c769551db63a9af2ae..ffb011b62083e315cb16a79c088b2f89dca07c3b 100644 (file)
@@ -642,7 +642,7 @@ int main(int argc, char **argv)
          int left = size;
          while (left) {
            bufferlist bl;
-           r = fs->read(h, &h->buf, pos, left, &bl, NULL);
+           r = fs->read(h, pos, left, &bl, NULL);
            if (r <= 0) {
              cerr << "read " << dir << "/" << file << " from " << pos
                   << " failed: " << cpp_strerror(r) << std::endl;
index ef838ab124f2f1294f3b08da025973097b27c857..388ecc408f34e7311ed9ad4178c67498457b9194 100644 (file)
@@ -158,8 +158,7 @@ TEST(BlueFS, write_read) {
     BlueFS::FileReader *h;
     ASSERT_EQ(0, fs.open_for_read("dir", "file", &h));
     bufferlist bl;
-    BlueFS::FileReaderBuffer buf(4096);
-    ASSERT_EQ(9, fs.read(h, &buf, 0, 1024, &bl, NULL));
+    ASSERT_EQ(9, fs.read(h, 0, 1024, &bl, NULL));
     ASSERT_EQ(0, strncmp("foobarbaz", bl.c_str(), 9));
     delete h;
   }
@@ -231,10 +230,9 @@ TEST(BlueFS, very_large_write) {
     BlueFS::FileReader *h;
     ASSERT_EQ(0, fs.open_for_read("dir", "bigfile", &h));
     bufferlist bl;
-    BlueFS::FileReaderBuffer readbuf(10485760);
     for (unsigned i = 0; i < 3*1024*1048576ull / sizeof(buf); ++i) {
       bl.clear();
-      fs.read(h, &readbuf, i * sizeof(buf), sizeof(buf), &bl, NULL);
+      fs.read(h, i * sizeof(buf), sizeof(buf), &bl, NULL);
       int r = memcmp(buf, bl.c_str(), sizeof(buf));
       if (r) {
        cerr << "read got mismatch at offset " << i*sizeof(buf) << " r " << r