Skip to content
  • Eric Blake's avatar
    efa6e2ed
    block: Align block status requests · efa6e2ed
    Eric Blake authored
    
    
    Any device that has request_alignment greater than 512 should be
    unable to report status at a finer granularity; it may also be
    simpler for such devices to be guaranteed that the block layer
    has rounded things out to the granularity boundary (the way the
    block layer already rounds all other I/O out).  Besides, getting
    the code correct for super-sector alignment also benefits us
    for the fact that our public interface now has byte granularity,
    even though none of our drivers have byte-level callbacks.
    
    Add an assertion in blkdebug that proves that the block layer
    never requests status of unaligned sections, similar to what it
    does on other requests (while still keeping the generic helper
    in place for when future patches add a throttle driver).  Note
    that iotest 177 already covers this (it would fail if you use
    just the blkdebug.c hunk without the io.c changes).  Meanwhile,
    we can drop assertions in callers that no longer have to pass
    in sector-aligned addresses.
    
    There is a mid-function scope added for 'count' and 'longret',
    for a couple of reasons: first, an upcoming patch will add an
    'if' statement that checks whether a driver has an old- or
    new-style callback, and can conveniently use the same scope for
    less indentation churn at that time.  Second, since we are
    trying to get rid of sector-based computations, wrapping things
    in a scope makes it easier to group and see what will be
    deleted in a final cleanup patch once all drivers have been
    converted to the new-style callback.
    
    Signed-off-by: default avatarEric Blake <eblake@redhat.com>
    Signed-off-by: default avatarKevin Wolf <kwolf@redhat.com>
    efa6e2ed
    block: Align block status requests
    Eric Blake authored
    
    
    Any device that has request_alignment greater than 512 should be
    unable to report status at a finer granularity; it may also be
    simpler for such devices to be guaranteed that the block layer
    has rounded things out to the granularity boundary (the way the
    block layer already rounds all other I/O out).  Besides, getting
    the code correct for super-sector alignment also benefits us
    for the fact that our public interface now has byte granularity,
    even though none of our drivers have byte-level callbacks.
    
    Add an assertion in blkdebug that proves that the block layer
    never requests status of unaligned sections, similar to what it
    does on other requests (while still keeping the generic helper
    in place for when future patches add a throttle driver).  Note
    that iotest 177 already covers this (it would fail if you use
    just the blkdebug.c hunk without the io.c changes).  Meanwhile,
    we can drop assertions in callers that no longer have to pass
    in sector-aligned addresses.
    
    There is a mid-function scope added for 'count' and 'longret',
    for a couple of reasons: first, an upcoming patch will add an
    'if' statement that checks whether a driver has an old- or
    new-style callback, and can conveniently use the same scope for
    less indentation churn at that time.  Second, since we are
    trying to get rid of sector-based computations, wrapping things
    in a scope makes it easier to group and see what will be
    deleted in a final cleanup patch once all drivers have been
    converted to the new-style callback.
    
    Signed-off-by: default avatarEric Blake <eblake@redhat.com>
    Signed-off-by: default avatarKevin Wolf <kwolf@redhat.com>
Loading