• E
    block: Return -ENOTSUP rather than assert on unaligned discards · 49228d1e
    Eric Blake 提交于
    Right now, the block layer rounds discard requests, so that
    individual drivers are able to assert that discard requests
    will never be unaligned.  But there are some ISCSI devices
    that track and coalesce multiple unaligned requests, turning it
    into an actual discard if the requests eventually cover an
    entire page, which implies that it is better to always pass
    discard requests as low down the stack as possible.
    
    In isolation, this patch has no semantic effect, since the
    block layer currently never passes an unaligned request through.
    But the block layer already has code that silently ignores
    drivers that return -ENOTSUP for a discard request that cannot
    be honored (as well as drivers that return 0 even when nothing
    was done).  But the next patch will update the block layer to
    fragment discard requests, so that clients are guaranteed that
    they are either dealing with an unaligned head or tail, or an
    aligned core, making it similar to the block layer semantics of
    write zero fragmentation.
    
    CC: qemu-stable@nongnu.org
    Signed-off-by: NEric Blake <eblake@redhat.com>
    Reviewed-by: NMax Reitz <mreitz@redhat.com>
    Signed-off-by: NKevin Wolf <kwolf@redhat.com>
    49228d1e
iscsi.c 64.2 KB