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.
|
|
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.
|
|
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.
15 :
16 m_bufferdata(bufferdata),m_fd(fd),
17 m_useStriperlessReads(useStriperlessReads) {
18}
◆ ~CephIOAdapterRaw()
CephIOAdapterRaw::~CephIOAdapterRaw |
( |
| ) |
|
|
virtual |
Definition at line 20 of file CephIOAdapterRaw.cc.
20 {
21
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;
25 }
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;
28 }
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
37 );
38
39}
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.
62 {
63 void* buf = m_bufferdata->raw();
64 if (!buf) {
65 return -EINVAL;
66 }
67 ssize_t rc {0};
68
69
70 auto start = std::chrono::steady_clock::now();
72 auto end = std::chrono::steady_clock::now();
73
74 auto int_ns = std::chrono::duration_cast<std::chrono::nanoseconds>(end-start);
75
76 if (rc < 0) {
77 BUFLOG(
"CephIOAdapterRaw::read: Error in read: " << rc );
78 return rc;
79 }
80
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);
84 ++m_stats_read_req;
85
86
87
88
89 if (rc>=0) {
90 m_bufferdata->setLength(rc);
91 m_bufferdata->setStartingOffset(offset);
92 m_bufferdata->setValid(true);
93 }
94 return rc;
95}
ssize_t ceph_posix_maybestriper_pread(int fd, void *buf, size_t count, off64_t offset, bool allowStriper)
References BUFLOG, and ceph_posix_maybestriper_pread().
◆ 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.
41 {
42 const void* buf = m_bufferdata->raw();
43 if (!buf) return -EINVAL;
44
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);
49
50
51
52
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);
57 ++m_stats_write_req;
58 return rc;
59}
ssize_t ceph_posix_pwrite(int fd, const void *buf, size_t count, off64_t offset)
References ceph_posix_pwrite().
The documentation for this class was generated from the following files: