• Alex Elder's avatar
    rbd: don't bother calculating file mapping · 47dba7ba
    Alex Elder authored
    When rbd_do_request() has a request to process it initializes a ceph
    file layout structure and uses it to compute offsets and limits for
    the range of the request using ceph_calc_file_object_mapping().
    
    The layout used is fixed, and is based on RBD_MAX_OBJ_ORDER (30).
    It sets the layout's object size and stripe unit to be 1 GB (2^30),
    and sets the stripe count to be 1.
    
    The job of ceph_calc_file_object_mapping() is to determine which
    of a sequence of objects will contain data covered by range, and
    within that object, at what offset the range starts.  It also
    truncates the length of the range at the end of the selected object
    if necessary.
    
    This is needed for ceph fs, but for rbd it really serves no purpose.
    It does its own blocking of images into objects, echo of which is
    (1 << obj_order) in size, and as a result it ignores the "bno"
    value returned by ceph_calc_file_object_mapping().  In addition,
    by the point a request has reached this function, it is already
    destined for a single rbd object, and its length will not exceed
    that object's extent.  Because of this, and because the mapping will
    result in blocking up the range using an integer multiple of the
    image's object order, ceph_calc_file_object_mapping() will never
    change the offset or length values defined by the request.
    
    In other words, this call is a big no-op for rbd data requests.
    
    There is one exception.  We read the header object using this
    function, and in that case we will not have already limited the
    request size.  However, the header is a single object (not a file or
    rbd image), and should not be broken into pieces anyway.  So in fact
    we should *not* be calling ceph_calc_file_object_mapping() when
    operating on the header object.
    
    So...
    
    Don't call ceph_calc_file_object_mapping() in rbd_do_request(),
    because useless for image data and incorrect to do sofor the image
    header.
    Signed-off-by: default avatarAlex Elder <elder@inktank.com>
    Reviewed-by: default avatarJosh Durgin <josh.durgin@inktank.com>
    47dba7ba
rbd.c 90.6 KB