This param is redundant as it's accessible via FileReader instance.
Signed-off-by: Igor Fedotov <ifedotov@suse.com>
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;
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
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
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
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
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) {
//
// 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();
// 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();
}
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;
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;
}
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