All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH] bcache: Fix building error on MIPS
@ 2017-11-16  3:06 Huacai Chen
  2017-11-16  4:25 ` Coly Li
  2017-11-16 16:58   ` Kai Krakow
  0 siblings, 2 replies; 6+ messages in thread
From: Huacai Chen @ 2017-11-16  3:06 UTC (permalink / raw)
  To: Michael Lyle; +Cc: Kent Overstreet, linux-bcache, Huacai Chen, stable

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.

Cc: stable@vger.kernel.org
Signed-off-by: Huacai Chen <chenhc@lemote.com>
---
 drivers/md/bcache/alloc.c   | 2 +-
 drivers/md/bcache/extents.c | 2 +-
 drivers/md/bcache/journal.c | 2 +-
 include/uapi/linux/bcache.h | 2 +-
 4 files changed, 4 insertions(+), 4 deletions(-)

diff --git a/drivers/md/bcache/alloc.c b/drivers/md/bcache/alloc.c
index a27d852..a0cc1bc 100644
--- a/drivers/md/bcache/alloc.c
+++ b/drivers/md/bcache/alloc.c
@@ -490,7 +490,7 @@ int __bch_bucket_alloc_set(struct cache_set *c, unsigned reserve,
 		if (b == -1)
 			goto err;
 
-		k->ptr[i] = PTR(ca->buckets[b].gen,
+		k->ptr[i] = MAKE_PTR(ca->buckets[b].gen,
 				bucket_to_sector(c, b),
 				ca->sb.nr_this_dev);
 
diff --git a/drivers/md/bcache/extents.c b/drivers/md/bcache/extents.c
index 41c238f..f9d3917 100644
--- a/drivers/md/bcache/extents.c
+++ b/drivers/md/bcache/extents.c
@@ -585,7 +585,7 @@ static bool bch_extent_merge(struct btree_keys *bk, struct bkey *l, struct bkey
 		return false;
 
 	for (i = 0; i < KEY_PTRS(l); i++)
-		if (l->ptr[i] + PTR(0, KEY_SIZE(l), 0) != r->ptr[i] ||
+		if (l->ptr[i] + MAKE_PTR(0, KEY_SIZE(l), 0) != r->ptr[i] ||
 		    PTR_BUCKET_NR(b->c, l, i) != PTR_BUCKET_NR(b->c, r, i))
 			return false;
 
diff --git a/drivers/md/bcache/journal.c b/drivers/md/bcache/journal.c
index 02a98dd..03cc072 100644
--- a/drivers/md/bcache/journal.c
+++ b/drivers/md/bcache/journal.c
@@ -507,7 +507,7 @@ static void journal_reclaim(struct cache_set *c)
 			continue;
 
 		ja->cur_idx = next;
-		k->ptr[n++] = PTR(0,
+		k->ptr[n++] = MAKE_PTR(0,
 				  bucket_to_sector(c, ca->sb.d[ja->cur_idx]),
 				  ca->sb.nr_this_dev);
 	}
diff --git a/include/uapi/linux/bcache.h b/include/uapi/linux/bcache.h
index 90fc490..5cc599c 100644
--- a/include/uapi/linux/bcache.h
+++ b/include/uapi/linux/bcache.h
@@ -91,7 +91,7 @@ PTR_FIELD(PTR_GEN,			0,  8)
 
 #define PTR_CHECK_DEV			((1 << PTR_DEV_BITS) - 1)
 
-#define PTR(gen, offset, dev)						\
+#define MAKE_PTR(gen, offset, dev)						\
 	((((__u64) dev) << 51) | ((__u64) offset) << 8 | gen)
 
 /* Bkey utility code */
-- 
2.7.0

^ permalink raw reply related	[flat|nested] 6+ messages in thread

* Re: [PATCH] bcache: Fix building error on MIPS
  2017-11-16  3:06 [PATCH] bcache: Fix building error on MIPS Huacai Chen
@ 2017-11-16  4:25 ` Coly Li
  2017-11-16  4:29   ` 陈华才
  2017-11-16 16:58   ` Kai Krakow
  1 sibling, 1 reply; 6+ messages in thread
From: Coly Li @ 2017-11-16  4:25 UTC (permalink / raw)
  To: Huacai Chen; +Cc: Michael Lyle, Kent Overstreet, linux-bcache, stable

On 2017/11/16 上午11:06, Huacai Chen wrote:
> 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.
> 

Hi Huacai,

Did you try to add a #undef PTR in user/include/linux/bcache.h ?

Thanks.

Coly


> Cc: stable@vger.kernel.org
> Signed-off-by: Huacai Chen <chenhc@lemote.com>
> ---
>  drivers/md/bcache/alloc.c   | 2 +-
>  drivers/md/bcache/extents.c | 2 +-
>  drivers/md/bcache/journal.c | 2 +-
>  include/uapi/linux/bcache.h | 2 +-
>  4 files changed, 4 insertions(+), 4 deletions(-)
> 
> diff --git a/drivers/md/bcache/alloc.c b/drivers/md/bcache/alloc.c
> index a27d852..a0cc1bc 100644
> --- a/drivers/md/bcache/alloc.c
> +++ b/drivers/md/bcache/alloc.c
> @@ -490,7 +490,7 @@ int __bch_bucket_alloc_set(struct cache_set *c, unsigned reserve,
>  		if (b == -1)
>  			goto err;
>  
> -		k->ptr[i] = PTR(ca->buckets[b].gen,
> +		k->ptr[i] = MAKE_PTR(ca->buckets[b].gen,
>  				bucket_to_sector(c, b),
>  				ca->sb.nr_this_dev);
[snip]

> diff --git a/include/uapi/linux/bcache.h b/include/uapi/linux/bcache.h
> index 90fc490..5cc599c 100644
> --- a/include/uapi/linux/bcache.h
> +++ b/include/uapi/linux/bcache.h
> @@ -91,7 +91,7 @@ PTR_FIELD(PTR_GEN,			0,  8)
>  
>  #define PTR_CHECK_DEV			((1 << PTR_DEV_BITS) - 1)
>  
> -#define PTR(gen, offset, dev)						\
> +#define MAKE_PTR(gen, offset, dev)						\
>  	((((__u64) dev) << 51) | ((__u64) offset) << 8 | gen)
>  
>  /* Bkey utility code */
> 

^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: [PATCH] bcache: Fix building error on MIPS
  2017-11-16  4:25 ` Coly Li
@ 2017-11-16  4:29   ` 陈华才
  2017-11-16  4:43     ` Michael Lyle
  0 siblings, 1 reply; 6+ messages in thread
From: 陈华才 @ 2017-11-16  4:29 UTC (permalink / raw)
  To: Coly Li; +Cc: Michael Lyle, Kent Overstreet, linux-bcache, stable

I think #undef is not very good, because it depends on the sequence of #include.

Huacai
 
------------------ Original ------------------
From:  "Coly Li"<colyli@suse.de>;
Date:  Thu, Nov 16, 2017 12:25 PM
To:  "Huacai Chen"<chenhc@lemote.com>; 
Cc:  "Michael Lyle"<mlyle@lyle.org>; "Kent Overstreet"<kent.overstreet@gmail.com>; "linux-bcache"<linux-bcache@vger.kernel.org>; "stable"<stable@vger.kernel.org>; 
Subject:  Re: [PATCH] bcache: Fix building error on MIPS

 
On 2017/11/16 上午11:06, Huacai Chen wrote:
> 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.
> 

Hi Huacai,

Did you try to add a #undef PTR in user/include/linux/bcache.h ?

Thanks.

Coly


> Cc: stable@vger.kernel.org
> Signed-off-by: Huacai Chen <chenhc@lemote.com>
> ---
>  drivers/md/bcache/alloc.c   | 2 +-
>  drivers/md/bcache/extents.c | 2 +-
>  drivers/md/bcache/journal.c | 2 +-
>  include/uapi/linux/bcache.h | 2 +-
>  4 files changed, 4 insertions(+), 4 deletions(-)
> 
> diff --git a/drivers/md/bcache/alloc.c b/drivers/md/bcache/alloc.c
> index a27d852..a0cc1bc 100644
> --- a/drivers/md/bcache/alloc.c
> +++ b/drivers/md/bcache/alloc.c
> @@ -490,7 +490,7 @@ int __bch_bucket_alloc_set(struct cache_set *c, unsigned reserve,
>  		if (b == -1)
>  			goto err;
>  
> -		k->ptr[i] = PTR(ca->buckets[b].gen,
> +		k->ptr[i] = MAKE_PTR(ca->buckets[b].gen,
>  				bucket_to_sector(c, b),
>  				ca->sb.nr_this_dev);
[snip]

> diff --git a/include/uapi/linux/bcache.h b/include/uapi/linux/bcache.h
> index 90fc490..5cc599c 100644
> --- a/include/uapi/linux/bcache.h
> +++ b/include/uapi/linux/bcache.h
> @@ -91,7 +91,7 @@ PTR_FIELD(PTR_GEN,			0,  8)
>  
>  #define PTR_CHECK_DEV			((1 << PTR_DEV_BITS) - 1)
>  
> -#define PTR(gen, offset, dev)						\
> +#define MAKE_PTR(gen, offset, dev)						\
>  	((((__u64) dev) << 51) | ((__u64) offset) << 8 | gen)
>  
>  /* Bkey utility code */
>

^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: [PATCH] bcache: Fix building error on MIPS
  2017-11-16  4:29   ` 陈华才
@ 2017-11-16  4:43     ` Michael Lyle
  0 siblings, 0 replies; 6+ messages in thread
From: Michael Lyle @ 2017-11-16  4:43 UTC (permalink / raw)
  To: 陈华才, Coly Li; +Cc: Kent Overstreet, linux-bcache, stable

Huacai--

Thanks for your patch.

On 11/15/2017 08:29 PM, 陈华才 wrote:
> I think #undef is not very good, because it depends on the sequence of #include.
> 
> Huacai

Yes-- I can live with this-- we don't have many uses of the PTR() macro
and it doesn't hurt clarity.

Reviewed-by: Michael Lyle <mlyle@lyle.org>

I will carry this in my tree of things to possibly submit later in 4.15.

Mike

^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: [PATCH] bcache: Fix building error on MIPS
  2017-11-16  3:06 [PATCH] bcache: Fix building error on MIPS Huacai Chen
@ 2017-11-16 16:58   ` Kai Krakow
  2017-11-16 16:58   ` Kai Krakow
  1 sibling, 0 replies; 6+ messages in thread
From: Kai Krakow @ 2017-11-16 16:58 UTC (permalink / raw)
  To: linux-bcache; +Cc: stable

Am Thu, 16 Nov 2017 11:06:13 +0800
schrieb Huacai Chen <chenhc@lemote.com>:

> diff --git a/include/uapi/linux/bcache.h b/include/uapi/linux/bcache.h
> index 90fc490..5cc599c 100644
> --- a/include/uapi/linux/bcache.h
> +++ b/include/uapi/linux/bcache.h
> @@ -91,7 +91,7 @@ PTR_FIELD(PTR_GEN,			0,  8)
>  
>  #define PTR_CHECK_DEV			((1 << PTR_DEV_BITS) -
> 1) 
> -#define PTR(gen, offset,
> dev)						\ +#define
> MAKE_PTR(gen, offset,
> dev)						\ ((((__u64) dev)
> << 51) | ((__u64) offset) << 8 | gen) /* Bkey utility code */

I don't think you make it any better by calling it MAKE_PTR then. How's
the next guy stumbling across such a conflict calling his definition
then? CREATE_PTR?

Why not call it BCH_PTR or similar?

-- 
Regards,
Kai

Replies to list-only preferred.

^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: [PATCH] bcache: Fix building error on MIPS
@ 2017-11-16 16:58   ` Kai Krakow
  0 siblings, 0 replies; 6+ messages in thread
From: Kai Krakow @ 2017-11-16 16:58 UTC (permalink / raw)
  To: stable; +Cc: linux-bcache

Am Thu, 16 Nov 2017 11:06:13 +0800
schrieb Huacai Chen <chenhc@lemote.com>:

> diff --git a/include/uapi/linux/bcache.h b/include/uapi/linux/bcache.h
> index 90fc490..5cc599c 100644
> --- a/include/uapi/linux/bcache.h
> +++ b/include/uapi/linux/bcache.h
> @@ -91,7 +91,7 @@ PTR_FIELD(PTR_GEN,			0,  8)
>  
>  #define PTR_CHECK_DEV			((1 << PTR_DEV_BITS) -
> 1) 
> -#define PTR(gen, offset,
> dev)						\ +#define
> MAKE_PTR(gen, offset,
> dev)						\ ((((__u64) dev)
> << 51) | ((__u64) offset) << 8 | gen) /* Bkey utility code */

I don't think you make it any better by calling it MAKE_PTR then. How's
the next guy stumbling across such a conflict calling his definition
then? CREATE_PTR?

Why not call it BCH_PTR or similar?

-- 
Regards,
Kai

Replies to list-only preferred.

^ permalink raw reply	[flat|nested] 6+ messages in thread

end of thread, other threads:[~2017-11-16 19:45 UTC | newest]

Thread overview: 6+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2017-11-16  3:06 [PATCH] bcache: Fix building error on MIPS Huacai Chen
2017-11-16  4:25 ` Coly Li
2017-11-16  4:29   ` 陈华才
2017-11-16  4:43     ` Michael Lyle
2017-11-16 16:58 ` Kai Krakow
2017-11-16 16:58   ` Kai Krakow

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.