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

bcache: Fix building error on MIPS

This patch try to fix the building error on MIPS. The reason is MIPS
has already defined the PTR macro, which conflicts with the PTR macro
in include/uapi/linux/bcache.h.

[fixed by mlyle: corrected a line-length issue]

Cc: stable@vger.kernel.org
Signed-off-by: Huacai Chen <chenhc@lemote.com>
Reviewed-by: Michael Lyle <mlyle@lyle.org>
Signed-off-by: Michael Lyle <mlyle@lyle.org>
Signed-off-by: Jens Axboe <axboe@kernel.dk>

authored by

Huacai Chen and committed by
Jens Axboe
cf33c1ee bb22cafd

+4 -4
+1 -1
drivers/md/bcache/alloc.c
··· 490 490 if (b == -1) 491 491 goto err; 492 492 493 - k->ptr[i] = PTR(ca->buckets[b].gen, 493 + k->ptr[i] = MAKE_PTR(ca->buckets[b].gen, 494 494 bucket_to_sector(c, b), 495 495 ca->sb.nr_this_dev); 496 496
+1 -1
drivers/md/bcache/extents.c
··· 585 585 return false; 586 586 587 587 for (i = 0; i < KEY_PTRS(l); i++) 588 - if (l->ptr[i] + PTR(0, KEY_SIZE(l), 0) != r->ptr[i] || 588 + if (l->ptr[i] + MAKE_PTR(0, KEY_SIZE(l), 0) != r->ptr[i] || 589 589 PTR_BUCKET_NR(b->c, l, i) != PTR_BUCKET_NR(b->c, r, i)) 590 590 return false; 591 591
+1 -1
drivers/md/bcache/journal.c
··· 512 512 continue; 513 513 514 514 ja->cur_idx = next; 515 - k->ptr[n++] = PTR(0, 515 + k->ptr[n++] = MAKE_PTR(0, 516 516 bucket_to_sector(c, ca->sb.d[ja->cur_idx]), 517 517 ca->sb.nr_this_dev); 518 518 }
+1 -1
include/uapi/linux/bcache.h
··· 91 91 92 92 #define PTR_CHECK_DEV ((1 << PTR_DEV_BITS) - 1) 93 93 94 - #define PTR(gen, offset, dev) \ 94 + #define MAKE_PTR(gen, offset, dev) \ 95 95 ((((__u64) dev) << 51) | ((__u64) offset) << 8 | gen) 96 96 97 97 /* Bkey utility code */