On Wed, 29 Jul 2015 04:23:38 -0500, mchristi@xxxxxxxxxx wrote: > From: Mike Christie <michaelc@xxxxxxxxxxx> > > LIO uses scatterlist for its page/data management. This patch > adds a scatterlist messenger data type, so LIO can pass its sg > down directly to rbd. > > Signed-off-by: Mike Christie <michaelc@xxxxxxxxxxx> ... > /* > + * For a sg data item, a piece is whatever remains of the next > + * entry in the current sg entry, or the first entry in the next > + * sg in the list. > + */ > +static void ceph_msg_data_sg_cursor_init(struct ceph_msg_data_cursor *cursor, > + size_t length) > +{ > + struct ceph_msg_data *data = cursor->data; > + struct scatterlist *sg; > + > + BUG_ON(data->type != CEPH_MSG_DATA_SG); > + > + sg = data->sgl; > + BUG_ON(!sg); > + > + cursor->resid = min_t(u64, length, data->sgl_length); > + cursor->sg = sg; > + cursor->sg_consumed = data->sgl_init_offset; > + cursor->last_piece = cursor->resid <= sg->length; > +} Just in case the CEPH_MSG_DATA_SG changes are picked up, the cursor->last_piece calculation here needs to take into account the data->sgl_init_offset: if (cursor->resid <= (sg->length - data->sgl_init_offset)) cursor->last_piece = true; ... Cheers, David -- To unsubscribe from this list: send the line "unsubscribe ceph-devel" in the body of a message to majordomo@xxxxxxxxxxxxxxx More majordomo info at http://vger.kernel.org/majordomo-info.html