Received: by 2002:a25:b794:0:0:0:0:0 with SMTP id n20csp6874992ybh; Thu, 8 Aug 2019 07:03:11 -0700 (PDT) X-Google-Smtp-Source: APXvYqw5UjWsz9Vn4jLpyQy+jKla+Tmu5BP7HHpZNx6a1H1M6JnAkmxAkaWw5ogzZAVzoz14B4+P X-Received: by 2002:a17:90a:109:: with SMTP id b9mr4068634pjb.112.1565272991155; Thu, 08 Aug 2019 07:03:11 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1565272991; cv=none; d=google.com; s=arc-20160816; b=w/f1nEWDWz088VqNJgC0HT3PSP04GiUgVjc+0l1y3A0vSry+D2SfON4EaBM/Yhpvdf N2LmvxDh4GWAr5aaY23ZU1k+wpJ7FdPJubPfbskAz9l8CwieZjuKx6fJQ1hFZThZAcPk bzxaDokycAR429iAMIviIrBxDyAbT7EFve0CmKazMwn5UPK/NokJw7tx9H5GOZWd1yAT 8j66MH+mdGYVvdA1w1r07bi19qMOy+/UvEChcLVNrFXKOrCDRnCsf7TWvpOSANQd1F5T gQUhFhVLn5SgZKtA7vFDYs+Dw9kaEsUIP/+n9RYfixLYAOirAzBJzqZXEJ9SPd4ATh1s Q+yQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:content-transfer-encoding:in-reply-to :mime-version:user-agent:date:message-id:from:cc:references:to :subject; bh=pVY+buhGTtag/uo44rI7F2Eg6xQ52P1yaioq/LCpP9M=; b=FUiXxQZBVKYK/S4/uq7fd0B+7B9vP68H7m5J8f1ooSPMU8EScRJOPbrlcmqB+BDEyD sVzGljSx1QNuFWOKibfyLEUJSICBbHEaPIG6bdpIwLgBemLqdi23lnGeKuqbivu4nvRQ jPaMyD5xndk1oWFvxCs4ofEi25RKLBL9kSQHEYWi+d4ucd4VGYnK3SgmW8EptWzFlAOP DV2VZ+47HEvlJJUwNipjURPQaMqAMaMSZSTe7/TT1TJf0VBUybx6qaPLTlz/cDyXRyT6 Pna+lkTXb19mzUzmNSAhWmyg23HsaS7muj8LxPzWWWWrq9PUBURRtkc/h/CXrxLCmlB6 eROQ== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id x2si51831892pfi.163.2019.08.08.07.02.48; Thu, 08 Aug 2019 07:03:11 -0700 (PDT) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1733258AbfHHOCC (ORCPT + 99 others); Thu, 8 Aug 2019 10:02:02 -0400 Received: from szxga06-in.huawei.com ([45.249.212.32]:46872 "EHLO huawei.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S1726156AbfHHOCC (ORCPT ); Thu, 8 Aug 2019 10:02:02 -0400 Received: from DGGEMS401-HUB.china.huawei.com (unknown [172.30.72.58]) by Forcepoint Email with ESMTP id 42C517B0EE9AE632655A; Thu, 8 Aug 2019 22:01:59 +0800 (CST) Received: from [127.0.0.1] (10.63.139.185) by DGGEMS401-HUB.china.huawei.com (10.3.19.201) with Microsoft SMTP Server id 14.3.439.0; Thu, 8 Aug 2019 22:01:52 +0800 Subject: Re: [PATCH resend v2] lib: scatterlist: Fix to support no mapped sg To: Jens Axboe , "robert.jarzmik@free.fr" , "axboe@kernel.dk" References: <1563940463-95597-1-git-send-email-wangzhou1@hisilicon.com> <5D3E4F91.4020605@hisilicon.com> CC: "linux-kernel@vger.kernel.org" , "linuxarm@huawei.com" From: Zhou Wang Message-ID: <5D4C2B4F.2040401@hisilicon.com> Date: Thu, 8 Aug 2019 22:01:51 +0800 User-Agent: Mozilla/5.0 (Windows NT 6.1; WOW64; rv:38.0) Gecko/20100101 Thunderbird/38.5.1 MIME-Version: 1.0 In-Reply-To: Content-Type: text/plain; charset="windows-1252" Content-Transfer-Encoding: 7bit X-Originating-IP: [10.63.139.185] X-CFilter-Loop: Reflected Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On 2019/8/8 21:40, Jens Axboe wrote: > On 7/28/19 6:44 PM, Zhou Wang wrote: >> On 2019/7/24 11:54, Zhou Wang wrote: >>> In function sg_split, the second sg_calculate_split will return -EINVAL >>> when in_mapped_nents is 0. >>> >>> Indeed there is no need to do second sg_calculate_split and sg_split_mapped >>> when in_mapped_nents is 0, as in_mapped_nents indicates no mapped entry in >>> original sgl. >>> >>> Signed-off-by: Zhou Wang >>> Acked-by: Robert Jarzmik >>> --- >>> v2: Just add Acked-by from Robert. >>> >>> lib/sg_split.c | 12 +++++++----- >>> 1 file changed, 7 insertions(+), 5 deletions(-) >>> >>> diff --git a/lib/sg_split.c b/lib/sg_split.c >>> index 9982c63..60a0bab 100644 >>> --- a/lib/sg_split.c >>> +++ b/lib/sg_split.c >>> @@ -176,11 +176,13 @@ int sg_split(struct scatterlist *in, const int in_mapped_nents, >>> * The order of these 3 calls is important and should be kept. >>> */ >>> sg_split_phys(splitters, nb_splits); >>> - ret = sg_calculate_split(in, in_mapped_nents, nb_splits, skip, >>> - split_sizes, splitters, true); >>> - if (ret < 0) >>> - goto err; >>> - sg_split_mapped(splitters, nb_splits); >>> + if (in_mapped_nents) { >>> + ret = sg_calculate_split(in, in_mapped_nents, nb_splits, skip, >>> + split_sizes, splitters, true); >>> + if (ret < 0) >>> + goto err; >>> + sg_split_mapped(splitters, nb_splits); >>> + } >>> >>> for (i = 0; i < nb_splits; i++) { >>> out[i] = splitters[i].out_sg; >>> >> >> Hi Jens, >> >> I saw you are the committer of sg_splite.c, could you help to take this patch? > > Yes, I can take it for 5.4, it looks fine to me. Thanks a lot for taking this patch :) >