Received: by 2002:a5d:9c59:0:0:0:0:0 with SMTP id 25csp184666iof; Mon, 6 Jun 2022 00:56:34 -0700 (PDT) X-Google-Smtp-Source: ABdhPJy4jrcUZQTrfZBE0MkYIGivP4e1lVpQ16HseR9+eUjf6nxleKdgbteTjdNtZFMShl0OT6Ft X-Received: by 2002:a17:90b:384a:b0:1e6:9e79:4072 with SMTP id nl10-20020a17090b384a00b001e69e794072mr20681641pjb.10.1654502194130; Mon, 06 Jun 2022 00:56:34 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1654502194; cv=none; d=google.com; s=arc-20160816; b=VjMkD8gI7Pn3FBDrBd91xCfzU/yJ7/G+5Bub1NtC6XPjfaeKNQsoupikJRNtK5IQCJ Mq/MOa62p81RjvZ1E3ROryraSYmJS85EONNwRgs7pJ7M8FC/1ND0rfUwIhSCsrP3f7rv nDtHPc2aWde2UcB6V3u/hu9gNyNci8eepMip33lgXtjuWYIR01AK09Rwml9/kQ4k8+ZU J3eFM1UMUdoKAB1xFVCc1R2EpJT3OUlMgkm35RLnBu+0ARIe9tU4a3kRGv21+cbh1hXP YKqs+KJJL67Bl43KVzAER8cNgLDoR4pCHAI86omC57ckmn0ND9mysAPIuKiAqTNvxqlZ aFeQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:in-reply-to:content-disposition:mime-version :references:message-id:subject:cc:to:from:date:dkim-signature :dkim-signature; bh=Nyo7mFRwTaKeHK83OFLmqqb5+OhN6a5HfrVNoOD8vPU=; b=Zc4oIqyGGpIbGYufLmO7MXzMRI795n37HpE8MxmCIibRxo7/QVhIT5HOec+J+4gR4k KzIz6ROSTMYeJf9OZxitqqPWzKmaBb7AnhnJHLX2yXni39VQ91abwfWCCWDuZHrb7e2A ZP8TD4S0YgL6ubcGQUNXj0S0Cxaqt0emST213KZQd99h0U348MRJDr+kf8dqp4jzb+gC mb2iDLY7jF4Ia8Fj6NmXG2G5lxjELLpBj1e5LQjPBakL62D3mKyJiiBrsvstHdFUhVzn 58IUNFkHWI6ieRgz3BVb5bItoFpf/3KnUT/NsJ3WcPLvH5I9cWgFeHD2EyhJ4UQPnSiu Uvlg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@suse.cz header.s=susede2_rsa header.b=0tkSIz0Q; dkim=neutral (no key) header.i=@suse.cz header.s=susede2_ed25519 header.b=jKZsMXv5; spf=pass (google.com: domain of linux-ext4-owner@vger.kernel.org designates 2620:137:e000::1:18 as permitted sender) smtp.mailfrom=linux-ext4-owner@vger.kernel.org Return-Path: Received: from lindbergh.monkeyblade.net (lindbergh.monkeyblade.net. [2620:137:e000::1:18]) by mx.google.com with ESMTPS id d13-20020a056a00198d00b0051054f9373esi21544316pfl.165.2022.06.06.00.56.33 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 06 Jun 2022 00:56:34 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-ext4-owner@vger.kernel.org designates 2620:137:e000::1:18 as permitted sender) client-ip=2620:137:e000::1:18; Authentication-Results: mx.google.com; dkim=pass header.i=@suse.cz header.s=susede2_rsa header.b=0tkSIz0Q; dkim=neutral (no key) header.i=@suse.cz header.s=susede2_ed25519 header.b=jKZsMXv5; spf=pass (google.com: domain of linux-ext4-owner@vger.kernel.org designates 2620:137:e000::1:18 as permitted sender) smtp.mailfrom=linux-ext4-owner@vger.kernel.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by lindbergh.monkeyblade.net (Postfix) with ESMTP id 3ED121E3E6; Mon, 6 Jun 2022 00:37:45 -0700 (PDT) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S231302AbiFFHhn (ORCPT + 99 others); Mon, 6 Jun 2022 03:37:43 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:48882 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S231341AbiFFHhm (ORCPT ); Mon, 6 Jun 2022 03:37:42 -0400 Received: from smtp-out2.suse.de (smtp-out2.suse.de [195.135.220.29]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 7584924F1B; Mon, 6 Jun 2022 00:37:40 -0700 (PDT) Received: from relay2.suse.de (relay2.suse.de [149.44.160.134]) by smtp-out2.suse.de (Postfix) with ESMTP id 1C1831F390; Mon, 6 Jun 2022 07:37:39 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=suse.cz; s=susede2_rsa; t=1654501059; h=from:from:reply-to:date:date:message-id:message-id:to:to:cc:cc: mime-version:mime-version:content-type:content-type: in-reply-to:in-reply-to:references:references; bh=Nyo7mFRwTaKeHK83OFLmqqb5+OhN6a5HfrVNoOD8vPU=; b=0tkSIz0QzZosMinaVpAHB3cIiMl5/bzKZOHXNwCLyQrkOvkBjLmIqijqxT+XIuuYF5OEhG GqhbgtZ0mQoQWRdvkUQ/m8uBQrHAuHhIoBaI6WCFmp7JMbcKFeJ2K5n8wFEepm2YRsUU3A 7/6d9avqElVwR5864Al8rRJ2H6gwMeI= DKIM-Signature: v=1; a=ed25519-sha256; c=relaxed/relaxed; d=suse.cz; s=susede2_ed25519; t=1654501059; h=from:from:reply-to:date:date:message-id:message-id:to:to:cc:cc: mime-version:mime-version:content-type:content-type: in-reply-to:in-reply-to:references:references; bh=Nyo7mFRwTaKeHK83OFLmqqb5+OhN6a5HfrVNoOD8vPU=; b=jKZsMXv59W2p3fdsVKC+QF6V78vcNcCodArofFlXUfJ/DqBou78NivzpqYviBeIeBfYDnP pTce7kKzx4KNTmCA== Received: from quack3.suse.cz (unknown [10.163.28.18]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by relay2.suse.de (Postfix) with ESMTPS id 071AC2C141; Mon, 6 Jun 2022 07:37:38 +0000 (UTC) Received: by quack3.suse.cz (Postfix, from userid 1000) id B4CD4A0633; Mon, 6 Jun 2022 09:37:38 +0200 (CEST) Date: Mon, 6 Jun 2022 09:37:38 +0200 From: Jan Kara To: Matthew Wilcox Cc: Christoph Hellwig , jfs-discussion@lists.sourceforge.net, linux-fsdevel@vger.kernel.org, "Darrick J . Wong" , linux-ext4@vger.kernel.org, Jan Kara Subject: Re: generic_quota_read Message-ID: <20220606073738.oqcdn4hxl5jpkntr@quack3.lan> References: <20220526192910.357055-1-willy@infradead.org> <20220526192910.357055-8-willy@infradead.org> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: X-Spam-Status: No, score=-2.0 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,HEADER_FROM_DIFFERENT_DOMAINS, MAILING_LIST_MULTI,RDNS_NONE,SPF_HELO_NONE,T_SCC_BODY_TEXT_LINE autolearn=no 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-ext4@vger.kernel.org On Fri 03-06-22 15:40:13, Matthew Wilcox wrote: > On Thu, May 26, 2022 at 10:43:51PM -0700, Christoph Hellwig wrote: > > > static ssize_t jfs_quota_read(struct super_block *sb, int type, char *data, > > > + size_t len, loff_t pos) > > > > And this whole helper is generic now. It might be worth to move it > > into fs/quota/dquot.c as generic_quota_read. > > I've been working on that this week. Unfortunately, you have to convert > both quota_read and quota_write at the same time, it turns out. At > least ext4_quota_write() uses the bdev's inode's page cache to back > the buffer_heads, so quota_read() and quota_write() are incoherent > with each other: > > 00017 gqr: mapping:00000000ee19acfb index:0x1 pos:0x1470 len:0x30 > 00017 4qw: mapping:000000007f9a811e index:0x18405 pos:0x1440 len:0x30 Yes, reads and writes have to use the same cache. Otherwise bad things happen... > I don't know if there's a way around this. Can't really use > read_mapping_folio() on the bdev's inode in generic_quota_read() -- the > blocks for a given page might be fragmented on disk. I don't know > if there's a way to tell ext4_bread() to use the inode's page cache > instead of the bdev's. There's no way for ext4_bread() to read from inode's page cache. And that is deliberate - ext4_bread() is used for filesystem metadata (and quota is treated as filesystem metadata) and we use bdev page cache for all the metadata. > And if we did that, would it even work as being part of a transaction? In principle it could work because we would then treat quota as journalled data and jbd2 supports that. But honestly, special-casing quota as journalled data IMHO brings more hassle on the write side than it can save by sharing some code on the read side. Honza -- Jan Kara SUSE Labs, CR