Skip to content
  • Stefan Hajnoczi's avatar
    d72915c6
    throttle: make throttle_config(throttle_get_config()) symmetric · d72915c6
    Stefan Hajnoczi authored
    
    
    Throttling has a weird property that throttle_get_config() does not
    always return the same throttling settings that were given with
    throttle_config().  In other words, the set and get functions aren't
    symmetric.
    
    If .max is 0 then the throttling code assigns a default value of .avg /
    10 in throttle_config().  This is an implementation detail of the
    throttling algorithm.  When throttle_get_config() is called the .max
    value returned should still be 0.
    
    Users are exposed to this quirk via "info block" or "query-block"
    monitor commands.  This has caused confusion because it looks like a bug
    when an unexpected value is reported.
    
    This patch hides the .max value adjustment in throttle_get_config() and
    updates test-throttle.c appropriately.
    
    Reported-by: default avatarNini Gu <ngu@redhat.com>
    Signed-off-by: default avatarStefan Hajnoczi <stefanha@redhat.com>
    Reviewed-by: default avatarAlberto Garcia <berto@igalia.com>
    Message-id: 20170301115026.22621-4-stefanha@redhat.com
    Signed-off-by: default avatarStefan Hajnoczi <stefanha@redhat.com>
    d72915c6
    throttle: make throttle_config(throttle_get_config()) symmetric
    Stefan Hajnoczi authored
    
    
    Throttling has a weird property that throttle_get_config() does not
    always return the same throttling settings that were given with
    throttle_config().  In other words, the set and get functions aren't
    symmetric.
    
    If .max is 0 then the throttling code assigns a default value of .avg /
    10 in throttle_config().  This is an implementation detail of the
    throttling algorithm.  When throttle_get_config() is called the .max
    value returned should still be 0.
    
    Users are exposed to this quirk via "info block" or "query-block"
    monitor commands.  This has caused confusion because it looks like a bug
    when an unexpected value is reported.
    
    This patch hides the .max value adjustment in throttle_get_config() and
    updates test-throttle.c appropriately.
    
    Reported-by: default avatarNini Gu <ngu@redhat.com>
    Signed-off-by: default avatarStefan Hajnoczi <stefanha@redhat.com>
    Reviewed-by: default avatarAlberto Garcia <berto@igalia.com>
    Message-id: 20170301115026.22621-4-stefanha@redhat.com
    Signed-off-by: default avatarStefan Hajnoczi <stefanha@redhat.com>
Loading