Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
librbd: integrate image cache hooks into IO path
Signed-off-by: Jason Dillaman <dillaman@redhat.com>
- Loading branch information
Jason Dillaman
committed
Aug 26, 2016
1 parent
1b44a03
commit 0c1e8f3
Showing
5 changed files
with
80 additions
and
6 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,38 @@ | ||
// -*- mode:C; tab-width:8; c-basic-offset:2; indent-tabs-mode:t -*- | ||
// vim: ts=8 sw=2 smarttab | ||
|
||
#ifndef CEPH_TEST_LIBRBD_CACHE_MOCK_IMAGE_CACHE_H | ||
#define CEPH_TEST_LIBRBD_CACHE_MOCK_IMAGE_CACHE_H | ||
|
||
#include "gmock/gmock.h" | ||
#include <vector> | ||
|
||
namespace librbd { | ||
namespace cache { | ||
|
||
struct MockImageCache { | ||
typedef std::vector<std::pair<uint64_t,uint64_t> > Extents; | ||
|
||
MOCK_METHOD4(aio_read_mock, void(const Extents &, ceph::bufferlist*, int, | ||
Context *)); | ||
void aio_read(Extents&& image_extents, ceph::bufferlist* bl, | ||
int fadvise_flags, Context *on_finish) { | ||
aio_read_mock(image_extents, bl, fadvise_flags, on_finish); | ||
} | ||
|
||
|
||
MOCK_METHOD4(aio_write_mock, void(const Extents &, const ceph::bufferlist &, | ||
int, Context *)); | ||
void aio_write(Extents&& image_extents, ceph::bufferlist&& bl, | ||
int fadvise_flags, Context *on_finish) { | ||
aio_write_mock(image_extents, bl, fadvise_flags, on_finish); | ||
} | ||
|
||
MOCK_METHOD3(aio_discard, void(uint64_t, uint64_t, Context *)); | ||
MOCK_METHOD1(aio_flush, void(Context *)); | ||
}; | ||
|
||
} // namespace cache | ||
} // namespace librbd | ||
|
||
#endif // CEPH_TEST_LIBRBD_CACHE_MOCK_IMAGE_CACHE_H |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters