Commit 0341aafb7f3313bcedc6811a098500be85f3fc77

Authored by Jens Axboe
1 parent 50eaeb323a

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

Just cast the page size to sector_t, that will always fit.

Signed-off-by: Jens Axboe <jens.axboe@oracle.com>

Showing 1 changed file with 3 additions and 2 deletions Side-by-side Diff

... ... @@ -124,6 +124,7 @@
124 124 static void bio_batch_end_io(struct bio *bio, int err)
125 125 {
126 126 struct bio_batch *bb = bio->bi_private;
  127 +
127 128 if (err) {
128 129 if (err == -EOPNOTSUPP)
129 130 set_bit(BIO_EOPNOTSUPP, &bb->flags);
... ... @@ -186,8 +187,8 @@
186 187 if (flags & BLKDEV_IFL_WAIT)
187 188 bio->bi_private = &bb;
188 189  
189   - while(nr_sects != 0) {
190   - sz = min(PAGE_SIZE >> 9 , nr_sects);
  190 + while (nr_sects != 0) {
  191 + sz = min((sector_t) PAGE_SIZE >> 9 , nr_sects);
191 192 if (sz == 0)
192 193 /* bio has maximum size possible */
193 194 break;