Received: by 2002:a05:6a10:c604:0:0:0:0 with SMTP id y4csp2352555pxt; Sun, 8 Aug 2021 20:59:11 -0700 (PDT) X-Google-Smtp-Source: ABdhPJz6xVL13wrKTxdhMqf/vxrmMEPW2v5OOVlKyub4zHtQwevnAPPpi/VLImGExKbuMtfBV2Mw X-Received: by 2002:a05:6402:2908:: with SMTP id ee8mr25067979edb.135.1628481550920; Sun, 08 Aug 2021 20:59:10 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1628481550; cv=none; d=google.com; s=arc-20160816; b=lpSBwtpFK7K5kITVKpRfzQoHsCTIk5FASy1KfMNwa+yLQtKJKFWaHaEMeBQLqs7LEs 6wWxZDJIvrMuB+V7SIeblVd/UK0isE8k1XzltCjkiw3Pep//vznxaBdkV4fFmsHMauVk rZzQsKQOOI/IoPoaHI9Znuzy/tO4EWaSEvMOsjAMPCuL3/yBNKyND2ZSBYUCePkNrdg4 aVWCGbK4ryMMWI9bZnXsxnpV/8KahpB0rlkTAPrPIIcLfY3tBDI8vPBEmf7X5+2euiRN SDfVgxBCpiqSaSJBjaEilM5GdTuQEZ/XhsQlqJ9eQJ/4YZ19tA7xqZcu5p+Hleah9yQV pigA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :user-agent:message-id:date:cc:to:from:subject:dkim-signature :dkim-signature; bh=Sb1QA97NgQTxNE9aFEJpXFBCpCFiUGgr0naZO+lLRCk=; b=ngUPa0PnZYkU+x0VkmRlcr5TkAre7CUXOzkoERGZYgygBx8lJKLZhfeLaDzFuYOOGz d0i0S2io4+1hNsuO2kBAPUZuVPvtV1DyFS7MhbsYxdaJXwDoa0BVivrFaDtYlohi3wqz sE+NShNLoDIQ8E1OtjHN6sBAcHVB1mL0uTn2V1D2ZOBZ60cH7k5GQDbwYtb+OGAY/9s8 eCStHXLh+oJE+jfZp3ES7cKNZr9oYoWE51cBESk5cOCNHrqwMtv+U+fsIFlFqfKYtDQ6 pxwJkhYruSsq4Dv4qLgn6DQ7iL49xwYCsqkDQLfjmEnzt/oQDfge9b/orlz/eLwlf93M s12A== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@suse.de header.s=susede2_rsa header.b=KzG4GFOR; dkim=neutral (no key) header.i=@suse.de; 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; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=suse.de Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id y22si5902202edq.49.2021.08.08.20.58.36; Sun, 08 Aug 2021 20:59:10 -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=KzG4GFOR; dkim=neutral (no key) header.i=@suse.de; 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; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=suse.de Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S232763AbhHID6j (ORCPT + 99 others); Sun, 8 Aug 2021 23:58:39 -0400 Received: from smtp-out1.suse.de ([195.135.220.28]:56414 "EHLO smtp-out1.suse.de" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S232680AbhHID6i (ORCPT ); Sun, 8 Aug 2021 23:58:38 -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 353DF21E55; Mon, 9 Aug 2021 03:58:17 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=suse.de; s=susede2_rsa; t=1628481497; 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; bh=Sb1QA97NgQTxNE9aFEJpXFBCpCFiUGgr0naZO+lLRCk=; b=KzG4GFORXeMkvnlSFrT1yn+WfPYF3LvxsokNV1wFl106F18UNkhAxdKOAXpF5A9A36RHm9 ibzdubEpKPP8VEm/Lf0QyjkMMrJj7HRDCDnba3KcfN1dSlpwS+/l5ODYr1RYtnzyF6J13Z MRs056zY/oXOSUs8+cybs9NiXGkxv5w= DKIM-Signature: v=1; a=ed25519-sha256; c=relaxed/relaxed; d=suse.de; s=susede2_ed25519; t=1628481497; 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; bh=Sb1QA97NgQTxNE9aFEJpXFBCpCFiUGgr0naZO+lLRCk=; b=W+yBQz1VKF0Yrm8tgHBsuIYABA07f5kSfl4AG8iPDxD6IzMSTKixf5LPvKzAHF8n5gEODc S7C/+a6enIEvPfBQ== 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 45AB613A9F; Mon, 9 Aug 2021 03:58:15 +0000 (UTC) Received: from dovecot-director2.suse.de ([192.168.254.65]) by imap2.suse-dmz.suse.de with ESMTPSA id 1hoKAdenEGG7BgAAMHmgww (envelope-from ); Mon, 09 Aug 2021 03:58:15 +0000 Subject: [PATCH/RFC 0/4] Attempt to make progress with btrfs dev number strangeness. From: NeilBrown To: Josef Bacik , Chris Mason , David Sterba Cc: linux-fsdevel@vger.kernel.org, Linux NFS list , Btrfs BTRFS Date: Mon, 09 Aug 2021 13:55:27 +1000 Message-ID: <162848123483.25823.15844774651164477866.stgit@noble.brown> User-Agent: StGit/0.23 MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: 7bit Precedence: bulk List-ID: X-Mailing-List: linux-nfs@vger.kernel.org I continue to search for a way forward for btrfs so that its behaviour with respect to device numbers and subvols is somewhat coherent. This series implements some of the ideas in my "A Third perspective"[1], though with changes is various details. I introduce two new mount options, which default to no-change-in-behaviour. -o inumbits= causes inode numbers to be more unique across a whole btrfs filesystem, and is many cases completely unique. Mounting with "-i inumbits=56" will resolve the NFS issues that started me tilting at this particular windmill. -o numdevs= can reduce the number of distinct devices reported by stat(), either to 2 or to 1. Both ease problems for sites that exhaust their supply of device numbers. '2' allows "du -x" to continue to work, but is otherwise rather strange. '1' breaks the use of "du -x" and similar to examine a single subvol which might have subvol descendants, but provides generally sane behaviour "-o numdevs=1" also forces inumbits to have a useful value. I introduce a "tree id" which can be discovered using statx(). Two files with the same dev and ino might still be different if the tree-ids are different. Connected files with the same tree-id may be usefully considered to be related. I also change various /proc files (only when numdevs=1 is used) to provide extra information so they are useful with btrfs despite subvols. /proc/maps /proc/smaps /proc/locks /proc/X/fdinfo/Y are affected. The inode number becomes "XX:YY" where XX is the subvol number (tree id) and YY is the inode number. An alternate might be to report a number which might use up to 128 bits. Which is less likely to seriously break code? Note that code which ignores badly formatted lines is safe, because it will never currently find a match for a btrfs file in these files anyway. The device number they report is never returned in st_dev for stat() on any file. The audit subsystem and one or two other places report dev/ino and so need enhanced, but I haven't tried to address those. Various trace points also report dev/ino. I haven't tried thinking about those either. Thanks for your upcoming replies! NeilBrown --- NeilBrown (4): btrfs: include subvol identifier in inode number if -o inumbits=... btrfs: add numdevs= mount option. VFS/btrfs: add STATX_TREE_ID Add "tree" number to "inode" number in various /proc files. fs/btrfs/ctree.h | 17 +++++++++++++++-- fs/btrfs/disk-io.c | 24 +++++++++++++++++++++--- fs/btrfs/inode.c | 39 ++++++++++++++++++++++++++++++++++++++- fs/btrfs/ioctl.c | 6 ++++-- fs/btrfs/super.c | 31 +++++++++++++++++++++++++++++++ fs/inode.c | 1 + fs/locks.c | 12 +++++++++--- fs/notify/fdinfo.c | 19 ++++++++++++++----- fs/proc/nommu.c | 11 ++++++++--- fs/proc/task_mmu.c | 17 ++++++++++++----- fs/proc/task_nommu.c | 11 ++++++++--- fs/stat.c | 2 ++ include/linux/fs.h | 3 ++- include/linux/stat.h | 13 +++++++++++++ include/uapi/linux/stat.h | 3 ++- samples/vfs/test-statx.c | 4 +++- 16 files changed, 183 insertions(+), 30 deletions(-) -- Signature