]> git-server-git.apps.pok.os.sepia.ceph.com Git - ceph.git/commitdiff
os/bluestore/BlockDevice: read_buffered
authorSage Weil <sage@redhat.com>
Mon, 4 Jan 2016 18:42:06 +0000 (13:42 -0500)
committerSage Weil <sage@redhat.com>
Fri, 8 Jan 2016 18:10:18 +0000 (13:10 -0500)
Signed-off-by: Sage Weil <sage@redhat.com>
src/os/bluestore/BlockDevice.cc
src/os/bluestore/BlockDevice.h

index 1d7656b49ee12b745dc39f2424ce159c5ecd1ad4..a4975c1450ba9154ab4b7861e8adb22d63c163e1 100644 (file)
@@ -474,6 +474,30 @@ int BlockDevice::read(uint64_t off, uint64_t len, bufferlist *pbl,
   return r < 0 ? r : 0;
 }
 
+int BlockDevice::read_buffered(uint64_t off, uint64_t len, char *buf)
+{
+  dout(5) << __func__ << " " << off << "~" << len << dendl;
+  assert(len > 0);
+  assert(off < size);
+  assert(off + len <= size);
+
+  int r = ::pread(fd_buffered, buf, len, off);
+  if (r < 0) {
+    r = -errno;
+    goto out;
+  }
+  assert(r == len);
+
+  dout(40) << "data: ";
+  bufferlist bl;
+  bl.append(buf, len);
+  bl.hexdump(*_dout);
+  *_dout << dendl;
+
+ out:
+  return r < 0 ? r : 0;
+}
+
 int BlockDevice::invalidate_cache(uint64_t off, uint64_t len)
 {
   dout(5) << __func__ << " " << off << "~" << len << dendl;
index 187a7f57fe59ed10153b4c6657b48d3a51450c74..f5acc1113d95421298cd26825a1fb3e697228ed8 100644 (file)
@@ -97,6 +97,7 @@ public:
   int read(uint64_t off, uint64_t len, bufferlist *pbl,
           IOContext *ioc,
           bool buffered);
+  int read_buffered(uint64_t off, uint64_t len, char *buf);
 
   int aio_write(uint64_t off, bufferlist& bl,
                IOContext *ioc,