提交 0341aafb 编写于 作者: J Jens Axboe

block: fix bad use of min() on different types

Just cast the page size to sector_t, that will always fit.
Signed-off-by: NJens Axboe <jens.axboe@oracle.com>
上级 50eaeb32
...@@ -124,6 +124,7 @@ struct bio_batch ...@@ -124,6 +124,7 @@ struct bio_batch
static void bio_batch_end_io(struct bio *bio, int err) static void bio_batch_end_io(struct bio *bio, int err)
{ {
struct bio_batch *bb = bio->bi_private; struct bio_batch *bb = bio->bi_private;
if (err) { if (err) {
if (err == -EOPNOTSUPP) if (err == -EOPNOTSUPP)
set_bit(BIO_EOPNOTSUPP, &bb->flags); set_bit(BIO_EOPNOTSUPP, &bb->flags);
...@@ -186,8 +187,8 @@ int blkdev_issue_zeroout(struct block_device *bdev, sector_t sector, ...@@ -186,8 +187,8 @@ int blkdev_issue_zeroout(struct block_device *bdev, sector_t sector,
if (flags & BLKDEV_IFL_WAIT) if (flags & BLKDEV_IFL_WAIT)
bio->bi_private = &bb; bio->bi_private = &bb;
while(nr_sects != 0) { while (nr_sects != 0) {
sz = min(PAGE_SIZE >> 9 , nr_sects); sz = min((sector_t) PAGE_SIZE >> 9 , nr_sects);
if (sz == 0) if (sz == 0)
/* bio has maximum size possible */ /* bio has maximum size possible */
break; break;
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册