Received: by 2002:a05:6a10:1287:0:0:0:0 with SMTP id d7csp4038344pxv; Mon, 26 Jul 2021 19:26:42 -0700 (PDT) X-Google-Smtp-Source: ABdhPJxmKmHbtg0EXJzKl+pRqDxi5Ho+qlV5JjGTa1PJE/N+3srcl6w0ZaeahSgJLP+X9a/T+eL7 X-Received: by 2002:aa7:d709:: with SMTP id t9mr16158895edq.384.1627352802568; Mon, 26 Jul 2021 19:26:42 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1627352802; cv=none; d=google.com; s=arc-20160816; b=KF/wUJSMBXfsjHKY5L0MbyOFRvn7hs8KbyeqbyRopOsDaLUz4rpmGK+xgPw7VWYJ3M xJ7aUoASD1NBzpEtB6hLXBRMQl7+2Z/fAgaMNqNfOuOkUtxIUEuO3fx4FWc5+xP2/wy3 bPkd9iZmwaysrY6/X8Fg5WtlccCau1iyf+b59ozHjvQiTWaGBOpgaNm1iFbhhwsE5a2c vOF8tEh423g4msyZi3aL7lQE1j7dLxTNv3MBA7C5ney7xiVKjvxHpOZggBZ0RoAmUiLK vXkCByiOuAJBo4ZgIqeFqkXxW962bAiEM18f3MYKRI/SYqUi00qSX+kpmaRQNOOhj7hu 7c4w== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:message-id:date:references:in-reply-to:subject :cc:to:from:mime-version:content-transfer-encoding:dkim-signature :dkim-signature; bh=yykGekvnduIpKSS57vQ4r9keZZTUwIuSNyNomzk98ik=; b=e/kmiJSu9RD/rJEn4hfrFXgJgW7uWNU2PHg85NdzRYozM2LCBVIop/EPx/1HXETfI4 JWeuLIJzGct13CLLIKjtIh96EimSjuENI55nabmnnhHHSupDvvt+9LAfbG6NW9f7+qQj 9zk16VV8rgNxxuqZ9AHkUwYfoa76gwjCTKXcUI49HwpCQkNfV6ikrUag/0GFBiIj8BSw cM63Jp1TQ5nwgcHPCe7WrGm8eXCs3qAOSVepMOXddk6UPtGRGUPp6dZmnC03ElD5JZqr O0HPHVnKfcwaxWlBd7SkVrqtlu2H4oSxZABdgaxir38LbCEWwj9xqvJuPLQLtx8IvtuW P+ng== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@suse.de header.s=susede2_rsa header.b=WOz4UQrd; dkim=neutral (no key) header.i=@suse.de header.s=susede2_ed25519; spf=pass (google.com: domain of linux-nfs-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-nfs-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 v16si1531528ejg.83.2021.07.26.19.26.12; Mon, 26 Jul 2021 19:26:42 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-nfs-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; dkim=pass header.i=@suse.de header.s=susede2_rsa header.b=WOz4UQrd; dkim=neutral (no key) header.i=@suse.de header.s=susede2_ed25519; spf=pass (google.com: domain of linux-nfs-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-nfs-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S234385AbhG0Bpf (ORCPT + 99 others); Mon, 26 Jul 2021 21:45:35 -0400 Received: from smtp-out1.suse.de ([195.135.220.28]:38852 "EHLO smtp-out1.suse.de" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S233727AbhG0Bpe (ORCPT ); Mon, 26 Jul 2021 21:45:34 -0400 Received: from imap2.suse-dmz.suse.de (imap2.suse-dmz.suse.de [192.168.254.74]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature ECDSA (P-521) server-digest SHA512) (No client certificate requested) by smtp-out1.suse.de (Postfix) with ESMTPS id 06FA6220D5; Tue, 27 Jul 2021 02:26:00 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=suse.de; s=susede2_rsa; t=1627352760; h=from:from:reply-to:date:date:message-id:message-id:to:to:cc:cc: mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=yykGekvnduIpKSS57vQ4r9keZZTUwIuSNyNomzk98ik=; b=WOz4UQrd3xH/HOm9Alz6JHtsDOCvG/bTOdfg9GTDztsn75vj2RjDEKoYhCxzqyXtKPN+/K o3AdIN39ocM5qTNEQxWIwVNYMVDf4EpS6YqhCTe16v2simMpfoWpSDZxusfz0XJz10/YsF sI7ms1jj+nL//o4kriIxRqD+Dcig9vc= DKIM-Signature: v=1; a=ed25519-sha256; c=relaxed/relaxed; d=suse.de; s=susede2_ed25519; t=1627352760; h=from:from:reply-to:date:date:message-id:message-id:to:to:cc:cc: mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=yykGekvnduIpKSS57vQ4r9keZZTUwIuSNyNomzk98ik=; b=v+pZGzT8pXOFESYXAgFeDf/fNsNoeJsmx/nmKX+ppnrKsmk5KsEjpQ74eGWREM4JaUhm1G Wx9/bwt7Vj8KwxBg== Received: from imap2.suse-dmz.suse.de (imap2.suse-dmz.suse.de [192.168.254.74]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature ECDSA (P-521) server-digest SHA512) (No client certificate requested) by imap2.suse-dmz.suse.de (Postfix) with ESMTPS id 2353213B5C; Tue, 27 Jul 2021 02:25:57 +0000 (UTC) Received: from dovecot-director2.suse.de ([192.168.254.65]) by imap2.suse-dmz.suse.de with ESMTPSA id c60fNLVu/2AIGQAAMHmgww (envelope-from ); Tue, 27 Jul 2021 02:25:57 +0000 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: 7bit MIME-Version: 1.0 From: "NeilBrown" To: "Matthew Wilcox" Cc: "Goldwyn Rodrigues" , linux-fsdevel@vger.kernel.org, linux-btrfs@vger.kernel.org, linux-fscrypt@vger.kernel.org, linux-nfs@vger.kernel.org Subject: Re: [PATCH] fs: reduce pointers while using file_ra_state_init() In-reply-to: References: <20210726164647.brx3l2ykwv3zz7vr@fiona>, <162733718119.4153.5949006309014161476@noble.neil.brown.name>, Date: Tue, 27 Jul 2021 12:25:54 +1000 Message-id: <162735275468.4153.4700285307587386171@noble.neil.brown.name> Precedence: bulk List-ID: X-Mailing-List: linux-nfs@vger.kernel.org On Tue, 27 Jul 2021, Matthew Wilcox wrote: > On Tue, Jul 27, 2021 at 08:06:21AM +1000, NeilBrown wrote: > > You seem to be assuming that inode->i_mapping->host is always 'inode'. > > That is not the case. > > Weeeelllll ... technically, outside of the filesystems that are > changed here, the only assumption in common code that is made is that > inode_to_bdi(inode->i_mapping->host->i_mapping->host) == > inode_to_bdi(inode) Individual filesystems doing their own thing is fine. Passing just an inode to inode_to_bdi is fine. But the patch changes do_dentry_open() > > Looking at inode_to_bdi, that just means that they have the same i_sb. > Which is ... not true for character raw devices? > if (++raw_devices[minor].inuse == 1) > file_inode(filp)->i_mapping = > bdev->bd_inode->i_mapping; > but then, who's using readahead on a character raw device? They > force O_DIRECT. But maybe this should pass inode->i_mapping->host > instead of inode. Also not true in coda. coda (for those who don't know) is a network filesystem which fetches whole files (and often multiple files) at a time (like the Andrew filesystem). The files are stored in a local filesystem which acts as a cache. So an inode in a 'coda' filesystem access page-cache pages from a file in e.g. an 'ext4' filesystem. This is done via the ->i_mapping link. For (nearly?) all other filesystems, ->i_mapping is a link to ->i_data in the same inode. > > > In particular, fs/coda/file.c contains > > > > if (coda_inode->i_mapping == &coda_inode->i_data) > > coda_inode->i_mapping = host_inode->i_mapping; > > > > So a "coda_inode" shares the mapping with a "host_inode". > > > > This is why an inode has both i_data and i_mapping. > > > > So I'm not really sure this patch is safe. It might break codafs. > > > > But it is more likely that codafs isn't used, doesn't work, should be > > removed, and i_data should be renamed to i_mapping. > > I think there's also something unusual going on with either ocfs2 > or gfs2. But yes, I don't understand the rules for when I need to > go from inode->i_mapping->host. > Simple. Whenever you want to work with the page-cache pages, you cannot assume anything in the original inode is relevant except i_mapping (and maybe i_size I guess). NeilBrown