dm thin metadata: fix __udivdi3 undefined on 32-bit
authorMike Snitzer <snitzer@redhat.com>
Fri, 14 Sep 2018 01:16:20 +0000 (21:16 -0400)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Wed, 10 Oct 2018 06:54:28 +0000 (08:54 +0200)
commit 013ad043906b2befd4a9bfb06219ed9fedd92716 upstream.

sector_div() is only viable for use with sector_t.
dm_block_t is typedef'd to uint64_t -- so use div_u64() instead.

Fixes: 3ab918281 ("dm thin metadata: try to avoid ever aborting transactions")
Signed-off-by: Mike Snitzer <snitzer@redhat.com>
Cc: Sudip Mukherjee <sudipm.mukherjee@gmail.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
drivers/md/dm-thin-metadata.c

index 9f621b0c0e172330e678949c40016f9dba0804da..45ff8fd00248d3427ca796ce02f9002738932091 100644 (file)
@@ -841,10 +841,8 @@ static void __set_metadata_reserve(struct dm_pool_metadata *pmd)
        if (r) {
                DMERR("could not get size of metadata device");
                pmd->metadata_reserve = max_blocks;
-       } else {
-               sector_div(total, 10);
-               pmd->metadata_reserve = min(max_blocks, total);
-       }
+       } else
+               pmd->metadata_reserve = min(max_blocks, div_u64(total, 10));
 }
 
 struct dm_pool_metadata *dm_pool_metadata_open(struct block_device *bdev,