25 #include <sys/types.h>
50 XrdCephOssFile(cephoss), m_cephoss(cephoss), m_xrdOssDF(cephossDF),m_algname(algname)
59 XrdCephEroute.
Say(
"XrdCephOssReadVFile::ERROR Invalid ReadV algorthm passed; defaulting to passthrough");
80 LOGCEPH(
"XrdCephOssReadVFile::Open: fd: " <<
m_fd <<
" " << path );
85 LOGCEPH(
"XrdCephOssReadVFile::Close: retsz: " << retsz <<
" Time_ceph_s: " <<
m_timer_read_ns.load()*1e-9 <<
" count: "
95 LOGCEPH(
"XrdCephOssReadVFile::ReadV: fd: " <<
fd <<
" " << rnum );
97 std::stringstream msg_extents;
98 msg_extents <<
"XrdCephOssReadVFile::Extentslist={\"fd\": " <<
fd <<
", \"EXTENTS\":[";
101 for (
int i = 0; i < rnum; i++) {
103 msg_extents <<
"[" << readV[i].
offset <<
"," << readV[i].
size <<
"]," ;
113 LOGCEPH(
"XrdCephOssReadVFile::Extents: fd: "<<
fd <<
" " << extents.
size() <<
" " << extents.
len() <<
" "
118 std::vector<ExtentHolder> mappedExtents =
m_readVAdapter->convert(extents);
122 int nbytes = 0, curCount = 0, counter(0);
123 size_t totalBytesRead(0), totalBytesUseful(0);
126 size_t buffersize{0};
127 for (std::vector<ExtentHolder>::const_iterator ehit = mappedExtents.cbegin(); ehit!= mappedExtents.cend(); ++ehit ) {
128 buffersize = std::max(buffersize, ehit->len());
130 std::vector<char> buffer;
131 buffer.reserve(buffersize);
135 for (std::vector<ExtentHolder>::const_iterator ehit = mappedExtents.cbegin(); ehit!= mappedExtents.cend(); ++ehit ) {
136 off_t off = ehit->begin();
137 size_t len = ehit->len();
142 long timed_read_ns{0};
154 if (curCount != (ssize_t)len) {
155 return (curCount < 0 ? curCount : -ESPIPE);
157 totalBytesRead += curCount;
158 totalBytesUseful += ehit->bytesContained();
162 const char* data = buffer.data();
164 for (ExtentContainer::const_iterator it = innerExtents.cbegin(); it != innerExtents.cend(); ++it) {
165 off_t innerBegin = it->begin() - off;
166 off_t innerEnd = it->end() - off;
170 std::copy(data+innerBegin, data+innerEnd, readV[counter].data );
176 LOGCEPH(
"readV returning " << nbytes <<
" bytes: " <<
"Read: " <<totalBytesRead <<
" Useful: " << totalBytesUseful );
XrdSysError XrdCephEroute
static std::string ts()
timestamp output for logging messages
int stat(const char *path, struct stat *buf)
Designed to hold individual extents, but itself provide Extent-like capabilities Useful in cases of c...
size_t bytesContained() const
size_t size() const
number of extent elements
void push_back(const Extent &in)
size_t bytesMissing() const
Combine requests into single reads accoriding to some basic rules. Read a minimum amount of data (2Mi...
Passthrough implementation. Convertes the ReadV requests to extents and makes the request....
virtual ssize_t Read(off_t offset, size_t blen)
virtual int Open(const char *path, int flags, mode_t mode, XrdOucEnv &env)
virtual ssize_t Write(const void *buff, off_t offset, size_t blen)
virtual int Fstat(struct stat *buff)
virtual int Ftruncate(unsigned long long)
virtual ssize_t ReadRaw(void *, off_t, size_t)
virtual int Close(long long *retsz=0)
virtual int getFileDescriptor() const
virtual int Close(long long *retsz=0)
std::atomic< long > m_timer_longest
number of reads
virtual ssize_t Read(off_t offset, size_t blen)
std::atomic< long > m_timer_size
number of reads
std::unique_ptr< XrdCephBuffer::IXrdCephReadVAdapter > m_readVAdapter
virtual ssize_t ReadV(XrdOucIOVec *readV, int rdvcnt)
virtual ~XrdCephOssReadVFile()
std::atomic< long > m_timer_read_ns
virtual ssize_t Write(const void *buff, off_t offset, size_t blen)
std::atomic< long > m_timer_count
timer for the reads against ceph
virtual int Open(const char *path, int flags, mode_t mode, XrdOucEnv &env)
XrdCephOssReadVFile(XrdCephOss *cephoss, XrdCephOssFile *cephossDF, const std::string &algname)
virtual int Ftruncate(unsigned long long)
virtual ssize_t ReadRaw(void *, off_t, size_t)
XrdCephOssFile * m_xrdOssDF
virtual int Fstat(struct stat *buff)
void Say(const char *text1, const char *text2=0, const char *txt3=0, const char *text4=0, const char *text5=0, const char *txt6=0)
is a simple implementation of IXrdCephBufferData using std::vector<char> representation for the buffe...
std::vector< Extent > ExtentContainer
Container defintion for Extents Typedef to provide a container of extents as a simple stl vector cont...