Function report

Linux Kernel

v5.5.9

Brick Technologies Co., Ltd

Source Code:fs\super.c Create Date:2022-07-28 20:02:26
Last Modify:2022-05-24 06:42:17 Copyright©Brick
home page Tree
Annotation kernel can get tool activityDownload SCCTChinese

Name:find or create a superblock

Proto:struct super_block *sget(struct file_system_type *type, int (*test)(struct super_block *, void *), int (*set)(struct super_block *, void *), int flags, void *data)

Type:struct super_block

Parameter:

TypeParameterName
struct file_system_type *type
int (*test
int (*set
intflags
void *data
582  user_ns = current_user_ns()
583  struct super_block * s = NULL
591  If flags & These sb flags are internal to the kernel Then user_ns = userns count is 1 for root user, 1 for init_uts_ns,* and 1 for... ?
594  retry :
595  spin_lock( & sb_lock)
596  If test Then
598  If Not test(old, data) Then Continue
600  If user_ns != s_user_ns Then
601  spin_unlock( & sb_lock)
603  Return ERR_PTR( - EBUSY)
605  If Not grab_super - acquire an active reference*@s: reference we are trying to make active* Tries to acquire an active reference. grab_super() is used when we* had just found a superblock in super_blocks or fs_type->fs_supers Then Go to retry
607  Free a superblock that has never been seen by anyone
608  Return old
611  If Not s Then
612  spin_unlock( & sb_lock)
613  s = alloc_super - create new superblock*@type: filesystem type superblock should belong to*@flags: the mount flags*@user_ns: User namespace for the super_block* Allocates and initializes a new &struct super_block. alloc_super()
614  If Not s Then Return ERR_PTR( - ENOMEM)
616  Go to retry
619  err = set(s, data)
620  If err Then
621  spin_unlock( & sb_lock)
622  Free a superblock that has never been seen by anyone
623  Return ERR_PTR(err)
625  s_type = type
626  Copy a NUL terminated string into a sized buffer
627  list_add_tail - add a new entry*@new: new entry to be added*@head: list head to add it before* Insert a new entry before the specified head.* This is useful for implementing queues.
628  hlist_add_head( & s_instances, & fs_supers)
629  spin_unlock( & sb_lock)
630  get_filesystem(type)
631  register_shrinker_prepared( & s_shrink)
632  Return s
Caller
NameDescribe
mount_bdev
mount_nodev
mount_single