• K
    qcow2: Fix avail_sectors in cluster allocation code · b7ab0fea
    Kevin Wolf 提交于
    avail_sectors should really be the number of sectors from the start of
    the allocation, not from the start of the write request.
    
    We're lucky enough that this mistake didn't cause any real bug.
    avail_sectors is only used in the intialiser of QCowL2Meta:
    
      .nb_available   = MIN(requested_sectors, avail_sectors),
    
    m->nb_available in turn is only used for COW at the end of the
    allocation. A COW occurs only if the request wasn't cluster aligned,
    which in turn would imply that requested_sectors was less than
    avail_sectors (both in the original and in the fixed version). In this
    case avail_sectors is ignored and therefore the mistake doesn't cause
    any misbehaviour.
    Signed-off-by: NKevin Wolf <kwolf@redhat.com>
    b7ab0fea
qcow2-cluster.c 35.3 KB