aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorAlan Stern2007-02-20 10:01:57 -0600
committerJames Bottomley2007-04-17 17:09:56 -0500
commit44ec95425c1d9dce6e4638c29e4362cfb44814e7 (patch)
tree6af593dc23a2f7cdb9a0d3ecc46d37aae640c0d8 /block/ll_rw_blk.c
parent1079a2d251f24a7d9e7576217f5f738bc4218337 (diff)
downloadkernel-common-44ec95425c1d9dce6e4638c29e4362cfb44814e7.tar.gz
kernel-common-44ec95425c1d9dce6e4638c29e4362cfb44814e7.tar.xz
kernel-common-44ec95425c1d9dce6e4638c29e4362cfb44814e7.zip
[SCSI] sg: cap reserved_size values at max_sectors
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: Alan Stern <stern@rowland.harvard.edu> Acked-by: Jens Axboe <jens.axboe@oracle.com> Acked-by: Douglas Gilbert <dougg@torque.net> Signed-off-by: James Bottomley <James.Bottomley@SteelEye.com>
Diffstat (limited to 'block/ll_rw_blk.c')
-rw-r--r--block/ll_rw_blk.c2
1 files changed, 2 insertions, 0 deletions
diff --git a/block/ll_rw_blk.c b/block/ll_rw_blk.c
index 38c293b987b..cf8752abd61 100644
--- a/block/ll_rw_blk.c
+++ b/block/ll_rw_blk.c
@@ -1925,6 +1925,8 @@ blk_init_queue_node(request_fn_proc *rfn, spinlock_t *lock, int node_id)
1925 blk_queue_max_hw_segments(q, MAX_HW_SEGMENTS); 1925 blk_queue_max_hw_segments(q, MAX_HW_SEGMENTS);
1926 blk_queue_max_phys_segments(q, MAX_PHYS_SEGMENTS); 1926 blk_queue_max_phys_segments(q, MAX_PHYS_SEGMENTS);
1927 1927
1928 q->sg_reserved_size = INT_MAX;
1929
1928 /* 1930 /*
1929 * all done 1931 * all done
1930 */ 1932 */