return err;
}
-static int max_sectors_bytes(struct request_queue *q)
-{
- unsigned int max_sectors = queue_max_sectors(q);
-
- max_sectors = min_t(unsigned int, max_sectors, INT_MAX >> 9);
-
- return max_sectors << 9;
-}
-
static int sg_get_reserved_size(struct request_queue *q, int __user *p)
{
- int val = min_t(int, q->sg_reserved_size, max_sectors_bytes(q));
+ int val = min(q->sg_reserved_size, queue_max_bytes(q));
return put_user(val, p);
}
if (size < 0)
return -EINVAL;
- q->sg_reserved_size = min(size, max_sectors_bytes(q));
+ q->sg_reserved_size = min_t(unsigned int, size, queue_max_bytes(q));
return 0;
}
return q->limits.max_sectors;
}
+static inline unsigned int queue_max_bytes(struct request_queue *q)
+{
+ return min_t(unsigned int, queue_max_sectors(q), INT_MAX >> 9) << 9;
+}
+
static inline unsigned int queue_max_hw_sectors(const struct request_queue *q)
{
return q->limits.max_hw_sectors;