From: Sage Weil Date: Mon, 4 Jan 2016 18:42:06 +0000 (-0500) Subject: os/bluestore/BlockDevice: read_buffered X-Git-Tag: v10.0.3~88^2~24 X-Git-Url: http://git-server-git.apps.pok.os.sepia.ceph.com/?a=commitdiff_plain;h=cfc8f4c2e70d26c64700b773f752bd8f9ea109ad;p=ceph.git os/bluestore/BlockDevice: read_buffered Signed-off-by: Sage Weil --- diff --git a/src/os/bluestore/BlockDevice.cc b/src/os/bluestore/BlockDevice.cc index 1d7656b49ee1..a4975c1450ba 100644 --- a/src/os/bluestore/BlockDevice.cc +++ b/src/os/bluestore/BlockDevice.cc @@ -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; diff --git a/src/os/bluestore/BlockDevice.h b/src/os/bluestore/BlockDevice.h index 187a7f57fe59..f5acc1113d95 100644 --- a/src/os/bluestore/BlockDevice.h +++ b/src/os/bluestore/BlockDevice.h @@ -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,