Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1753306AbcCDGxx (ORCPT ); Fri, 4 Mar 2016 01:53:53 -0500 Received: from mail-yw0-f174.google.com ([209.85.161.174]:34632 "EHLO mail-yw0-f174.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751136AbcCDGxu (ORCPT ); Fri, 4 Mar 2016 01:53:50 -0500 MIME-Version: 1.0 In-Reply-To: References: <3bff3e286d3ee01ebb7e26d7233075054c42a7a9.1456981314.git.baolin.wang@linaro.org> <87povbpe3l.fsf@belgarion.home> Date: Fri, 4 Mar 2016 14:53:49 +0800 Message-ID: Subject: Re: [PATCH 1/4] scatterlist: Introduce some helper functions From: Baolin Wang To: Robert Jarzmik Cc: Herbert Xu , David Miller , Alasdair G Kergon , Mike Snitzer , axboe@fb.com, dm-devel@redhat.com, akpm@linux-foundation.org, david.s.gordon@intel.com, Tom Lendacky , Masahiro Yamada , smueller@chronox.de, tadeusz.struk@intel.com, Masanari Iida , shli@kernel.org, Mark Brown , Linus Walleij , Arnd Bergmann , LKML , linux-crypto@vger.kernel.org, linux-raid@vger.kernel.org Content-Type: text/plain; charset=UTF-8 Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Length: 903 Lines: 31 >>> + **/ >>> +static inline bool sg_is_contiguous(struct scatterlist *sga, >>> + struct scatterlist *sgb) >>> +{ >>> + return ((sga->page_link & ~0x3UL) + sga->offset + sga->length == >>> + (sgb->page_link & ~0x3UL)); >>> +} >> I don't understand that one. >> sga->page_link is a pointer to a "struct page *". How can it be added to an >> offset within a page ??? > > > Ah, sorry that's a mistake. It should check as below: > static inline bool sg_is_contiguous(struct scatterlist *sga, struct > scatterlist *sgb) > { > return (unsigned int)sg_virt(sga) + sga->length == (unsigned > int)sg_virt(sgb); > } sorry, it should be: static inline bool sg_is_contiguous(struct scatterlist *sga, struct scatterlist *sgb) { return (unsigned long)sg_virt(sga) + sga->length == (unsigned long)sg_virt(sgb); } -- Baolin.wang Best Regards