Skip to content

Commit bb504b4

Browse files
Andreas Gruenbacherbrauner
authored andcommitted
lockref: remove count argument of lockref_init
All users of lockref_init() now initialize the count to 1, so hardcode that and remove the count argument. Reviewed-by: Christoph Hellwig <[email protected]> Signed-off-by: Andreas Gruenbacher <[email protected]> Link: https://lore.kernel.org/r/[email protected] Signed-off-by: Christian Brauner <[email protected]>
1 parent 34ad6fa commit bb504b4

File tree

5 files changed

+8
-7
lines changed

5 files changed

+8
-7
lines changed

fs/dcache.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1700,7 +1700,7 @@ static struct dentry *__d_alloc(struct super_block *sb, const struct qstr *name)
17001700
smp_store_release(&dentry->d_name.name, dname); /* ^^^ */
17011701

17021702
dentry->d_flags = 0;
1703-
lockref_init(&dentry->d_lockref, 1);
1703+
lockref_init(&dentry->d_lockref);
17041704
seqcount_spinlock_init(&dentry->d_seq, &dentry->d_lock);
17051705
dentry->d_inode = NULL;
17061706
dentry->d_parent = dentry;

fs/erofs/zdata.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -726,7 +726,7 @@ static int z_erofs_register_pcluster(struct z_erofs_frontend *fe)
726726
if (IS_ERR(pcl))
727727
return PTR_ERR(pcl);
728728

729-
lockref_init(&pcl->lockref, 1); /* one ref for this request */
729+
lockref_init(&pcl->lockref); /* one ref for this request */
730730
pcl->algorithmformat = map->m_algorithmformat;
731731
pcl->length = 0;
732732
pcl->partial = true;

fs/gfs2/glock.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1201,7 +1201,7 @@ int gfs2_glock_get(struct gfs2_sbd *sdp, u64 number,
12011201
if (glops->go_instantiate)
12021202
gl->gl_flags |= BIT(GLF_INSTANTIATE_NEEDED);
12031203
gl->gl_name = name;
1204-
lockref_init(&gl->gl_lockref, 1);
1204+
lockref_init(&gl->gl_lockref);
12051205
lockdep_set_subclass(&gl->gl_lockref.lock, glops->go_subclass);
12061206
gl->gl_state = LM_ST_UNLOCKED;
12071207
gl->gl_target = LM_ST_UNLOCKED;

fs/gfs2/quota.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -236,7 +236,7 @@ static struct gfs2_quota_data *qd_alloc(unsigned hash, struct gfs2_sbd *sdp, str
236236
return NULL;
237237

238238
qd->qd_sbd = sdp;
239-
lockref_init(&qd->qd_lockref, 1);
239+
lockref_init(&qd->qd_lockref);
240240
qd->qd_id = qid;
241241
qd->qd_slot = -1;
242242
INIT_LIST_HEAD(&qd->qd_lru);

include/linux/lockref.h

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -37,12 +37,13 @@ struct lockref {
3737
/**
3838
* lockref_init - Initialize a lockref
3939
* @lockref: pointer to lockref structure
40-
* @count: initial count
40+
*
41+
* Initializes @lockref->count to 1.
4142
*/
42-
static inline void lockref_init(struct lockref *lockref, unsigned int count)
43+
static inline void lockref_init(struct lockref *lockref)
4344
{
4445
spin_lock_init(&lockref->lock);
45-
lockref->count = count;
46+
lockref->count = 1;
4647
}
4748

4849
void lockref_get(struct lockref *lockref);

0 commit comments

Comments
 (0)