Re: [PATCH 6/7] T10: Move opencoded contants to common header

From: Christoph Hellwig
Date: Tue Apr 04 2017 - 03:09:15 EST


> - if ((src->ref_tag == 0xffffffff) ||
> - (src->app_tag == 0xffff)) {
> + if ((src->ref_tag == T10_REF_ESCAPE) ||
> + (src->app_tag == T10_APP_ESCAPE)) {

Please remove the inner braces while you're at it (also later in the
patch).

> index 9fba9dd..c96845c 100644
> --- a/include/linux/t10-pi.h
> +++ b/include/linux/t10-pi.h
> @@ -24,6 +24,9 @@ enum t10_dif_type {
> T10_PI_TYPE3_PROTECTION = 0x3,
> };
>
> +static const __be16 T10_APP_ESCAPE = (__force __be16) 0xffff;
> +static const __be32 T10_REF_ESCAPE = (__force __be32) 0xffffffff;

I'd do this as:

#define T10_APP_ESCAPE cpu_to_be16(0xffff);
#define T10_REF_ESCAPE cpu_to_be32(0xffffffff);

This avoids relying on the compiler to merge constants, and also gets
the endianess annotation right instead of force escaping it.