Received: by 2002:a05:6358:d09b:b0:dc:cd0c:909e with SMTP id jc27csp3010930rwb; Mon, 7 Nov 2022 22:32:09 -0800 (PST) X-Google-Smtp-Source: AMsMyM5sCkmO+VBjMaM1sgEUyUZnYg2TNviknKc6RRq4jLPWb9F90l+qamS54R6En2fUwpEZWVPe X-Received: by 2002:a17:90a:4386:b0:213:df24:ed64 with SMTP id r6-20020a17090a438600b00213df24ed64mr45646656pjg.89.1667889129494; Mon, 07 Nov 2022 22:32:09 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1667889129; cv=none; d=google.com; s=arc-20160816; b=x0D+Ha9T9Ca2R+gq8TMaXFqzXO7aw/WkFhO63ZV1l3LTVVdrKyRj4YfYq/dN/9w2v1 Y/2Z04UU73EYTJQPv9wRkmV7UOlTZGw5kRfnu1SoZt87kn57NJK5JxfCyu4qrOUFtVcT Vcfy5XVFr8ZlEGAOb7gq3flDSxozT5SqpNM9WfuXT95NtHa9tRb0EvHoV/R/JTPGdMsE gxj5vgk/nfi1tZh9YpWAOaPFSA60YQDnR/m7PFmaXECB+0n/W5W2jAMC1G85kaGZAodU XpyQp9i6FsU/l+PQ/gg7IxiyubSFS485ry2mx0aXOcuec8pO4KXPMJOxjXTp2bK4ssIo ecLg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:in-reply-to:from :references:cc:to:content-language:subject:user-agent:mime-version :date:message-id; bh=4eZsZDcVLXxAvQuqKAUqg7slmDVn6n6dAJ1G8UjCvOQ=; b=EdQUzpXmkLLMcT3I+qwrp1gnKFJP3xTah4y6FXbsOzeLdGFW0ZEXtzRMIrv8dCt54j U/6ycig23aM+KgcXuGDawb3iXrDtOm36yUz8CaUaLq7ShP0GvSSPT/sTAzJB63uf5Cox Lpg1l1oIPhAdYDLjo2vouEBbU3UTyBYaCRaAb6SHSr8tAcg3voIQbf8YB0LoHYAiAkUq BnCu/R84ltStUHO8Tr7LEnUO90EEk7Xh3VtDF+uNaZwpk4TBvUdivPv0kHPITBQlZCX0 kSuNPm/bFHOND/o9s02jMXIdoXJVm0FmmHzui6X5ib7Kuj/mZSkCVusBa0Gy4G4ZbNpC IVBQ== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=alibaba.com Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id t5-20020a056a0021c500b005618039550fsi14591655pfj.271.2022.11.07.22.31.57; Mon, 07 Nov 2022 22:32:09 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=alibaba.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S233226AbiKHFyy (ORCPT + 90 others); Tue, 8 Nov 2022 00:54:54 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:54710 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S232911AbiKHFyx (ORCPT ); Tue, 8 Nov 2022 00:54:53 -0500 Received: from out30-131.freemail.mail.aliyun.com (out30-131.freemail.mail.aliyun.com [115.124.30.131]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id E60056395; Mon, 7 Nov 2022 21:54:51 -0800 (PST) X-Alimail-AntiSpam: AC=PASS;BC=-1|-1;BR=01201311R121e4;CH=green;DM=||false|;DS=||;FP=0|-1|-1|-1|0|-1|-1|-1;HT=ay29a033018045168;MF=jefflexu@linux.alibaba.com;NM=1;PH=DS;RN=6;SR=0;TI=SMTPD_---0VUHuOoP_1667886888; Received: from 30.221.131.213(mailfrom:jefflexu@linux.alibaba.com fp:SMTPD_---0VUHuOoP_1667886888) by smtp.aliyun-inc.com; Tue, 08 Nov 2022 13:54:49 +0800 Message-ID: <084d78a4-6052-f2ec-72f2-af9c4979f5dc@linux.alibaba.com> Date: Tue, 8 Nov 2022 13:54:47 +0800 MIME-Version: 1.0 User-Agent: Mozilla/5.0 (Macintosh; Intel Mac OS X 10.15; rv:102.0) Gecko/20100101 Thunderbird/102.4.0 Subject: Re: [PATCH v2 2/2] netfs: Fix dodgy maths Content-Language: en-US To: David Howells , willy@infradead.org Cc: Jeff Layton , linux-cachefs@redhat.com, linux-fsdevel@vger.kernel.org, linux-kernel@vger.kernel.org References: <166757987929.950645.12595273010425381286.stgit@warthog.procyon.org.uk> <166757988611.950645.7626959069846893164.stgit@warthog.procyon.org.uk> From: JeffleXu In-Reply-To: <166757988611.950645.7626959069846893164.stgit@warthog.procyon.org.uk> Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 7bit X-Spam-Status: No, score=-9.9 required=5.0 tests=BAYES_00, ENV_AND_HDR_SPF_MATCH,NICE_REPLY_A,RCVD_IN_DNSWL_NONE,SPF_HELO_NONE, SPF_PASS,UNPARSEABLE_RELAY,USER_IN_DEF_SPF_WL autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On 11/5/22 12:38 AM, David Howells wrote: > Fix the dodgy maths in netfs_rreq_unlock_folios(). start_page could be > inside the folio, in which case the calculation of pgpos will be come up > with a negative number (though for the moment rreq->start is rounded down > earlier and folios would have to get merged whilst locked) Hi, the patch itself seems fine. Just some questions about the scenario. 1. "start_page could be inside the folio" Is that because .expand_readahead() called from netfs_readahead()? Since otherwise, req-start is always aligned to the folio boundary. 2. If start_page is indeed inside the folio, then only the trailing part of the first folio can be covered by the request, and this folio will be marked with uptodate, though the beginning part of the folio may have not been read from the cache. Is that expected? Or correct me if I'm wrong. -- Thanks, Jingbo