From db689dd813b721e893a0d32f1ee8a75f4d9efb3e Mon Sep 17 00:00:00 2001 From: Paul Lawrence Date: Tue, 26 Mar 2019 09:05:55 -0700 Subject: [PATCH] ANDROID: dm-bow: Fix 32 bit compile errors See https://www.kernel.org/doc/html/v4.17/core-api/printk-formats.html Also 64-bit modulus not defined on 32-bit architectures Test: i386_defconfig and x86_64_cuttlefish_defconfig compile Change-Id: I57b9372e12e97b9a18232191b525e7601bc57a24 Signed-off-by: Paul Lawrence --- drivers/md/dm-bow.c | 21 +++++++++++++-------- 1 file changed, 13 insertions(+), 8 deletions(-) diff --git a/drivers/md/dm-bow.c b/drivers/md/dm-bow.c index fa0675d58853..b92da30a3d42 100644 --- a/drivers/md/dm-bow.c +++ b/drivers/md/dm-bow.c @@ -267,7 +267,8 @@ static struct bow_range *find_free_range(struct bow_context *bc) static sector_t sector_to_page(struct bow_context const *bc, sector_t sector) { - WARN_ON(sector % (bc->block_size / SECTOR_SIZE) != 0); + WARN_ON((sector & (((sector_t)1 << (bc->block_shift - SECTOR_SHIFT)) - 1)) + != 0); return sector >> (bc->block_shift - SECTOR_SHIFT); } @@ -292,7 +293,8 @@ static int copy_data(struct bow_context const *bc, read = dm_bufio_read(bc->bufio, page, &read_buffer); if (IS_ERR(read)) { - DMERR("Cannot read page %lu", page); + DMERR("Cannot read page %llu", + (unsigned long long)page); return PTR_ERR(read); } @@ -953,8 +955,9 @@ static int add_trim(struct bow_context *bc, struct bio *bio) struct bow_range *br; struct bvec_iter bi_iter = bio->bi_iter; - DMDEBUG("add_trim: %lu, %u", - bio->bi_iter.bi_sector, bio->bi_iter.bi_size); + DMDEBUG("add_trim: %llu, %u", + (unsigned long long)bio->bi_iter.bi_sector, + bio->bi_iter.bi_size); do { br = find_first_overlapping_range(&bc->ranges, &bi_iter); @@ -991,8 +994,9 @@ static int remove_trim(struct bow_context *bc, struct bio *bio) struct bow_range *br; struct bvec_iter bi_iter = bio->bi_iter; - DMDEBUG("remove_trim: %lu, %u", - bio->bi_iter.bi_sector, bio->bi_iter.bi_size); + DMDEBUG("remove_trim: %llu, %u", + (unsigned long long)bio->bi_iter.bi_sector, + bio->bi_iter.bi_size); do { br = find_first_overlapping_range(&bc->ranges, &bi_iter); @@ -1117,8 +1121,9 @@ static void dm_bow_tablestatus(struct dm_target *ti, char *result, for (i = rb_first(&bc->ranges); i; i = rb_next(i)) { struct bow_range *br = container_of(i, struct bow_range, node); - result += scnprintf(result, end - result, "%s: %lu", - readable_type[br->type], br->sector); + result += scnprintf(result, end - result, "%s: %llu", + readable_type[br->type], + (unsigned long long)br->sector); if (result >= end) return; -- 2.20.1