sget_fc(9)
π
sget_fc β the sget_fc(9) glow-up
okay so bestie, we're in the Kernel API Manual today and the star of the show is sget_fc. she finds superblocks, she makes superblocks, she's literally the main character of mounting. let's get into it π¦
β¨ NAME β¨
sget_fc β find a superblock or create one, whichever hits first π«
πΈ SYNOPSIS πΈ
struct super_block * sget_fc (struct fs_context *fc , int (*test)(struct
super_block *, struct fs_context *) , int (*set)(struct super_block *,
struct fs_context *) );
like literally that's the whole signature, no notes π
π ARGUMENTS π
fcβ the filesystem context. think of her as the vibe brief for what we're trying to mount πtestβ the comparison callback. she's the one going "hm, do u match?" πsetβ the setup callback. she does the actual decorating once we've got a fresh superblock β¨
π DESCRIPTION π
okay so the whole job here is: create a new superblock or find an existing one. that's it. that's the errand π«Ά
the test callback is what we use to hunt down a matching existing superblock. now here's the tea β whether the requested parameters in fc even get taken into account is specific to whichever test callback you're using. some of them care. some of them... don't. they may even be completely ignored. no cap, it's giving "we'll see" π
if an extant superblock does get matched, she gets returned β unless:
- the namespace of the filesystem context
fcand the extant superblock's namespace differ - the filesystem context
fchas requested that reusing an extant superblock is not allowed
and in both of those cases, you get EBUSY back. that's the boundary, periodt π₯
if no match is made? then we build. a brand new superblock gets allocated and basic initialisation gets performed β s_type, s_fs_info and s_id will be set, and the set callback will be invoked. then the superblock gets published and returned to you in a partially constructed state, with SB_BORN and SB_ACTIVE as yet unset π like she's out in the world but she's not fully her yet, yk? π¦
bestie please clock that "partially constructed" line β she's published but not born, not active. that's not a bug, that's the whole design. respect it π
β RETURN β
on success: an extant or newly created superblock. slay π on failure: an error pointer. not slay π
π SEE ALSO π
kernel file ./fs/super.c and honestly the whole friend group:
super_lock(9)alloc_super(9)deactivate_locked_super(9)deactivate_super(9)grab_super(9)retire_super(9)generic_shutdown_super(9)iterate_supers_type(9)reconfigure_super(9)emergency_thaw_all(9)get_anon_bdev(9)sget_dev(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)
mwah π this lil page lives in ./fs, stamped October 2026 β go read the source bestie, it's giving iconic πβ¨
π¦ 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