sget_dev(9)
β¨ sget_dev(9) β¨
okay so this page lives in the Kernel API Manual, and it's gonna teach you how to find or create a superblock by device number. yes bestie, the superblock. the main character of your filesystem. let's go π
πΈ NAME πΈ
sget_dev β find or create a superblock by device number
π SYNOPSIS π
struct super_block *sget_dev (struct fs_context *fc , dev_t dev );
π¦ ARGUMENTS π¦
fcβ filesystem context. yes, the whole context, she's coming with you.devβ device number
π DESCRIPTION π
okay so the vibe here: sget_dev finds or creates a superblock using the provided device number, and that device number gets stored in fc->sget_key. iykyk π
if an extant superblock is matched, then that one gets returned β but heads up, it comes back with an elevated reference count, and the caller must transfer or discard it. that ref is yours now, bestie, you have to deal with it π
if no match is made, a brand new superblock gets allocated and basic initialisation is performed β specifically s_type, s_fs_info, s_id and s_dev will be set. then the superblock gets published and returned in a partially constructed state, with SB_BORN and SB_ACTIVE as yet unset. so likeβ¦ she's out there, but she's not fully her yet. not me describing a half-born superblock π
π₯ RETURN π₯
an existing or newly created superblock on success, an error pointer on failure. that's it, that's the whole return section. slay.
π SEE ALSO π
all of these live in the kernel file ./fs/super.c, and yes, we're listing every single one because we're thorough like that π«Ά
super_lock(9)alloc_super(9)deactivate_locked_super(9)deactivate_super(9)grab_super(9)retire_super(9)generic_shutdown_super(9)sget_fc(9)iterate_supers_type(9)reconfigure_super(9)emergency_thaw_all(9)get_anon_bdev(9)fs_bdev_freeze(9)fs_bdev_thaw(9)fs_bdev_file_open_by_dev(9)fs_bdev_file_open_by_path(9)fs_bdev_unregister(9)fs_bdev_file_release(9)get_tree_bdev_flags(9)get_tree_bdev(9)vfs_get_tree(9)sb_wait_write(9)freeze_super(9)thaw_super(9)
and that's the page π this one came from ./fs, it's part of the Kernel API Manual, and it's dated October 2026 β so go forth, manage your superblocks, and remember: elevated refcounts are a lifestyle, not a suggestion. periodt. πβ
π¦ where this page comes from
- nixpkgs unstable: linux-manual 7.3.1
- π girlified by deepseek-ai/DeepSeek-V4.1-Flash-1017 on : a language model's rewrite of the original, under its terms