Received: by 2002:a05:6358:d09b:b0:dc:cd0c:909e with SMTP id jc27csp1582179rwb; Wed, 16 Nov 2022 21:31:12 -0800 (PST) X-Google-Smtp-Source: AA0mqf5YSzavP9I27HwolLL28a/kwkGq+qI5sRr7DeJaL1QqCRU+PHojhsh38wkpqRm7ScO6TY9o X-Received: by 2002:a17:906:c404:b0:7ad:821f:a3e5 with SMTP id u4-20020a170906c40400b007ad821fa3e5mr820588ejz.554.1668663072730; Wed, 16 Nov 2022 21:31:12 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1668663072; cv=none; d=google.com; s=arc-20160816; b=SU9V4KN9iAAD2wh6nmp4N+2hWFe0HRS6NPEU/ucyO6PDAbxvdcB/jrLQSQA6wZsU1c is2uoIFrKbdin1J3k6lmpd0uOoSxGU8MUMKmxopUQBYeYJm2P5aQK+PSqya6qiFtjbP9 DhGT0V76RWJ9BW72xxHM/L1LMaXbhHZDq3pNLi2cxem6T6NRfToMHoL+PMe9qUnbdAQK MSpHxSlTHvC65IXYLWlZj4/a17RFSVpu4l2beTLyRMod42BuKQuZ5RCoJb9uXv8kAGG6 BFY/8FsARQ5QxKQv9uFkI2mGUW343kLTTkCrPXcfCFTcqRQtDKd6J+7YnGMpRyQbbCO1 bFHg== 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=OCgpzvpj+zRPizOYNu06allJyGNA38nL4PnqN3TxK18=; b=jaABlaymjD6dEtXVBOcI6H5HYtF3SG944Gf21GkLQB7IeR/5yHv+wE2+jwNY8uRPmm thevRVyM2iZgCA+3M5/UTjS3J/rTudq+4Qd3JViTIzCohi+uOCllt4TA5U6juZuB7XQG ss+8RGu8e6AD3BMbgdP0pNUtkS2wSkwvlsusfF3/9zbIlMYXfHnEQEtS+YwAibehgLEd gynxhJ/VTkw4elP3mRcjlCg08b4Bs5XIg98kAp2uMmzpcYQNKZm8dODjfdj57Kj7nbH4 3Th2BNVYogiPSRSZC5mKivO/SZNWx3k2vgfjOLF5naoUOHT6DrSLhofwMXJF2ha0Km16 MS+w== 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 i17-20020a1709064fd100b0078d9b2facaesi15189744ejw.339.2022.11.16.21.30.52; Wed, 16 Nov 2022 21:31:12 -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 S234037AbiKQEYu (ORCPT + 90 others); Wed, 16 Nov 2022 23:24:50 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:48182 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S238955AbiKQEYq (ORCPT ); Wed, 16 Nov 2022 23:24:46 -0500 Received: from out30-44.freemail.mail.aliyun.com (out30-44.freemail.mail.aliyun.com [115.124.30.44]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 15FAB5C740; Wed, 16 Nov 2022 20:24:44 -0800 (PST) X-Alimail-AntiSpam: AC=PASS;BC=-1|-1;BR=01201311R181e4;CH=green;DM=||false|;DS=||;FP=0|-1|-1|-1|0|-1|-1|-1;HT=ay29a033018046060;MF=jefflexu@linux.alibaba.com;NM=1;PH=DS;RN=8;SR=0;TI=SMTPD_---0VV-VtWS_1668659080; Received: from 30.221.128.178(mailfrom:jefflexu@linux.alibaba.com fp:SMTPD_---0VV-VtWS_1668659080) by smtp.aliyun-inc.com; Thu, 17 Nov 2022 12:24:42 +0800 Message-ID: Date: Thu, 17 Nov 2022 12:24:40 +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 v3 1/2] fscache,cachefiles: add prepare_ondemand_read() callback Content-Language: en-US To: David Howells , Jeff Layton Cc: xiang@kernel.org, chao@kernel.org, linux-erofs@lists.ozlabs.org, linux-cachefs@redhat.com, linux-kernel@vger.kernel.org, linux-fsdevel@vger.kernel.org References: <2b595b62f6ecd28298a860fcdc5b4941dcafd9eb.camel@kernel.org> <20221116104502.107431-1-jefflexu@linux.alibaba.com> <20221116104502.107431-2-jefflexu@linux.alibaba.com> <2968419.1668606101@warthog.procyon.org.uk> From: Jingbo Xu In-Reply-To: <2968419.1668606101@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/16/22 9:41 PM, David Howells wrote: > Jeff Layton wrote: > >>> +static enum netfs_io_source cachefiles_do_prepare_read(struct netfs_cache_resources *cres, >>> + loff_t *_start, size_t *_len, >>> + unsigned long *_flags, loff_t i_size) >> >> _start is never changed, so it should be passed by value instead of by >> pointer. > > Hmmm. The intention was that the start pointer should be able to be moved > backwards by the cache - but that's not necessary in ->prepare_read() and > ->expand_readahead() is provided for that now. So yes, the start pointer > shouldn't get changed at this point. Okay. > >> I'd also reverse the position of the arguments for _flags and i_size. >> Otherwise, the CPU/compiler have to shuffle things around more in >> cachefiles_prepare_ondemand_read before they call this. > > Better to pass the flags in and then ignore them. That way it can tail call, > or just call cachefiles_do_prepare_read() directly from erofs. If you're > going to have a wrapper, then you might be just as well create a > netfs_io_subrequest struct on the stack. I would prefer letting cachefiles_prepare_ondemand_read() pass flags in and then tail call cachefiles_do_prepare_read() directly. Many thanks for the suggestion. -- Thanks, Jingbo