Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 6F98DC636D3 for ; Mon, 6 Feb 2023 06:46:20 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S229489AbjBFGqS (ORCPT ); Mon, 6 Feb 2023 01:46:18 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:44272 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229511AbjBFGqP (ORCPT ); Mon, 6 Feb 2023 01:46:15 -0500 Received: from mail3.bemta32.messagelabs.com (mail3.bemta32.messagelabs.com [195.245.230.18]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 89B5E12F3E; Sun, 5 Feb 2023 22:46:14 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=fujitsu.com; s=170520fj; t=1675665972; i=@fujitsu.com; bh=8tDYHNWMpUBfn2W8rtNUEQrr/Lx/KtmFpqOm7bf5zQI=; h=Message-ID:Date:MIME-Version:Subject:To:CC:References:From: In-Reply-To:Content-Type:Content-Transfer-Encoding; b=x/XU+I3vkY/snNMoCAM/Q/te6FSxTJEf60Xnb/zrFJUUov70ue0p8e8wke8j4UX/s I6AT7V8sLv+JvrsjvpmMjJ895YeTQH1WjKo13SltqC/C4oY2+HqJsDVjZiZiuNUVEi 5Tmrk/9cWpNqCZ5Zc8XfeuMeaizZwi4kh54eoQEkU759+tqQ04D+yaItl+JMdgHfSG WqoyWHzlLgCmdn0OIhhRVYZ4NJLTL9pnwWdm9KLG9NHjiJUKA8pEMYBfdDAaD/Z/Ao 4iTpnSnDMaMZUCsPfJ+DBXYcrFL/2efiwCAJpqfhIxVItcNut4/dirdG69CiOdVd1v Lji+JGr0wwiUQ== X-Brightmail-Tracker: H4sIAAAA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3KmDz9lbC9/O+bWH8QtzrqmmfdsfeebHUWUn+TjDtji9PuPocUEtUY mlOCPRUIu5qDgRAPjkbkDDAwAA X-Env-Sender: ruansy.fnst@fujitsu.com X-Msg-Ref: server-23.tower-585.messagelabs.com!1675665964!299649!1 X-Originating-IP: [62.60.8.97] X-SYMC-ESS-Client-Auth: outbound-route-from=pass X-StarScan-Received: X-StarScan-Version: 9.102.2; banners=-,-,- X-VirusChecked: Checked Received: (qmail 2381 invoked from network); 6 Feb 2023 06:46:04 -0000 Received: from unknown (HELO n03ukasimr01.n03.fujitsu.local) (62.60.8.97) by server-23.tower-585.messagelabs.com with ECDHE-RSA-AES256-GCM-SHA384 encrypted SMTP; 6 Feb 2023 06:46:04 -0000 Received: from n03ukasimr01.n03.fujitsu.local (localhost [127.0.0.1]) by n03ukasimr01.n03.fujitsu.local (Postfix) with ESMTP id 77186100188; Mon, 6 Feb 2023 06:46:04 +0000 (GMT) Received: from R01UKEXCASM223.r01.fujitsu.local (R01UKEXCASM223 [10.182.185.121]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-SHA384 (256/256 bits)) (No client certificate requested) by n03ukasimr01.n03.fujitsu.local (Postfix) with ESMTPS id 6A116100182; Mon, 6 Feb 2023 06:46:04 +0000 (GMT) Received: from [192.168.50.5] (10.167.225.141) by R01UKEXCASM223.r01.fujitsu.local (10.182.185.121) with Microsoft SMTP Server (TLS) id 15.0.1497.42; Mon, 6 Feb 2023 06:46:00 +0000 Message-ID: <0b8551a2-1d46-8ac8-5073-5b094507975a@fujitsu.com> Date: Mon, 6 Feb 2023 14:45:53 +0800 MIME-Version: 1.0 User-Agent: Mozilla/5.0 (Windows NT 10.0; Win64; x64; rv:102.0) Gecko/20100101 Thunderbird/102.7.1 Subject: Re: [PATCH v9 1/3] xfs: fix the calculation of length and end To: Matthew Wilcox CC: , , , , , , , , , References: <1675522718-88-1-git-send-email-ruansy.fnst@fujitsu.com> <1675522718-88-2-git-send-email-ruansy.fnst@fujitsu.com> From: Shiyang Ruan In-Reply-To: Content-Type: text/plain; charset="UTF-8"; format=flowed Content-Transfer-Encoding: 8bit X-Originating-IP: [10.167.225.141] X-ClientProxiedBy: G08CNEXCHPEKD07.g08.fujitsu.local (10.167.33.80) To R01UKEXCASM223.r01.fujitsu.local (10.182.185.121) X-Virus-Scanned: ClamAV using ClamSMTP Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org 在 2023/2/5 19:42, Matthew Wilcox 写道: > On Sat, Feb 04, 2023 at 02:58:36PM +0000, Shiyang Ruan wrote: >> @@ -222,8 +222,8 @@ xfs_dax_notify_failure( >> len -= ddev_start - offset; >> offset = 0; >> } >> - if (offset + len > ddev_end) >> - len -= ddev_end - offset; >> + if (offset + len - 1 > ddev_end) >> + len -= offset + len - 1 - ddev_end; > > This _looks_ wrong. Are you sure it shouldn't be: > > len = ddev_end - offset + 1; > It is to make sure the range won't beyond the end of device. But actually, both of us are rgiht. Mine: len -= offset + len - 1 - ddev_end; => len = len - (offset + len - 1 - ddev_end); => len = len - offset - len + 1 + ddev_end; => len = ddev_end - offset + 1; --> Yours I forgot to simplify it. Will fix. -- Thanks, Ruan.