]> git-server-git.apps.pok.os.sepia.ceph.com Git - ceph-client.git/commit
libceph: let osd ops determine request data length
authorAlex Elder <elder@inktank.com>
Fri, 8 Mar 2013 19:35:36 +0000 (13:35 -0600)
committerGreg Farnum <greg@inktank.com>
Wed, 13 Mar 2013 00:45:21 +0000 (17:45 -0700)
commit774e53e441543ef015275d55ed146ec31b890cbc
tree9605a0a830b0f19422736bf48d34398fe8a8db73
parent846a10ef95d7c259b1dfbaa20d30a56e14b98e58
libceph: let osd ops determine request data length

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/4406

Signed-off-by: Alex Elder <elder@inktank.com>
Reviewed-by: Josh Durgin <josh.durgin@inktank.com>
drivers/block/rbd.c
include/linux/ceph/osd_client.h
net/ceph/osd_client.c