1 // -*- mode:C++; tab-width:8; c-basic-offset:2; indent-tabs-mode:t -*-
2 // vim: ts=8 sw=2 smarttab
4 * Ceph - scalable distributed file system
6 * Copyright (C) 2015 Intel <jianpeng.ma@intel.com>
8 * Author: Jianpeng Ma <jianpeng.ma@intel.com>
10 * This is free software; you can redistribute it and/or
11 * modify it under the terms of the GNU Lesser General Public
12 * License version 2.1, as published by the Free Software
13 * Foundation. See file COPYING.
17 #ifndef CEPH_OS_BLUESTORE_PMEMDEVICE_H
18 #define CEPH_OS_BLUESTORE_PMEMDEVICE_H
23 #include "include/interval_set.h"
25 #include "BlockDevice.h"
27 class PMEMDevice
: public BlockDevice
{
29 char *addr
; //the address of mmap
35 interval_set
<uint64_t> debug_inflight
;
37 std::atomic_int injecting_crash
;
41 PMEMDevice(CephContext
*cct
, aio_callback_t cb
, void *cbpriv
);
44 void aio_submit(IOContext
*ioc
) override
;
46 uint64_t get_size() const override
{
49 uint64_t get_block_size() const override
{
53 int collect_metadata(std::string prefix
, map
<std::string
,std::string
> *pm
) const override
;
55 int read(uint64_t off
, uint64_t len
, bufferlist
*pbl
,
57 bool buffered
) override
;
58 int aio_read(uint64_t off
, uint64_t len
, bufferlist
*pbl
,
59 IOContext
*ioc
) override
;
61 int read_random(uint64_t off
, uint64_t len
, char *buf
, bool buffered
) override
;
62 int write(uint64_t off
, bufferlist
& bl
, bool buffered
) override
;
63 int aio_write(uint64_t off
, bufferlist
& bl
,
65 bool buffered
) override
;
68 // for managing buffered readers/writers
69 int invalidate_cache(uint64_t off
, uint64_t len
) override
;
70 int open(const std::string
&path
) override
;
71 void close() override
;