Implements a non-async read and write to ceph via ceph_posix calls Using the standard ceph_posix_ calls do the actual read and write operations. No ownership is taken on the buffer that's passed via the constructor.
More...
#include <CephIOAdapterRaw.hh>
|
| CephIOAdapterRaw (IXrdCephBufferData *bufferdata, int fd, bool useStriperlessReads) |
|
virtual | ~CephIOAdapterRaw () |
|
virtual ssize_t | read (off64_t offset, size_t count) override |
| Issue a ceph_posix_pread to read to the buffer data from file offset and len count. No range checking is currently provided here. The caller must provide sufficient space for the max len read. Returns -ve errorcode on failure, else the number of bytes returned. More...
|
|
virtual ssize_t | write (off64_t offset, size_t count) override |
| Take the data in the buffer and write to ceph at given offset Issues a ceph_posix_pwrite for data in the buffer (from pos 0) into ceph at position offset with len count. Returns -ve on error, else the number of bytes writen. More...
|
|
virtual | ~ICephIOAdapter () |
|
Implements a non-async read and write to ceph via ceph_posix calls Using the standard ceph_posix_ calls do the actual read and write operations. No ownership is taken on the buffer that's passed via the constructor.
Definition at line 28 of file CephIOAdapterRaw.hh.
◆ CephIOAdapterRaw()
CephIOAdapterRaw::CephIOAdapterRaw |
( |
IXrdCephBufferData * |
bufferdata, |
|
|
int |
fd, |
|
|
bool |
useStriperlessReads |
|
) |
| |
Definition at line 14 of file CephIOAdapterRaw.cc.
16 m_bufferdata(bufferdata),m_fd(fd),
17 m_useStriperlessReads(useStriperlessReads) {
◆ ~CephIOAdapterRaw()
CephIOAdapterRaw::~CephIOAdapterRaw |
( |
| ) |
|
|
virtual |
Definition at line 20 of file CephIOAdapterRaw.cc.
22 float read_speed{0}, write_speed{0};
23 if (m_stats_read_req.load() > 0 && m_stats_read_timer.load() > 0 ) {
24 read_speed = m_stats_read_bytes.load() / m_stats_read_timer.load() * 1e-6;
26 if (m_stats_write_req.load() > 0 && m_stats_read_timer.load() > 0 ) {
27 write_speed = m_stats_write_bytes.load() / m_stats_write_timer.load() * 1e-6;
29 BUFLOG(
"CephIOAdapterRaw::Summary fd:" << m_fd
30 <<
" nwrite:" << m_stats_write_req <<
" byteswritten:" << m_stats_write_bytes <<
" write_s:"
31 << m_stats_write_timer * 1e-6 <<
" writemax_s" << m_stats_write_longest * 1e-6
32 <<
" write_MBs:" << write_speed
33 <<
" nread:" << m_stats_read_req <<
" bytesread:" << m_stats_read_bytes <<
" read_s:"
34 << m_stats_read_timer * 1e-6 <<
" readmax_s:" << m_stats_read_longest * 1e-6
35 <<
" read_MBs:" << read_speed
36 <<
" striperlessRead: " << m_useStriperlessReads
References BUFLOG.
◆ read()
ssize_t CephIOAdapterRaw::read |
( |
off64_t |
offset, |
|
|
size_t |
count |
|
) |
| |
|
overridevirtual |
Issue a ceph_posix_pread to read to the buffer data from file offset and len count. No range checking is currently provided here. The caller must provide sufficient space for the max len read. Returns -ve errorcode on failure, else the number of bytes returned.
- Parameters
-
- Returns
- ssize_t
Implements XrdCephBuffer::ICephIOAdapter.
Definition at line 62 of file CephIOAdapterRaw.cc.
63 void* buf = m_bufferdata->
raw();
70 auto start = std::chrono::steady_clock::now();
72 auto end = std::chrono::steady_clock::now();
74 auto int_ns = std::chrono::duration_cast<std::chrono::nanoseconds>(end-start);
77 BUFLOG(
"CephIOAdapterRaw::read: Error in read: " << rc );
81 m_stats_read_longest = std::max(m_stats_read_longest,
static_cast<long long>(int_ns.count()));
82 m_stats_read_timer.fetch_add(
static_cast<long long>(int_ns.count()));
83 m_stats_read_bytes.fetch_add(rc);
ssize_t ceph_posix_maybestriper_pread(int fd, void *buf, size_t count, off64_t offset, bool allowStriper)
virtual off_t setStartingOffset(off_t offset)=0
virtual void setLength(size_t len)=0
Currently occupied and valid space, which may be less than capacity.
virtual void setValid(bool isValid)=0
virtual const void * raw() const =0
write data into the buffer, store the external offset
References BUFLOG, ceph_posix_maybestriper_pread(), XrdCephBuffer::IXrdCephBufferData::raw(), XrdCephBuffer::IXrdCephBufferData::setLength(), XrdCephBuffer::IXrdCephBufferData::setStartingOffset(), and XrdCephBuffer::IXrdCephBufferData::setValid().
◆ write()
ssize_t CephIOAdapterRaw::write |
( |
off64_t |
offset, |
|
|
size_t |
count |
|
) |
| |
|
overridevirtual |
Take the data in the buffer and write to ceph at given offset Issues a ceph_posix_pwrite for data in the buffer (from pos 0) into ceph at position offset with len count. Returns -ve on error, else the number of bytes writen.
- Parameters
-
- Returns
- ssize_t
Implements XrdCephBuffer::ICephIOAdapter.
Definition at line 41 of file CephIOAdapterRaw.cc.
42 const void* buf = m_bufferdata->
raw();
43 if (!buf)
return -EINVAL;
45 auto start = std::chrono::steady_clock::now();
47 auto end = std::chrono::steady_clock::now();
48 auto int_ns = std::chrono::duration_cast<std::chrono::nanoseconds>(end-start);
53 if (rc < 0)
return rc;
54 m_stats_write_longest = std::max(m_stats_write_longest,
static_cast<long long>(int_ns.count()));
55 m_stats_write_timer.fetch_add(
static_cast<long long>(int_ns.count()));
56 m_stats_write_bytes.fetch_add(rc);
ssize_t ceph_posix_pwrite(int fd, const void *buf, size_t count, off64_t offset)
References ceph_posix_pwrite(), and XrdCephBuffer::IXrdCephBufferData::raw().
The documentation for this class was generated from the following files: