34 tmp_size = buffer_size;
37 int pack_count =
packInternal(pos, len, nbuf, tmp_buf, tmp_size);
39 if ((nbuf - pack_count > 0) &&
64 int iopb_offset =
m_iov.size();
67 assert(static_cast<IOSize>(len[0]) <= buffer_size);
72 IOSize buffer_used = len[0];
74 for (idx = 1; idx < nbuf; idx++) {
75 if (buffer_used + len[idx] > buffer_size) {
80 IOOffset extra_bytes_signed = (idx == 0) ? 0 : ((pos[idx] - iopb.
offset()) - iopb.
size());
81 assert(extra_bytes_signed >= 0);
82 IOSize extra_bytes =
static_cast<IOSize>(extra_bytes_signed);
85 (extra_bytes <
READ_COALESCE_SIZE) && (buffer_used + len[idx] + extra_bytes <= buffer_size)) {
94 buffer_used += (len[
idx] + extra_bytes);
100 m_iov.push_back(iopb);
113 buffer_used += len[
idx];
115 m_iov.push_back(iopb);
126 char *root_result_ptr = buf;
132 char *io_result_ptr =
static_cast<char *
>(iopb.
data()) + iopb_offset;
135 memmove(root_result_ptr, io_result_ptr,
m_len[
idx]);
147 m_iov.reserve(nbuf / 2);
std::vector< IOPosBuffer > m_iov
void set_data(void *new_buffer)
void set_size(IOSize new_size)
void reset(unsigned int nbuf)
std::vector< char > m_spare_buffer
void set_offset(IOOffset new_offset)
int pack(long long int *pos, int *len, int nbuf, char *buf, IOSize buffer_size)
IOOffset offset(void) const
std::vector< int > m_idx_to_iopb_offset
static const IOSize TEMPORARY_BUFFER_SIZE
int packInternal(long long int *pos, int *len, int nbuf, char *buf, IOSize buffer_size)
static const IOSize BIG_READ_SIZE
edm::propagate_const< int * > m_len
static const IOSize READ_COALESCE_SIZE
std::vector< int > m_idx_to_iopb