Received: by 2002:a05:6a10:16a7:0:0:0:0 with SMTP id gp39csp1122292pxb; Fri, 20 Nov 2020 01:29:32 -0800 (PST) X-Google-Smtp-Source: ABdhPJyTULyxP5nxdNAPHYifztLtC1wsitzbveWo9MZSalHE5u6ZKceBwsC8913ZIbWyxhrB2nc8 X-Received: by 2002:a17:906:b783:: with SMTP id dt3mr31506350ejb.534.1605864572608; Fri, 20 Nov 2020 01:29:32 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1605864572; cv=none; d=google.com; s=arc-20160816; b=kiGMCtUOROba7rlxdhD9faMNqSOiiicL4fzLMrgUP1PC2jla6UjofYwEruagxJ9hkY 50hkRupPAIkVYv2lsGCZmj/cJLUtO12eXTHk0OcjKjpsp7Vz7+1NGDQpMlysJWXzUpFp M309mdzHuTUPy0Pt2WR8puc+0kdoXDjW5ij9ZCa66Yr/d2z1g0RRZaewN4htrz55iuAO ECmiqpZv/LsQ50m8D6jzBz3b91nep4Ob+tnxKcCJg619PA3rPLIFpMTxXDTFARHZbgIE GWnYQl8eXPbz1znXRzVVAHXDeaQz2qM5K83sGOW7ggQ6nMBoKDuEXvDx3UQiyfOq6fMk APHQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:content-language :in-reply-to:mime-version:user-agent:date:message-id:from:references :to:subject; bh=JRzHWSoQLXxb/Fh+uyLrcIse4qQYwzMQCB03cWbeAHE=; b=F6jkPMzcoeYAyP6CW+w8klOWKLFhkZxGscMN9RdQH88EV1C3qcDalsiveh2f6VCEZI myS5jjN7ExrmsWtvoj/Q9Sgq6+fkLg1TX5MrVSkuKCp5TP78k+Wer4QM0JyJi/E/2jPt f6Tq6kAhniVLWKBzRqCjN5YufBTdQsKqmd1a5u0uRiT0pfrRaQd7my3YtlfNPYH3cH30 fq9IjKQHuPnUahxJ0RyrLAm8giTqD21BXyqOLL+tBfegEHuxgyA/6C44CjtNzKvk+hGF 0xuZbLj25xMDwsIjJ1Vc7ZZ4K3Vt9hI73SW25bzMksXIl3j2I63A/stCgtUBRkkYRGl0 pmHg== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id ga10si1361444ejc.686.2020.11.20.01.29.09; Fri, 20 Nov 2020 01:29:32 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1727441AbgKTJ1c (ORCPT + 99 others); Fri, 20 Nov 2020 04:27:32 -0500 Received: from szxga05-in.huawei.com ([45.249.212.191]:8568 "EHLO szxga05-in.huawei.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1727355AbgKTJ1b (ORCPT ); Fri, 20 Nov 2020 04:27:31 -0500 Received: from DGGEMS409-HUB.china.huawei.com (unknown [172.30.72.60]) by szxga05-in.huawei.com (SkyGuard) with ESMTP id 4CcrmB6BLXzLrMn; Fri, 20 Nov 2020 17:27:06 +0800 (CST) Received: from [127.0.0.1] (10.174.176.144) by DGGEMS409-HUB.china.huawei.com (10.3.19.209) with Microsoft SMTP Server id 14.3.487.0; Fri, 20 Nov 2020 17:27:26 +0800 Subject: Re: [PATCH 1/1] device-dax: delete a redundancy check in dev_dax_validate_align() To: Dan Williams , Vishal Verma , Dave Jiang , linux-nvdimm , linux-kernel References: <20201120092057.2144-1-thunder.leizhen@huawei.com> From: "Leizhen (ThunderTown)" Message-ID: <7ccddd02-e2e6-ec48-43b8-10700285e61c@huawei.com> Date: Fri, 20 Nov 2020 17:27:25 +0800 User-Agent: Mozilla/5.0 (Windows NT 10.0; WOW64; rv:60.0) Gecko/20100101 Thunderbird/60.7.0 MIME-Version: 1.0 In-Reply-To: <20201120092057.2144-1-thunder.leizhen@huawei.com> Content-Type: text/plain; charset="utf-8" Content-Language: en-US Content-Transfer-Encoding: 7bit X-Originating-IP: [10.174.176.144] X-CFilter-Loop: Reflected Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On 2020/11/20 17:20, Zhen Lei wrote: > After we have done the alignment check for the length of each range, the > alignment check for dev_dax_size(dev_dax) is no longer needed, because it > get the sum of the length of each range. For example: x/M + y/M = (x + y)/M If x/M is a integer and y/M is also a integer, then (x + y)/M must be a integer. > > Signed-off-by: Zhen Lei > --- > drivers/dax/bus.c | 7 ------- > 1 file changed, 7 deletions(-) > > diff --git a/drivers/dax/bus.c b/drivers/dax/bus.c > index 1efae11d947a..35f9238c0139 100644 > --- a/drivers/dax/bus.c > +++ b/drivers/dax/bus.c > @@ -1109,16 +1109,9 @@ static ssize_t align_show(struct device *dev, > > static ssize_t dev_dax_validate_align(struct dev_dax *dev_dax) > { > - resource_size_t dev_size = dev_dax_size(dev_dax); > struct device *dev = &dev_dax->dev; > int i; > > - if (dev_size > 0 && !alloc_is_aligned(dev_dax, dev_size)) { > - dev_dbg(dev, "%s: align %u invalid for size %pa\n", > - __func__, dev_dax->align, &dev_size); > - return -EINVAL; > - } > - > for (i = 0; i < dev_dax->nr_range; i++) { > size_t len = range_len(&dev_dax->ranges[i].range); > >