Re: [PATCH V2] lib/scatterlist: Add SG_CHAIN and SG_END macros for LSB encodings

From: Chris Wilson
Date: Thu Feb 15 2018 - 02:37:35 EST


Quoting Anshuman Khandual (2018-02-15 03:33:56)
> This replaces scatterlist->page_link LSB encodings with SG_CHAIN and
> SG_END definitions without any functional change.
>
> Signed-off-by: Anshuman Khandual <khandual@xxxxxxxxxxxxxxxxxx>
> ---
> Changes in V2:
> - Changed SG_EMARK as SG_END as per Johannes and Tvrtko
> - Added 'UL' to the constants as per Bart
>
> include/linux/scatterlist.h | 23 +++++++++++++----------
> 1 file changed, 13 insertions(+), 10 deletions(-)
>
> diff --git a/include/linux/scatterlist.h b/include/linux/scatterlist.h
> index 22b2131bcdcd..b6fe1815f5c4 100644
> --- a/include/linux/scatterlist.h
> +++ b/include/linux/scatterlist.h
> @@ -65,16 +65,18 @@ struct sg_table {
> */
>
> #define SG_MAGIC 0x87654321
> +#define SG_CHAIN 0x01UL
> +#define SG_END 0x02UL

The alternative would be BIT(0) and BIT(1), which by the time you write
the constant out in full, as above, become clearer.

I think you also want whitespace between the MAGIC and CHAIN,END so that
the reader doesn't think they refer to some magic encoding of SG_MAGIC.
-Chris