bound = b;
}
+uint32_t Infiniband::MemoryManager::Chunk::get_size() const
+{
+ return bound - offset;
+}
+
void Infiniband::MemoryManager::Chunk::prepare_read(uint32_t b)
{
offset = 0;
uint32_t Infiniband::MemoryManager::Chunk::read(char* buf, uint32_t len)
{
- uint32_t left = bound - offset;
+ uint32_t left = get_size();
if (left >= len) {
memcpy(buf, buffer+offset, len);
offset += len;
return offset == bytes;
}
-bool Infiniband::MemoryManager::Chunk::over()
-{
- return Infiniband::MemoryManager::Chunk::offset == bound;
-}
-
void Infiniband::MemoryManager::Chunk::clear()
{
offset = 0;
void set_offset(uint32_t o);
uint32_t get_offset();
void set_bound(uint32_t b);
+ uint32_t get_size() const;
void prepare_read(uint32_t b);
uint32_t get_bound();
uint32_t read(char* buf, uint32_t len);
uint32_t write(char* buf, uint32_t len);
bool full();
- bool over();
void clear();
public:
tmp = (*c)->read(buf+read, len-read);
read += tmp;
ldout(cct, 25) << __func__ << " this iter read: " << tmp << " bytes." << " offset: " << (*c)->get_offset() << " ,bound: " << (*c)->get_bound() << ". Chunk:" << *c << dendl;
- if ((*c)->over()) {
+ if ((*c)->get_size() == 0) {
dispatcher->post_chunk_to_pool(*c);
update_post_backlog();
ldout(cct, 25) << __func__ << " one chunk over." << dendl;
}
}
- if (c != buffers.end() && (*c)->over())
+ if (c != buffers.end() && (*c)->get_size() == 0)
++c;
buffers.erase(buffers.begin(), c);
ldout(cct, 25) << __func__ << " got " << read << " bytes, buffers size: " << buffers.size() << dendl;