From patchwork Sat Mar 29 08:42:14 2025 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Christian Brauner X-Patchwork-Id: 14032625 Received: from smtp.kernel.org (aws-us-west-2-korg-mail-1.web.codeaurora.org [10.30.226.201]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 71053149C55; Sat, 29 Mar 2025 08:43:27 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=10.30.226.201 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1743237807; cv=none; b=e3Znn8quLNVhFdBIS6RYxvvJ9Uo0pzOcM9WqKaSIGkNH/ol4bw1fKo+MvZjPn/CVtqYHXhci5EfzBlEHJOxydu5O6Rbh8kZtgEfwBzmBjnyb8en3MjFVT7f3RBEe8LN0TxB/sDRb9/VBwO2L38wqEXb8YZMEHKZi5VQ23rT1Qy8= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1743237807; c=relaxed/simple; bh=tXNgHPkpI1RYcg6+uolFMirXAFbH/6dKuJTHpZX5Tj8=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version:Content-Type; b=fQLo6XaE5egBR2EOyPLdLKwzz2sWBsPM4uB7nJX+xHfVs3JdrEsQ3H5oFCaCZFLH+Su7jvfc38KdYD41cgDihdifl+6akFEAAER3GLPhcohII8dhlXLi2TVniywYZ2k33YVSLEmZ2yUobfhqNJpAL5ShbhTACxiwltL5mhrmBA4= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b=fBT70bfy; arc=none smtp.client-ip=10.30.226.201 Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b="fBT70bfy" Received: by smtp.kernel.org (Postfix) with ESMTPSA id 9356EC4CEED; Sat, 29 Mar 2025 08:43:23 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1743237806; bh=tXNgHPkpI1RYcg6+uolFMirXAFbH/6dKuJTHpZX5Tj8=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=fBT70bfyPaaA0fuSCeSOA7l5/riBIMNs4F3cyy+D3/IWg6BtYO3lilkhAwH2p5wZa nDMKmhJkQqPH0ietrsR3Oam8WMRBKqq3itOyM1ommWHmQUh0XjWiIWSNfk7LEO5t58 cAdrdEa/hxe0M2FZB87Hs3ZxfDdBLahRH6bzYhvhtKKyiuNRMBdptq/fzvXgNxilZD r7V9Qj0lPCPPPu13kBYmhz4b9qgkLdYHvVX2xfG4MJNCZ/9MQMVzcKJOayJeD2mOQL n4sp8wYhvXhz+WhkmyAvrHsaZT4vWZ7jdMNdBwQIroXNlLX99SsUqUDy4r3fej9RMV m0M7h0M40Qo2w== From: Christian Brauner To: linux-fsdevel@vger.kernel.org, jack@suse.cz Cc: Christian Brauner , linux-kernel@vger.kernel.org, James Bottomley , mcgrof@kernel.org, hch@infradead.org, david@fromorbit.com, rafael@kernel.org, djwong@kernel.org, pavel@kernel.org, peterz@infradead.org, mingo@redhat.com, will@kernel.org, boqun.feng@gmail.com Subject: [PATCH v2 1/6] super: remove pointless s_root checks Date: Sat, 29 Mar 2025 09:42:14 +0100 Message-ID: <20250329-work-freeze-v2-1-a47af37ecc3d@kernel.org> X-Mailer: git-send-email 2.47.2 In-Reply-To: <20250329-work-freeze-v2-0-a47af37ecc3d@kernel.org> References: <20250329-work-freeze-v2-0-a47af37ecc3d@kernel.org> Precedence: bulk X-Mailing-List: linux-fsdevel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 X-Mailer: b4 0.15-dev-42535 X-Developer-Signature: v=1; a=openpgp-sha256; l=1525; i=brauner@kernel.org; h=from:subject:message-id; bh=tXNgHPkpI1RYcg6+uolFMirXAFbH/6dKuJTHpZX5Tj8=; b=owGbwMvMwCU28Zj0gdSKO4sYT6slMaQ/31Sx6WxNfWNwUarTyhT9TJEezutRx3zrFtr943t+Q OftMqfrHaUsDGJcDLJiiiwO7Sbhcst5KjYbZWrAzGFlAhnCwMUpABOpsGNkeLKWM/bK78kd6fcC qg9//CS+xeZ1jgzH/kCn597v5gQs/s/wv9BW67jh8klZoY+jCidPX3f2sF1W/ncu92MuFgYJMhl RDAA= X-Developer-Key: i=brauner@kernel.org; a=openpgp; fpr=4880B8C9BD0E5106FC070F4F7B3C391EFEA93624 The locking guarantees that the superblock is alive and sb->s_root is still set. Remove the pointless check. Signed-off-by: Christian Brauner Reviewed-by: Jan Kara --- fs/super.c | 19 ++++++------------- 1 file changed, 6 insertions(+), 13 deletions(-) diff --git a/fs/super.c b/fs/super.c index 97a17f9d9023..dc14f4bf73a6 100644 --- a/fs/super.c +++ b/fs/super.c @@ -930,8 +930,7 @@ void iterate_supers(void (*f)(struct super_block *, void *), void *arg) locked = super_lock_shared(sb); if (locked) { - if (sb->s_root) - f(sb, arg); + f(sb, arg); super_unlock_shared(sb); } @@ -967,11 +966,8 @@ void iterate_supers_type(struct file_system_type *type, spin_unlock(&sb_lock); locked = super_lock_shared(sb); - if (locked) { - if (sb->s_root) - f(sb, arg); - super_unlock_shared(sb); - } + if (locked) + f(sb, arg); spin_lock(&sb_lock); if (p) @@ -991,18 +987,15 @@ struct super_block *user_get_super(dev_t dev, bool excl) spin_lock(&sb_lock); list_for_each_entry(sb, &super_blocks, s_list) { - if (sb->s_dev == dev) { + if (sb->s_dev == dev) { bool locked; sb->s_count++; spin_unlock(&sb_lock); /* still alive? */ locked = super_lock(sb, excl); - if (locked) { - if (sb->s_root) - return sb; - super_unlock(sb, excl); - } + if (locked) + return sb; /* caller will drop */ /* nope, got unmounted */ spin_lock(&sb_lock); __put_super(sb); From patchwork Sat Mar 29 08:42:15 2025 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Christian Brauner X-Patchwork-Id: 14032626 Received: from smtp.kernel.org (aws-us-west-2-korg-mail-1.web.codeaurora.org [10.30.226.201]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 22847149C55; Sat, 29 Mar 2025 08:43:30 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=10.30.226.201 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1743237811; cv=none; b=nBF+669OZbBy7QvAXkRi5ClMGsPQOVU2gnyn+VAr5ABO19t/he9kLc+AR6ljfUIOkwq8SaEhYlHl2FJ1HAU2d6TNPD2hR0fsxCUOPIzKvSkZUmgBMzOG900ZbHwxLhz38iU+2BjydmKNhs+x1HxP8ede51od/1PMaNwGo9/k9M0= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1743237811; c=relaxed/simple; bh=kQuw8pGOEj2HTHUntYvMH05/2F/1BJUoN/04q2b6wh8=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version:Content-Type; b=ZqgB74JGG3qTuLJq5Es6oCTpnU7XpysbMbHd9ecO5WJ72fHnVqp+Wkcwvonh13+niG44mu89Oan9b8E+ourubm7f7DlFoiwUByqhSLZYw0KNxkcVmpgkAPEPJlXm6dj73KgQ7N1T3kDb77q2WX2+mWMPLSosX3DkrDYB5F6EHYI= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b=ZQd3Vexi; arc=none smtp.client-ip=10.30.226.201 Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b="ZQd3Vexi" Received: by smtp.kernel.org (Postfix) with ESMTPSA id 6635AC4CEE2; Sat, 29 Mar 2025 08:43:27 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1743237810; bh=kQuw8pGOEj2HTHUntYvMH05/2F/1BJUoN/04q2b6wh8=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=ZQd3VexiVWW45/tPrzn4z53ICI/yI4hXlkvQWMGi9f7+TsCseipYM3bhpc87RC5Fl N1kqpwdysJTtj5pfULoYdZ8AlHvDQcMD30Ei3GPWDTZPhIS1Y+V/li++1kTbvsbNga ACztT2owrfeM4ps0AIxltTqShzELNOp4+Fv2+wwW0zYS8ZXCkjH8QG87HrcSh2n2I6 chQ/JBwWx2y2N9g7VCGSrurCSIb0NI00BnHNn9GRA10nh+N0SQCy8u262NFQMoxSka oLnMGxkH02XGC/4ho0gP78sOrwjy77CVXLRvTWvkP8R3RcSMipsrcnX2CwI9kANRo0 cw+Lw2H30aTyw== From: Christian Brauner To: linux-fsdevel@vger.kernel.org, jack@suse.cz Cc: Christian Brauner , linux-kernel@vger.kernel.org, James Bottomley , mcgrof@kernel.org, hch@infradead.org, david@fromorbit.com, rafael@kernel.org, djwong@kernel.org, pavel@kernel.org, peterz@infradead.org, mingo@redhat.com, will@kernel.org, boqun.feng@gmail.com Subject: [PATCH v2 2/6] super: simplify user_get_super() Date: Sat, 29 Mar 2025 09:42:15 +0100 Message-ID: <20250329-work-freeze-v2-2-a47af37ecc3d@kernel.org> X-Mailer: git-send-email 2.47.2 In-Reply-To: <20250329-work-freeze-v2-0-a47af37ecc3d@kernel.org> References: <20250329-work-freeze-v2-0-a47af37ecc3d@kernel.org> Precedence: bulk X-Mailing-List: linux-fsdevel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 X-Mailer: b4 0.15-dev-42535 X-Developer-Signature: v=1; a=openpgp-sha256; l=1111; i=brauner@kernel.org; h=from:subject:message-id; bh=kQuw8pGOEj2HTHUntYvMH05/2F/1BJUoN/04q2b6wh8=; b=owGbwMvMwCU28Zj0gdSKO4sYT6slMaQ/31QxY+6rvZ5B5y0OxHG/dJkr/UHibIQuu9Lng0XLm 9WzXpes7ChlYRDjYpAVU2RxaDcJl1vOU7HZKFMDZg4rE8gQBi5OAZhI02RGhtmMp+MWnpuZv5lp V7JMzYeLq2Nzvc2nzrjnVrOwr4e56xbDXxG3QHc1W8M3purfGZf/5QmYturhGWfRY10MDe75y13 fsQMA X-Developer-Key: i=brauner@kernel.org; a=openpgp; fpr=4880B8C9BD0E5106FC070F4F7B3C391EFEA93624 Make it easier to read and remove one level of identation. Signed-off-by: Christian Brauner Reviewed-by: Jan Kara --- fs/super.c | 29 +++++++++++++++-------------- 1 file changed, 15 insertions(+), 14 deletions(-) diff --git a/fs/super.c b/fs/super.c index dc14f4bf73a6..b1acfc38ba0c 100644 --- a/fs/super.c +++ b/fs/super.c @@ -987,20 +987,21 @@ struct super_block *user_get_super(dev_t dev, bool excl) spin_lock(&sb_lock); list_for_each_entry(sb, &super_blocks, s_list) { - if (sb->s_dev == dev) { - bool locked; - - sb->s_count++; - spin_unlock(&sb_lock); - /* still alive? */ - locked = super_lock(sb, excl); - if (locked) - return sb; /* caller will drop */ - /* nope, got unmounted */ - spin_lock(&sb_lock); - __put_super(sb); - break; - } + bool locked; + + if (sb->s_dev != dev) + continue; + + sb->s_count++; + spin_unlock(&sb_lock); + + locked = super_lock(sb, excl); + if (locked) + return sb; + + spin_lock(&sb_lock); + __put_super(sb); + break; } spin_unlock(&sb_lock); return NULL; From patchwork Sat Mar 29 08:42:16 2025 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Christian Brauner X-Patchwork-Id: 14032627 Received: from smtp.kernel.org (aws-us-west-2-korg-mail-1.web.codeaurora.org [10.30.226.201]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 453DA149C55; Sat, 29 Mar 2025 08:43:34 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=10.30.226.201 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1743237814; cv=none; b=QLB1HyetvRNbzeitdxiUT1pdNgu4saj7S1f7oOsMTRGTrPzcUFiM+ld9rkJKZLPH/TEwoaYVa8Ki2SJriQAWz5mGf+nk1wlKxBlhIn8NjbRrIgDs/oCyPiy2DQvWkM+xYjWBgydWr2M0gH9o9UDooFEWfq350cb37FIKOsI3Fq0= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1743237814; c=relaxed/simple; bh=VP5XAT1jJt6izLv0u8XXhMb9Lleyzfaa/ssDFxRDreY=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version:Content-Type; b=afB5iGsxGC8G+D2pLvs9hlQ1E8WpsBmKjHvxTdU8I+WOpgbr+/h3rAVka+ztEEdKpbHqfPXXa9J8iiPnD75kOKpRhgqrJNu24vtg1EnGqakJrRqBSwKRndeGUC5iUE1uTM5LvQM8PeaVChSA6d/avNLaJht1HyW2Mpwm4rDViMY= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b=b96694e7; arc=none smtp.client-ip=10.30.226.201 Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b="b96694e7" Received: by smtp.kernel.org (Postfix) with ESMTPSA id 0E7A7C4CEEA; Sat, 29 Mar 2025 08:43:30 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1743237814; bh=VP5XAT1jJt6izLv0u8XXhMb9Lleyzfaa/ssDFxRDreY=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=b96694e7RmSxfy7fvdgNraBCu+M7g340i+aaskTJWpzwcRC+5uSgiWxlt5iLy248e THqBa6TdnC3rWiPki4kTEkGMd7VzPRqqlTAL6LQaF36xv8spjBze/CTSkOjW+n9vw0 /PGJipVT/WvvkVUYqTp4JcT7iOOi79OIrHhwdtC6dXDEzX+9pQn1d/k2yRxKhrqJi8 mHMYKPdcT9plF08GdgkCT4U0iCxi1JEib7uMCeBEMfepqSrm1gDNUBAIj/Ihfz/n/+ Pw7zNVbObme5OaIMiaISQ1QBPM2OUpUYrjstDujE+NC7iz+wrE+wlYCh0/BtIPqmoq K3Ljobtz4mLew== From: Christian Brauner To: linux-fsdevel@vger.kernel.org, jack@suse.cz Cc: Christian Brauner , linux-kernel@vger.kernel.org, James Bottomley , mcgrof@kernel.org, hch@infradead.org, david@fromorbit.com, rafael@kernel.org, djwong@kernel.org, pavel@kernel.org, peterz@infradead.org, mingo@redhat.com, will@kernel.org, boqun.feng@gmail.com Subject: [PATCH v2 3/6] super: skip dying superblocks early Date: Sat, 29 Mar 2025 09:42:16 +0100 Message-ID: <20250329-work-freeze-v2-3-a47af37ecc3d@kernel.org> X-Mailer: git-send-email 2.47.2 In-Reply-To: <20250329-work-freeze-v2-0-a47af37ecc3d@kernel.org> References: <20250329-work-freeze-v2-0-a47af37ecc3d@kernel.org> Precedence: bulk X-Mailing-List: linux-fsdevel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 X-Mailer: b4 0.15-dev-42535 X-Developer-Signature: v=1; a=openpgp-sha256; l=870; i=brauner@kernel.org; h=from:subject:message-id; bh=VP5XAT1jJt6izLv0u8XXhMb9Lleyzfaa/ssDFxRDreY=; b=owGbwMvMwCU28Zj0gdSKO4sYT6slMaQ/31QhkH//5oT7BptfVQrn1Ja5+u6JSE5aufXAwy117 nuvs7p5dZSyMIhxMciKKbI4tJuEyy3nqdhslKkBM4eVCWQIAxenAEzkzwFGhmlnXH9z1pRO1pgn cWq7ry6reMCK0/NStBdV/uJs3av1bSYjQ3trpfhq6/+O7FJdGhNnv+w/cWFyPcOnkhl7zjSX3Hr 9ghcA X-Developer-Key: i=brauner@kernel.org; a=openpgp; fpr=4880B8C9BD0E5106FC070F4F7B3C391EFEA93624 Make all iterators uniform by performing an early check whether the superblock is dying. Signed-off-by: Christian Brauner Reviewed-by: Jan Kara --- fs/super.c | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/fs/super.c b/fs/super.c index b1acfc38ba0c..c67ea3cdda41 100644 --- a/fs/super.c +++ b/fs/super.c @@ -925,6 +925,9 @@ void iterate_supers(void (*f)(struct super_block *, void *), void *arg) list_for_each_entry(sb, &super_blocks, s_list) { bool locked; + if (super_flags(sb, SB_DYING)) + continue; + sb->s_count++; spin_unlock(&sb_lock); @@ -962,6 +965,9 @@ void iterate_supers_type(struct file_system_type *type, hlist_for_each_entry(sb, &type->fs_supers, s_instances) { bool locked; + if (super_flags(sb, SB_DYING)) + continue; + sb->s_count++; spin_unlock(&sb_lock); From patchwork Sat Mar 29 08:42:17 2025 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Christian Brauner X-Patchwork-Id: 14032628 Received: from smtp.kernel.org (aws-us-west-2-korg-mail-1.web.codeaurora.org [10.30.226.201]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 3D67C149C55; Sat, 29 Mar 2025 08:43:37 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=10.30.226.201 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1743237818; cv=none; b=c/R/X4y9L9fdgJXZ5rYY0nrq/QKWzfIfSNhZN845EHIC83hfeU1DF5NjwbPI1tDlaPiHKxSTXmbwYZRGFf+jTQtnb4SWGccRtSWuzZqX4cm176VBRl5lhPwZWDgtsYXd4VvPB4KU0fLyeqNtZosJ6c88V4y+qGbd2Egy4I4bh0U= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1743237818; c=relaxed/simple; bh=kSJquFBWZLjXohp7CdfSUxcMmSKnA8vBlSuTa7rPH5k=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version:Content-Type; b=pjm1uhLaGsv0DH+WWZ7xG83+7W0rr0lzk2DjeJCkW5qKteSKIj7XymZqQTUCTIc16j9HS450FUhdYI+J9JfDNaB1b+OkwliRQ/+qZsFRxJmrSacJnueV0PeOFgYyaUMH1RCZzwQ+dMgxThidViUXgduHUMcRWWuIKDyvsaFROj0= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b=BOqSSonc; arc=none smtp.client-ip=10.30.226.201 Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b="BOqSSonc" Received: by smtp.kernel.org (Postfix) with ESMTPSA id 964DFC4CEEA; Sat, 29 Mar 2025 08:43:34 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1743237817; bh=kSJquFBWZLjXohp7CdfSUxcMmSKnA8vBlSuTa7rPH5k=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=BOqSSoncdSQdi2oPHb1SWPcFCUIW5Sgc0ysHjnv8czeAnhAkNARbN8QxZsYEyiyHx 3nhqjDve+t519n/W0/xywko11laZDCadp3VhFZa5RxRwpmHgEpyexKAntW+02RcTtU YBXaLp7wTCC4zlfpJ4Gp3iczXRQ7OdmwWfWdHtc2cz2jTFkKRes5kGv2TZk6TTy8CD bzt4ItopjgIHtwXthnIEQYJi5ivlNEA4dNz3aZ6cWZLf9lbHaJTgNTubEfB7qrlsC5 SJmIbexdNEhXLnfelZtnCgPtpiUYMjRrN+t72yAt5bVnnxHUMHAfWWPWZ5zfIaZpzN 28BHDUn64nz5Q== From: Christian Brauner To: linux-fsdevel@vger.kernel.org, jack@suse.cz Cc: Christian Brauner , linux-kernel@vger.kernel.org, James Bottomley , mcgrof@kernel.org, hch@infradead.org, david@fromorbit.com, rafael@kernel.org, djwong@kernel.org, pavel@kernel.org, peterz@infradead.org, mingo@redhat.com, will@kernel.org, boqun.feng@gmail.com Subject: [PATCH v2 4/6] super: use a common iterator (Part 1) Date: Sat, 29 Mar 2025 09:42:17 +0100 Message-ID: <20250329-work-freeze-v2-4-a47af37ecc3d@kernel.org> X-Mailer: git-send-email 2.47.2 In-Reply-To: <20250329-work-freeze-v2-0-a47af37ecc3d@kernel.org> References: <20250329-work-freeze-v2-0-a47af37ecc3d@kernel.org> Precedence: bulk X-Mailing-List: linux-fsdevel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 X-Mailer: b4 0.15-dev-42535 X-Developer-Signature: v=1; a=openpgp-sha256; l=4478; i=brauner@kernel.org; h=from:subject:message-id; bh=kSJquFBWZLjXohp7CdfSUxcMmSKnA8vBlSuTa7rPH5k=; b=owGbwMvMwCU28Zj0gdSKO4sYT6slMaQ/31S59sp7/5W/dLY87awO/8du6b3/8t5ZZSI3GmYGX vr4LF56WkcpC4MYF4OsmCKLQ7tJuNxynorNRpkaMHNYmUCGMHBxCsBEbr9gZFhS0ufqwN5W99Dy mV0hw+VZz5rkCmXXbTmyTuvAr/9zoiwZ/vBt+/ki4hBn4YVlP5V8Fu9kzpBbyTnjn3Tv0rpotjo 2aQYA X-Developer-Key: i=brauner@kernel.org; a=openpgp; fpr=4880B8C9BD0E5106FC070F4F7B3C391EFEA93624 Use a common iterator for all callbacks. Signed-off-by: Christian Brauner Reviewed-by: Jan Kara --- fs/super.c | 67 +++++++++++------------------------------------------- include/linux/fs.h | 6 ++++- 2 files changed, 18 insertions(+), 55 deletions(-) diff --git a/fs/super.c b/fs/super.c index c67ea3cdda41..0dd208804a74 100644 --- a/fs/super.c +++ b/fs/super.c @@ -887,37 +887,7 @@ void drop_super_exclusive(struct super_block *sb) } EXPORT_SYMBOL(drop_super_exclusive); -static void __iterate_supers(void (*f)(struct super_block *)) -{ - struct super_block *sb, *p = NULL; - - spin_lock(&sb_lock); - list_for_each_entry(sb, &super_blocks, s_list) { - if (super_flags(sb, SB_DYING)) - continue; - sb->s_count++; - spin_unlock(&sb_lock); - - f(sb); - - spin_lock(&sb_lock); - if (p) - __put_super(p); - p = sb; - } - if (p) - __put_super(p); - spin_unlock(&sb_lock); -} -/** - * iterate_supers - call function for all active superblocks - * @f: function to call - * @arg: argument to pass to it - * - * Scans the superblock list and calls given function, passing it - * locked superblock and given argument. - */ -void iterate_supers(void (*f)(struct super_block *, void *), void *arg) +void __iterate_supers(void (*f)(struct super_block *, void *), void *arg, bool excl) { struct super_block *sb, *p = NULL; @@ -927,14 +897,13 @@ void iterate_supers(void (*f)(struct super_block *, void *), void *arg) if (super_flags(sb, SB_DYING)) continue; - sb->s_count++; spin_unlock(&sb_lock); - locked = super_lock_shared(sb); + locked = super_lock(sb, excl); if (locked) { f(sb, arg); - super_unlock_shared(sb); + super_unlock(sb, excl); } spin_lock(&sb_lock); @@ -1111,11 +1080,9 @@ int reconfigure_super(struct fs_context *fc) return retval; } -static void do_emergency_remount_callback(struct super_block *sb) +static void do_emergency_remount_callback(struct super_block *sb, void *unused) { - bool locked = super_lock_excl(sb); - - if (locked && sb->s_root && sb->s_bdev && !sb_rdonly(sb)) { + if (sb->s_bdev && !sb_rdonly(sb)) { struct fs_context *fc; fc = fs_context_for_reconfigure(sb->s_root, @@ -1126,13 +1093,11 @@ static void do_emergency_remount_callback(struct super_block *sb) put_fs_context(fc); } } - if (locked) - super_unlock_excl(sb); } static void do_emergency_remount(struct work_struct *work) { - __iterate_supers(do_emergency_remount_callback); + __iterate_supers(do_emergency_remount_callback, NULL, true); kfree(work); printk("Emergency Remount complete\n"); } @@ -1148,24 +1113,18 @@ void emergency_remount(void) } } -static void do_thaw_all_callback(struct super_block *sb) +static void do_thaw_all_callback(struct super_block *sb, void *unused) { - bool locked = super_lock_excl(sb); - - if (locked && sb->s_root) { - if (IS_ENABLED(CONFIG_BLOCK)) - while (sb->s_bdev && !bdev_thaw(sb->s_bdev)) - pr_warn("Emergency Thaw on %pg\n", sb->s_bdev); - thaw_super_locked(sb, FREEZE_HOLDER_USERSPACE); - return; - } - if (locked) - super_unlock_excl(sb); + if (IS_ENABLED(CONFIG_BLOCK)) + while (sb->s_bdev && !bdev_thaw(sb->s_bdev)) + pr_warn("Emergency Thaw on %pg\n", sb->s_bdev); + thaw_super_locked(sb, FREEZE_HOLDER_USERSPACE); + return; } static void do_thaw_all(struct work_struct *work) { - __iterate_supers(do_thaw_all_callback); + __iterate_supers(do_thaw_all_callback, NULL, true); kfree(work); printk(KERN_WARNING "Emergency Thaw complete\n"); } diff --git a/include/linux/fs.h b/include/linux/fs.h index 016b0fe1536e..0351500b71d2 100644 --- a/include/linux/fs.h +++ b/include/linux/fs.h @@ -3515,7 +3515,11 @@ extern void put_filesystem(struct file_system_type *fs); extern struct file_system_type *get_fs_type(const char *name); extern void drop_super(struct super_block *sb); extern void drop_super_exclusive(struct super_block *sb); -extern void iterate_supers(void (*)(struct super_block *, void *), void *); +void __iterate_supers(void (*f)(struct super_block *, void *), void *arg, bool excl); +static inline void iterate_supers(void (*f)(struct super_block *, void *), void *arg) +{ + __iterate_supers(f, arg, false); +} extern void iterate_supers_type(struct file_system_type *, void (*)(struct super_block *, void *), void *); From patchwork Sat Mar 29 08:42:18 2025 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Christian Brauner X-Patchwork-Id: 14032629 Received: from smtp.kernel.org (aws-us-west-2-korg-mail-1.web.codeaurora.org [10.30.226.201]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 309EB149C55; Sat, 29 Mar 2025 08:43:44 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=10.30.226.201 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1743237825; cv=none; b=Mp+Ah3H8ojDun/J7dCxbYo2EajH4+oJYM9gdp3Ymr2RFtRy0u6bSnN/cM2AaAj9MuL9zpPyAiiFJtmboOL2pqz4Q3uaHtYBDC33ZqiJS8bZRNGKSHdrjnuYh0wh8nqjig0y5idVfwmhj6IumEIesWW6mp8YIZs+ZAcTVEq9A7qg= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1743237825; c=relaxed/simple; bh=72IW7BF44UfUCx/jmJIVhavHPgdnbNCwCPoZ3/+N4Z0=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version:Content-Type; b=EK42E5/i36eayaAyv8FPx/FGPTvUFCeoT+3pF1W6CQRIRBE0CVcJFsFq++e5/95454IfslF+mSiQp42mspZ9P/Hz/8N48T1g7ZQTG8rCWxOqnHAePGnbYhvnGMrA8do/WoJk7hpKl9TxKvaFxUrMHs2CztwCXk2W014Zjm3X9A0= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b=YKSExfwm; arc=none smtp.client-ip=10.30.226.201 Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b="YKSExfwm" Received: by smtp.kernel.org (Postfix) with ESMTPSA id 34B1EC4CEE2; Sat, 29 Mar 2025 08:43:38 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1743237824; bh=72IW7BF44UfUCx/jmJIVhavHPgdnbNCwCPoZ3/+N4Z0=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=YKSExfwm+GuPiZU5j3tsVy+adDftwiq6kY/YfH1rcyPEwzGvE9AgPzYQOoRXy5pU7 RFwZRmv5zl1uOH0k/CAoaRP2Ca90pEXbkRSHsHDt8O7Y0tavX4fPWdJeURx4wHS9WX h8TV65+lfCstkGBhCsoVzAkCZnvhoaUaT2UH0KPlprIvIGqP1jY7KIw2H+zCrz9jRF 9A4/lB9qQ2fkP/fPmkUhjoT+VHLgNIjb5KnEoFZp63TiWKnBtzd961FNX4WPkaLwlG srsswoh3y5xUcf+GyMyNTt6morxPqYEb6IX8Dq7ZWROhMDw6N5UCF6G1mXpEJFXzoq Rc6kAvgn9jVKQ== From: Christian Brauner To: linux-fsdevel@vger.kernel.org, jack@suse.cz Cc: Christian Brauner , linux-kernel@vger.kernel.org, James Bottomley , mcgrof@kernel.org, hch@infradead.org, david@fromorbit.com, rafael@kernel.org, djwong@kernel.org, pavel@kernel.org, peterz@infradead.org, mingo@redhat.com, will@kernel.org, boqun.feng@gmail.com Subject: [PATCH v2 5/6] super: use common iterator (Part 2) Date: Sat, 29 Mar 2025 09:42:18 +0100 Message-ID: <20250329-work-freeze-v2-5-a47af37ecc3d@kernel.org> X-Mailer: git-send-email 2.47.2 In-Reply-To: <20250329-work-freeze-v2-0-a47af37ecc3d@kernel.org> References: <20250329-work-freeze-v2-0-a47af37ecc3d@kernel.org> Precedence: bulk X-Mailing-List: linux-fsdevel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 X-Mailer: b4 0.15-dev-42535 X-Developer-Signature: v=1; a=openpgp-sha256; l=4051; i=brauner@kernel.org; h=from:subject:message-id; bh=72IW7BF44UfUCx/jmJIVhavHPgdnbNCwCPoZ3/+N4Z0=; b=owGbwMvMwCU28Zj0gdSKO4sYT6slMaQ/31S572aA/JmD9gvK7BxlJY6/yvIoePCizPF/UOkJj oD3vjGbOkpZGMS4GGTFFFkc2k3C5ZbzVGw2ytSAmcPKBDKEgYtTACYyNZSRoWVpwm/hJ79OTtRe 4Pfk1VPGl4e/Tol7Z8+4t+NMTtr8XB1GhrmLLf7uzsrStnvH923hO5aSHqnpGu8iXE3m+iXrz+1 TYAEA X-Developer-Key: i=brauner@kernel.org; a=openpgp; fpr=4880B8C9BD0E5106FC070F4F7B3C391EFEA93624 Use a common iterator for all callbacks. We could go for something even more elaborate (advance step-by-step similar to iov_iter) but I really don't think this is warranted. Signed-off-by: Christian Brauner Reviewed-by: Jan Kara --- fs/super.c | 49 ++++++++++++++++++++++++++++++++++++++++--------- include/linux/fs.h | 6 +----- 2 files changed, 41 insertions(+), 14 deletions(-) diff --git a/fs/super.c b/fs/super.c index 0dd208804a74..666a2a16df87 100644 --- a/fs/super.c +++ b/fs/super.c @@ -887,21 +887,47 @@ void drop_super_exclusive(struct super_block *sb) } EXPORT_SYMBOL(drop_super_exclusive); -void __iterate_supers(void (*f)(struct super_block *, void *), void *arg, bool excl) +enum super_iter_flags_t { + SUPER_ITER_EXCL = (1U << 0), + SUPER_ITER_UNLOCKED = (1U << 1), + SUPER_ITER_REVERSE = (1U << 2), +}; + +static inline struct super_block *first_super(enum super_iter_flags_t flags) +{ + if (flags & SUPER_ITER_REVERSE) + return list_last_entry(&super_blocks, struct super_block, s_list); + return list_first_entry(&super_blocks, struct super_block, s_list); +} + +static inline struct super_block *next_super(struct super_block *sb, + enum super_iter_flags_t flags) +{ + if (flags & SUPER_ITER_REVERSE) + return list_prev_entry(sb, s_list); + return list_next_entry(sb, s_list); +} + +#define invalid_super list_entry_is_head + +static void __iterate_supers(void (*f)(struct super_block *, void *), void *arg, + enum super_iter_flags_t flags) { struct super_block *sb, *p = NULL; + bool excl = flags & SUPER_ITER_EXCL; - spin_lock(&sb_lock); - list_for_each_entry(sb, &super_blocks, s_list) { - bool locked; + guard(spinlock)(&sb_lock); + for (sb = first_super(flags); !invalid_super(sb, &super_blocks, s_list); + sb = next_super(sb, flags)) { if (super_flags(sb, SB_DYING)) continue; sb->s_count++; spin_unlock(&sb_lock); - locked = super_lock(sb, excl); - if (locked) { + if (flags & SUPER_ITER_UNLOCKED) { + f(sb, arg); + } else if (super_lock(sb, excl)) { f(sb, arg); super_unlock(sb, excl); } @@ -913,7 +939,11 @@ void __iterate_supers(void (*f)(struct super_block *, void *), void *arg, bool e } if (p) __put_super(p); - spin_unlock(&sb_lock); +} + +void iterate_supers(void (*f)(struct super_block *, void *), void *arg) +{ + __iterate_supers(f, arg, 0); } /** @@ -1097,7 +1127,8 @@ static void do_emergency_remount_callback(struct super_block *sb, void *unused) static void do_emergency_remount(struct work_struct *work) { - __iterate_supers(do_emergency_remount_callback, NULL, true); + __iterate_supers(do_emergency_remount_callback, NULL, + SUPER_ITER_EXCL | SUPER_ITER_REVERSE); kfree(work); printk("Emergency Remount complete\n"); } @@ -1124,7 +1155,7 @@ static void do_thaw_all_callback(struct super_block *sb, void *unused) static void do_thaw_all(struct work_struct *work) { - __iterate_supers(do_thaw_all_callback, NULL, true); + __iterate_supers(do_thaw_all_callback, NULL, SUPER_ITER_EXCL); kfree(work); printk(KERN_WARNING "Emergency Thaw complete\n"); } diff --git a/include/linux/fs.h b/include/linux/fs.h index 0351500b71d2..c475fa874055 100644 --- a/include/linux/fs.h +++ b/include/linux/fs.h @@ -3515,11 +3515,7 @@ extern void put_filesystem(struct file_system_type *fs); extern struct file_system_type *get_fs_type(const char *name); extern void drop_super(struct super_block *sb); extern void drop_super_exclusive(struct super_block *sb); -void __iterate_supers(void (*f)(struct super_block *, void *), void *arg, bool excl); -static inline void iterate_supers(void (*f)(struct super_block *, void *), void *arg) -{ - __iterate_supers(f, arg, false); -} +extern void iterate_supers(void (*f)(struct super_block *, void *), void *arg); extern void iterate_supers_type(struct file_system_type *, void (*)(struct super_block *, void *), void *); From patchwork Sat Mar 29 08:42:19 2025 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Christian Brauner X-Patchwork-Id: 14032630 Received: from smtp.kernel.org (aws-us-west-2-korg-mail-1.web.codeaurora.org [10.30.226.201]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 6526B1C5F25; Sat, 29 Mar 2025 08:43:48 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=10.30.226.201 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1743237828; cv=none; b=CmiMtKZ0RA9ZmearLog5JrD68fm03HajpCBIxXwayQR76vkgXXv8qwaZIi7lSt8wu3SeIecGb+x6lWwWWAyRwEgPJKKDzPZs/DvKZjrUyto9miUGdSggSU6dLjWJj55J0mty3zu1MiDEGXHYp/g2nDQ11L6zxk33hheyXesiBIA= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1743237828; c=relaxed/simple; bh=GFcv+iHs3cxAf0PS51ww4sS11+jxpW/HW9m0JZc6IcE=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version:Content-Type; b=kqzAjahG8+eZ1nL7XiQwn3/gn6DNMLvLAHkTFLH8kN3+jvPFAk9dTemJICuA5qbvcW6euZQWsYj++ca0PUIvZaCC/AUX1aI20aR9EgWE5xNqJckJ6akJnFEdMo3MiowiTjKjRjRsi+zKAri5xFZgSkSUlkUZ4alqXBPivxEaByA= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b=oYGTSIZC; arc=none smtp.client-ip=10.30.226.201 Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b="oYGTSIZC" Received: by smtp.kernel.org (Postfix) with ESMTPSA id 2889CC4CEE9; Sat, 29 Mar 2025 08:43:44 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1743237828; bh=GFcv+iHs3cxAf0PS51ww4sS11+jxpW/HW9m0JZc6IcE=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=oYGTSIZCU9arFXhgfPLFgIXCcXZDwPiA/aKam1zwQnv0gCOcYeQaW8NaFTBoqEfex c1mx6nEvoN5R9IkI+hWv0UosTWYHFzirKgQIAEsGRwaTzSf/Gc5TdkW8LWuZwi0rI2 u7KXj6RgruLNGCmL2gCcVCHVf8cpRkv7dQUlxelmjCKPqoy37FnVaJzSwsP2HUhzIe PM+zI81pboY6u1jCDexr8L9FjBxorcgIlbeiKok1TZK7roWxnnaVpanbv02mURgfZy pzu6wfTlghW3g4G50mDD7PP44ZL3ZytQHlmBSPvuFy6ROTpClmbtnrqrmHR8yB7xsD P9L1JWySm5qmA== From: Christian Brauner To: linux-fsdevel@vger.kernel.org, jack@suse.cz Cc: Christian Brauner , linux-kernel@vger.kernel.org, James Bottomley , mcgrof@kernel.org, hch@infradead.org, david@fromorbit.com, rafael@kernel.org, djwong@kernel.org, pavel@kernel.org, peterz@infradead.org, mingo@redhat.com, will@kernel.org, boqun.feng@gmail.com Subject: [PATCH v2 6/6] super: add filesystem freezing helpers for suspend and hibernate Date: Sat, 29 Mar 2025 09:42:19 +0100 Message-ID: <20250329-work-freeze-v2-6-a47af37ecc3d@kernel.org> X-Mailer: git-send-email 2.47.2 In-Reply-To: <20250329-work-freeze-v2-0-a47af37ecc3d@kernel.org> References: <20250329-work-freeze-v2-0-a47af37ecc3d@kernel.org> Precedence: bulk X-Mailing-List: linux-fsdevel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 X-Mailer: b4 0.15-dev-42535 X-Developer-Signature: v=1; a=openpgp-sha256; l=2519; i=brauner@kernel.org; h=from:subject:message-id; bh=GFcv+iHs3cxAf0PS51ww4sS11+jxpW/HW9m0JZc6IcE=; b=owGbwMvMwCU28Zj0gdSKO4sYT6slMaQ/31S53cT63z6jXa7OYsFqN6eE9d3fYKg1qUPp+F6vq lqzGXZtHaUsDGJcDLJiiiwO7Sbhcst5KjYbZWrAzGFlAhnCwMUpABOJ12H4w2eW+CeLfVfpu2/G iTwC3PU7vmSqyna1MT9jmbfZTvvONUaG+ZqBLht9jz7RbTGffvfb9dS/R/iDLt9of5fTI2yk9mk OAwA= X-Developer-Key: i=brauner@kernel.org; a=openpgp; fpr=4880B8C9BD0E5106FC070F4F7B3C391EFEA93624 Allow the power subsystem to support filesystem freeze for suspend and hibernate. Signed-off-by: Christian Brauner Reviewed-by: Jan Kara --- fs/super.c | 55 ++++++++++++++++++++++++++++++++++++++++++++++++++++++ include/linux/fs.h | 2 ++ 2 files changed, 57 insertions(+) diff --git a/fs/super.c b/fs/super.c index 666a2a16df87..4364b763e91f 100644 --- a/fs/super.c +++ b/fs/super.c @@ -1176,6 +1176,61 @@ void emergency_thaw_all(void) } } +static inline bool get_active_super(struct super_block *sb) +{ + bool active; + + if (super_lock_excl(sb)) { + active = atomic_inc_not_zero(&sb->s_active); + super_unlock_excl(sb); + } + return active; +} + +static void filesystems_freeze_callback(struct super_block *sb, void *unused) +{ + if (!sb->s_op->freeze_fs && !sb->s_op->freeze_super) + return; + + if (!get_active_super(sb)) + return; + + if (sb->s_op->freeze_super) + sb->s_op->freeze_super(sb, FREEZE_MAY_NEST | FREEZE_HOLDER_KERNEL); + else + freeze_super(sb, FREEZE_MAY_NEST | FREEZE_HOLDER_KERNEL); + + deactivate_super(sb); +} + +void filesystems_freeze(bool hibernate) +{ + __iterate_supers(filesystems_freeze_callback, NULL, + SUPER_ITER_UNLOCKED | SUPER_ITER_REVERSE); +} + +static void filesystems_thaw_callback(struct super_block *sb, void *unused) +{ + if (!sb->s_op->freeze_fs && !sb->s_op->freeze_super) + return; + + if (!get_active_super(sb)) + return; + + if (sb->s_op->thaw_super) + sb->s_op->thaw_super(sb, FREEZE_MAY_NEST | FREEZE_HOLDER_KERNEL); + else + thaw_super(sb, FREEZE_MAY_NEST | FREEZE_HOLDER_KERNEL); + + deactivate_super(sb); +} + +void filesystems_thaw(bool hibernate) +{ + __iterate_supers(filesystems_thaw_callback, NULL, + SUPER_ITER_UNLOCKED | SUPER_ITER_REVERSE); +} + static DEFINE_IDA(unnamed_dev_ida); /** diff --git a/include/linux/fs.h b/include/linux/fs.h index c475fa874055..29bd28491eff 100644 --- a/include/linux/fs.h +++ b/include/linux/fs.h @@ -3518,6 +3518,8 @@ extern void drop_super_exclusive(struct super_block *sb); extern void iterate_supers(void (*f)(struct super_block *, void *), void *arg); extern void iterate_supers_type(struct file_system_type *, void (*)(struct super_block *, void *), void *); +void filesystems_freeze(bool hibernate); +void filesystems_thaw(bool hibernate); extern int dcache_dir_open(struct inode *, struct file *); extern int dcache_dir_close(struct inode *, struct file *);