Function report

Linux Kernel

v5.5.9

Brick Technologies Co., Ltd

Source Code:fs\quota\dquot.c Create Date:2022-07-28 20:32:52
Last Modify:2020-03-12 14:18:49 Copyright©Brick
home page Tree
Annotation kernel can get tool activityDownload SCCTChinese

Name:Get reference to dquot* Locking is slightly tricky here. We are guarded from parallel quotaoff()* destroying our dquot by:* a) checking for quota flags under dq_list_lock and* b) getting a reference to dquot before we release dq_list_lock

Proto:struct dquot *dqget(struct super_block *sb, struct kqid qid)

Type:struct dquot

Parameter:

TypeParameterName
struct super_block *sb
struct kqidqid
848  hashent = hashfn(sb, qid)
849  struct dquot * dquot, * empty = NULL
851  If Not qid_has_mapping - Report if a qid maps into a user namespace.*@ns: The user namespace to see if a value maps into.*@qid: The kernel internal quota identifier to test. Then Return ERR_PTR( - EINVAL)
854  If Not sb_has_quota_active(sb, USRQUOTA (uid) or GRPQUOTA (gid) or PRJQUOTA (projid) ) Then Return ERR_PTR( - ESRCH)
856  we_slept :
857  spin_lock( & There are five quota SMP locks:* * dq_list_lock protects all lists with quotas and quota formats)
858  spin_lock( & dq_state_lock)
859  If Not sb_has_quota_active(sb, USRQUOTA (uid) or GRPQUOTA (gid) or PRJQUOTA (projid) ) Then
860  spin_unlock( & dq_state_lock)
861  spin_unlock( & There are five quota SMP locks:* * dq_list_lock protects all lists with quotas and quota formats)
862  dquot = ERR_PTR( - ESRCH)
863  Go to out
865  spin_unlock( & dq_state_lock)
867  dquot = find_dquot(hashent, sb, qid)
868  If Not dquot Then
869  If Not empty Then
872  If Not empty Then schedule()
874  Go to we_slept
876  dquot = empty
877  empty = NULL
878  ID this applies to (uid, gid, projid) = qid
880  put_inuse(dquot)
882  Following list functions expect dq_list_lock to be held
883  spin_unlock( & There are five quota SMP locks:* * dq_list_lock protects all lists with quotas and quota formats)
884  dqstats_inc(DQST_LOOKUPS)
885  Else
886  If Not atomic_read( & Use count ) Then remove_free_dquot(dquot)
888  atomic_inc( & Use count )
889  spin_unlock( & There are five quota SMP locks:* * dq_list_lock protects all lists with quotas and quota formats)
890  dqstats_inc(DQST_CACHE_HITS)
891  dqstats_inc(DQST_LOOKUPS)
895  End of list functions needing dq_list_lock
897  If Not st_bit - Determine whether a bit is set*@nr: bit number to test*@addr: Address to start counting from Then
900  err = acquire_dquot(dquot)
901  If err < 0 Then
903  dquot = ERR_PTR(err)
904  Go to out
911  smp_rmb()
915  out :
916  If empty Then do_destroy_dquot(empty)
919  Return dquot
Caller
NameDescribe
__dquot_initialize
dquot_transferWrapper for transferring ownership of an inode for uid/gid only* Called from FSXXX_setattr()
dquot_get_dqblk
dquot_get_next_dqblk
dquot_set_dqblk