From: Christoph Hellwig <hch@lst.de>
To: Andrew Morton <akpm@linux-foundation.org>
Cc: Miquel Raynal <miquel.raynal@bootlin.com>,
Richard Weinberger <richard@nod.at>,
Vignesh Raghavendra <vigneshr@ti.com>, Jan Kara <jack@suse.cz>,
linux-mtd@lists.infradead.org, linux-fsdevel@vger.kernel.org,
linux-mm@kvack.org
Subject: [PATCH 3/5] fs: explicitly unregister per-superblock BDIs
Date: Thu, 21 Oct 2021 14:44:39 +0200 [thread overview]
Message-ID: <20211021124441.668816-4-hch@lst.de> (raw)
In-Reply-To: <20211021124441.668816-1-hch@lst.de>
Add a new SB_I_ flag to mark superblocks that have an ephemeral bdi
associated with them, an unregister it when the superblock is shut down.
Signed-off-by: Christoph Hellwig <hch@lst.de>
---
fs/super.c | 3 +++
include/linux/fs.h | 1 +
2 files changed, 4 insertions(+)
diff --git a/fs/super.c b/fs/super.c
index bcef3a6f4c4b5..3bfc0f8fbd5bc 100644
--- a/fs/super.c
+++ b/fs/super.c
@@ -476,6 +476,8 @@ void generic_shutdown_super(struct super_block *sb)
spin_unlock(&sb_lock);
up_write(&sb->s_umount);
if (sb->s_bdi != &noop_backing_dev_info) {
+ if (sb->s_iflags & SB_I_PERSB_BDI)
+ bdi_unregister(sb->s_bdi);
bdi_put(sb->s_bdi);
sb->s_bdi = &noop_backing_dev_info;
}
@@ -1562,6 +1564,7 @@ int super_setup_bdi_name(struct super_block *sb, char *fmt, ...)
}
WARN_ON(sb->s_bdi != &noop_backing_dev_info);
sb->s_bdi = bdi;
+ sb->s_iflags |= SB_I_PERSB_BDI;
return 0;
}
diff --git a/include/linux/fs.h b/include/linux/fs.h
index e7a633353fd20..226de651f52e6 100644
--- a/include/linux/fs.h
+++ b/include/linux/fs.h
@@ -1443,6 +1443,7 @@ extern int send_sigurg(struct fown_struct *fown);
#define SB_I_UNTRUSTED_MOUNTER 0x00000040
#define SB_I_SKIP_SYNC 0x00000100 /* Skip superblock at global sync */
+#define SB_I_PERSB_BDI 0x00000200 /* has a per-sb bdi */
/* Possible states of 'frozen' field */
enum {
--
2.30.2
next prev parent reply other threads:[~2021-10-21 12:45 UTC|newest]
Thread overview: 13+ messages / expand[flat|nested] mbox.gz Atom feed top
2021-10-21 12:44 simplify bdi unregistation Christoph Hellwig
2021-10-21 12:44 ` [PATCH 1/5] mm: export bdi_unregister Christoph Hellwig
2021-10-22 8:41 ` Jan Kara
2021-10-21 12:44 ` [PATCH 2/5] mtd: call bdi_unregister explicitly Christoph Hellwig
2021-10-22 8:43 ` Jan Kara
2021-10-21 12:44 ` Christoph Hellwig [this message]
2021-10-22 8:48 ` [PATCH 3/5] fs: explicitly unregister per-superblock BDIs Jan Kara
2021-10-21 12:44 ` [PATCH 4/5] mm: don't automatically unregister bdis Christoph Hellwig
2021-10-22 8:51 ` Jan Kara
2021-10-21 12:44 ` [PATCH 5/5] mm: simplify bdi refcounting Christoph Hellwig
2021-10-22 9:02 ` Jan Kara
2021-10-27 7:42 ` Christoph Hellwig
2021-10-27 9:47 ` Jan Kara
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20211021124441.668816-4-hch@lst.de \
--to=hch@lst.de \
--cc=akpm@linux-foundation.org \
--cc=jack@suse.cz \
--cc=linux-fsdevel@vger.kernel.org \
--cc=linux-mm@kvack.org \
--cc=linux-mtd@lists.infradead.org \
--cc=miquel.raynal@bootlin.com \
--cc=richard@nod.at \
--cc=vigneshr@ti.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).