[dm-devel] [dm:for-next 8/9] drivers//md/dm-log-writes.c:279:17: note: in expansion of macro 'min'
kbuild test robot
fengguang.wu at intel.com
Tue Oct 24 21:44:34 UTC 2017
tree: https://git.kernel.org/pub/scm/linux/kernel/git/device-mapper/linux-dm.git for-next
head: ae613bbb0144e84cb3c0ebfa9f4fd4d1507c2f0e
commit: 6a697d036324c7fbe63fb49599027269006161e7 [8/9] dm log writes: add support for inline data buffers
config: i386-randconfig-x014-201743 (attached as .config)
compiler: gcc-6 (Debian 6.2.0-3) 6.2.0 20160901
reproduce:
git checkout 6a697d036324c7fbe63fb49599027269006161e7
# save the attached .config to linux build tree
make ARCH=i386
All warnings (new ones prefixed by >>):
In file included from include/linux/list.h:8:0,
from include/linux/wait.h:6,
from include/linux/wait_bit.h:7,
from include/linux/fs.h:5,
from include/linux/highmem.h:4,
from include/linux/bio.h:21,
from include/linux/device-mapper.h:11,
from drivers//md/dm-log-writes.c:7:
drivers//md/dm-log-writes.c: In function 'write_inline_data':
include/linux/kernel.h:790:16: warning: comparison of distinct pointer types lacks a cast
(void) (&min1 == &min2); \
^
include/linux/kernel.h:799:2: note: in expansion of macro '__min'
__min(typeof(x), typeof(y), \
^~~~~
>> drivers//md/dm-log-writes.c:279:17: note: in expansion of macro 'min'
pg_datalen = min(datalen, PAGE_SIZE);
^~~
vim +/min +279 drivers//md/dm-log-writes.c
248
249 static int write_inline_data(struct log_writes_c *lc, void *entry,
250 size_t entrylen, void *data, size_t datalen,
251 sector_t sector)
252 {
253 int num_pages, bio_pages, pg_datalen, pg_sectorlen, i;
254 struct page *page;
255 struct bio *bio;
256 size_t ret;
257 void *ptr;
258
259 while (datalen) {
260 num_pages = ALIGN(datalen, PAGE_SIZE) >> PAGE_SHIFT;
261 bio_pages = min(num_pages, BIO_MAX_PAGES);
262
263 atomic_inc(&lc->io_blocks);
264
265 bio = bio_alloc(GFP_KERNEL, bio_pages);
266 if (!bio) {
267 DMERR("Couldn't alloc inline data bio");
268 goto error;
269 }
270
271 bio->bi_iter.bi_size = 0;
272 bio->bi_iter.bi_sector = sector;
273 bio_set_dev(bio, lc->logdev->bdev);
274 bio->bi_end_io = log_end_io;
275 bio->bi_private = lc;
276 bio_set_op_attrs(bio, REQ_OP_WRITE, 0);
277
278 for (i = 0; i < bio_pages; i++) {
> 279 pg_datalen = min(datalen, PAGE_SIZE);
280 pg_sectorlen = ALIGN(pg_datalen, lc->sectorsize);
281
282 page = alloc_page(GFP_KERNEL);
283 if (!page) {
284 DMERR("Couldn't alloc inline data page");
285 goto error_bio;
286 }
287
288 ptr = kmap_atomic(page);
289 memcpy(ptr, data, pg_datalen);
290 if (pg_sectorlen > pg_datalen)
291 memset(ptr + pg_datalen, 0, pg_sectorlen - pg_datalen);
292 kunmap_atomic(ptr);
293
294 ret = bio_add_page(bio, page, pg_sectorlen, 0);
295 if (ret != pg_sectorlen) {
296 DMERR("Couldn't add page of inline data");
297 __free_page(page);
298 goto error_bio;
299 }
300
301 datalen -= pg_datalen;
302 data += pg_datalen;
303 }
304 submit_bio(bio);
305
306 sector += bio_pages * PAGE_SECTORS;
307 }
308 return 0;
309 error_bio:
310 bio_free_pages(bio);
311 bio_put(bio);
312 error:
313 put_io_block(lc);
314 return -1;
315 }
316
---
0-DAY kernel test infrastructure Open Source Technology Center
https://lists.01.org/pipermail/kbuild-all Intel Corporation
-------------- next part --------------
A non-text attachment was scrubbed...
Name: .config.gz
Type: application/gzip
Size: 32506 bytes
Desc: not available
URL: <http://listman.redhat.com/archives/dm-devel/attachments/20171025/7823cf2f/attachment.gz>
More information about the dm-devel
mailing list