• Alex Elder's avatar
    libceph: let osd ops determine request data length · 175face2
    Alex Elder authored
    The length of outgoing data in an osd request is dependent on the
    osd ops that are embedded in that request.  Each op is encoded into
    a request message using osd_req_encode_op(), so that should be used
    to determine the amount of outgoing data implied by the op as it
    is encoded.
    
    Have osd_req_encode_op() return the number of bytes of outgoing data
    implied by the op being encoded, and accumulate and use that in
    ceph_osdc_build_request().
    
    As a result, ceph_osdc_build_request() no longer requires its "len"
    parameter, so get rid of it.
    
    Using the sum of the op lengths rather than the length provided is
    a valid change because:
        - The only callers of osd ceph_osdc_build_request() are
          rbd and the osd client (in ceph_osdc_new_request() on
          behalf of the file system).
        - When rbd calls it, the length provided is only non-zero for
          write requests, and in that case the single op has the
          same length value as what was passed here.
        - When called from ceph_osdc_new_request(), (it's not all that
          easy to see, but) the length passed is also always the same
          as the extent length encoded in its (single) write op if
          present.
    
    This resolves:
        http://tracker.ceph.com/issues/4406Signed-off-by: default avatarAlex Elder <elder@inktank.com>
    Reviewed-by: default avatarJosh Durgin <josh.durgin@inktank.com>
    175face2
osd_client.c 58.2 KB