From 6c798ed940024e4766bf9b8797eafb556624d7c8 Mon Sep 17 00:00:00 2001 From: Sage Weil Date: Tue, 23 Apr 2013 15:44:42 -0700 Subject: [PATCH] librbd: implement read not in terms of read_iterate The read() method returns the bytes read, trimmed to the end of the image; use the other read() variant to do this (which use aio_read()) instead of read_iterate(). Signed-off-by: Sage Weil --- src/librbd/internal.cc | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/src/librbd/internal.cc b/src/librbd/internal.cc index c56f0a553b0..f57fb1d9d27 100644 --- a/src/librbd/internal.cc +++ b/src/librbd/internal.cc @@ -2459,7 +2459,9 @@ reprotect_and_return_err: ssize_t read(ImageCtx *ictx, uint64_t ofs, size_t len, char *buf) { - return read_iterate(ictx, ofs, len, simple_read_cb, buf); + vector > extents; + extents.push_back(make_pair(ofs, len)); + return read(ictx, extents, buf, NULL); } ssize_t read(ImageCtx *ictx, const vector >& image_extents, char *buf, bufferlist *pbl)