Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux
1
fork

Configure Feed

Select the types of activity you want to include in your feed.

md/md-llbitmap: Use DIV_ROUND_UP_SECTOR_T

When building for 32-bit platforms, there are several link (if builtin)
or modpost (if a module) errors due to dividends of type 'sector_t' in
DIV_ROUND_UP:

arm-linux-gnueabi-ld: drivers/md/md-llbitmap.o: in function `llbitmap_resize':
drivers/md/md-llbitmap.c:1017:(.text+0xae8): undefined reference to `__aeabi_uldivmod'
arm-linux-gnueabi-ld: drivers/md/md-llbitmap.c:1020:(.text+0xb10): undefined reference to `__aeabi_uldivmod'
arm-linux-gnueabi-ld: drivers/md/md-llbitmap.o: in function `llbitmap_end_discard':
drivers/md/md-llbitmap.c:1114:(.text+0xf14): undefined reference to `__aeabi_uldivmod'
arm-linux-gnueabi-ld: drivers/md/md-llbitmap.o: in function `llbitmap_start_discard':
drivers/md/md-llbitmap.c:1097:(.text+0x1808): undefined reference to `__aeabi_uldivmod'
arm-linux-gnueabi-ld: drivers/md/md-llbitmap.o: in function `llbitmap_read_sb':
drivers/md/md-llbitmap.c:867:(.text+0x2080): undefined reference to `__aeabi_uldivmod'
arm-linux-gnueabi-ld: drivers/md/md-llbitmap.o:drivers/md/md-llbitmap.c:895: more undefined references to `__aeabi_uldivmod' follow

Use DIV_ROUND_UP_SECTOR_T instead of DIV_ROUND_UP, which exists to
handle this exact situation.

Fixes: 5ab829f1971d ("md/md-llbitmap: introduce new lockless bitmap")
Signed-off-by: Nathan Chancellor <nathan@kernel.org>
Signed-off-by: Jens Axboe <axboe@kernel.dk>

authored by

Nathan Chancellor and committed by
Jens Axboe
7935b843 a75fe12f

+8 -8
+8 -8
drivers/md/md-llbitmap.c
··· 781 781 782 782 while (chunks > space) { 783 783 chunksize = chunksize << 1; 784 - chunks = DIV_ROUND_UP(blocks, chunksize); 784 + chunks = DIV_ROUND_UP_SECTOR_T(blocks, chunksize); 785 785 } 786 786 787 787 llbitmap->barrier_idle = DEFAULT_BARRIER_IDLE; ··· 864 864 goto out_put_page; 865 865 } 866 866 867 - if (chunksize < DIV_ROUND_UP(mddev->resync_max_sectors, 868 - mddev->bitmap_info.space << SECTOR_SHIFT)) { 867 + if (chunksize < DIV_ROUND_UP_SECTOR_T(mddev->resync_max_sectors, 868 + mddev->bitmap_info.space << SECTOR_SHIFT)) { 869 869 pr_err("md/llbitmap: %s: chunksize too small %lu < %llu / %lu", 870 870 mdname(mddev), chunksize, mddev->resync_max_sectors, 871 871 mddev->bitmap_info.space); ··· 892 892 893 893 llbitmap->barrier_idle = DEFAULT_BARRIER_IDLE; 894 894 llbitmap->chunksize = chunksize; 895 - llbitmap->chunks = DIV_ROUND_UP(mddev->resync_max_sectors, chunksize); 895 + llbitmap->chunks = DIV_ROUND_UP_SECTOR_T(mddev->resync_max_sectors, chunksize); 896 896 llbitmap->chunkshift = ffz(~chunksize); 897 897 ret = llbitmap_cache_pages(llbitmap); 898 898 ··· 1014 1014 chunksize = llbitmap->chunksize; 1015 1015 1016 1016 /* If there is enough space, leave the chunksize unchanged. */ 1017 - chunks = DIV_ROUND_UP(blocks, chunksize); 1017 + chunks = DIV_ROUND_UP_SECTOR_T(blocks, chunksize); 1018 1018 while (chunks > mddev->bitmap_info.space << SECTOR_SHIFT) { 1019 1019 chunksize = chunksize << 1; 1020 - chunks = DIV_ROUND_UP(blocks, chunksize); 1020 + chunks = DIV_ROUND_UP_SECTOR_T(blocks, chunksize); 1021 1021 } 1022 1022 1023 1023 llbitmap->chunkshift = ffz(~chunksize); ··· 1094 1094 unsigned long sectors) 1095 1095 { 1096 1096 struct llbitmap *llbitmap = mddev->bitmap; 1097 - unsigned long start = DIV_ROUND_UP(offset, llbitmap->chunksize); 1097 + unsigned long start = DIV_ROUND_UP_SECTOR_T(offset, llbitmap->chunksize); 1098 1098 unsigned long end = (offset + sectors - 1) >> llbitmap->chunkshift; 1099 1099 int page_start = (start + BITMAP_DATA_OFFSET) >> PAGE_SHIFT; 1100 1100 int page_end = (end + BITMAP_DATA_OFFSET) >> PAGE_SHIFT; ··· 1111 1111 unsigned long sectors) 1112 1112 { 1113 1113 struct llbitmap *llbitmap = mddev->bitmap; 1114 - unsigned long start = DIV_ROUND_UP(offset, llbitmap->chunksize); 1114 + unsigned long start = DIV_ROUND_UP_SECTOR_T(offset, llbitmap->chunksize); 1115 1115 unsigned long end = (offset + sectors - 1) >> llbitmap->chunkshift; 1116 1116 int page_start = (start + BITMAP_DATA_OFFSET) >> PAGE_SHIFT; 1117 1117 int page_end = (end + BITMAP_DATA_OFFSET) >> PAGE_SHIFT;