Skip to content
  • Alan Stern's avatar
    [SCSI] sg: cap reserved_size values at max_sectors · 44ec9542
    Alan Stern authored
    
    
    This patch (as857) modifies the SG_GET_RESERVED_SIZE and
    SG_SET_RESERVED_SIZE ioctls in the sg driver, capping the values at
    the device's request_queue's max_sectors value.  This will permit
    cdrecord to obtain a legal value for the maximum transfer length,
    fixing Bugzilla #7026.
    
    The patch also caps the initial reserved_size value.  There's no
    reason to have a reserved buffer larger than max_sectors, since it
    would be impossible to use the extra space.
    
    The corresponding ioctls in the block layer are modified similarly,
    and the initial value for the reserved_size is set as large as
    possible.  This will effectively make it default to max_sectors.
    Note that the actual value is meaningless anyway, since block devices
    don't have a reserved buffer.
    
    Finally, the BLKSECTGET ioctl is added to sg, so that there will be a
    uniform way for users to determine the actual max_sectors value for
    any raw SCSI transport.
    
    Signed-off-by: default avatarAlan Stern <stern@rowland.harvard.edu>
    Acked-by: default avatarJens Axboe <jens.axboe@oracle.com>
    Acked-by: default avatarDouglas Gilbert <dougg@torque.net>
    Signed-off-by: default avatarJames Bottomley <James.Bottomley@SteelEye.com>
    44ec9542