]> git.hungrycats.org Git - linux/commitdiff
[PATCH] adjust SG reserved size automatically
authorJens Axboe <axboe@suse.de>
Mon, 9 Aug 2004 03:28:06 +0000 (20:28 -0700)
committerLinus Torvalds <torvalds@ppc970.osdl.org>
Mon, 9 Aug 2004 03:28:06 +0000 (20:28 -0700)
The block layer SG should have the identical behaviour as SCSI sg when
it comes to SG_SET_RESERVED_SIZE - allow caller to specify a large
amount, truncate to largest we support, and return that with
SG_GET_RESERVED_SIZE.  Currently we fail with -EINVAL if the value is
too large, I think the SCSI sg behaviour is more sane to use.  This
one-liner fixes it up, please apply for 2.6.8.

Signed-off-by: Jens Axboe <axboe@suse.de>
Signed-off-by: Linus Torvalds <torvalds@osdl.org>
drivers/block/scsi_ioctl.c

index f57dd9d77f23a2ef279d0cff2ca7214091ab3c5a..03df600806502a6562823efa6c68c1b4dd65e418 100644 (file)
@@ -90,7 +90,7 @@ static int sg_set_reserved_size(request_queue_t *q, int __user *p)
        if (size < 0)
                return -EINVAL;
        if (size > (q->max_sectors << 9))
-               return -EINVAL;
+               size = q->max_sectors << 9;
 
        q->sg_reserved_size = size;
        return 0;