From nobody Mon Feb 9 16:17:18 2026 Received: from us-smtp-delivery-124.mimecast.com (us-smtp-delivery-124.mimecast.com [170.10.133.124]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 1973F1E47A8 for ; Thu, 30 Jan 2025 13:56:42 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=170.10.133.124 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1738245403; cv=none; b=d8d4XJe9ADyATJM3WNgcBQ1ET4ojmm1Kc3ZQhSuJLFUa9j7nrqWyqXhZTyWVWG2UWlG7fSh0JayK5/os++PqYePrOTsa69/kDvEN2NbTYb3tnJwsqFnFPEMLmolh83tKEoTVlw3kwjSXfnuBi6g0e1KZ8KJwfDKPPz5zQ4pu/bU= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1738245403; c=relaxed/simple; bh=ABeeGijHKMXjIrnt6RCeYxaj4h1KX0LYF/z/4aC5cww=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=lABTkd0kbc4yV5zxQ1Sr73gryyMBGxaNRrNTgokod8jAb3gcDuV6JMzo70MDJgd4IIIy+qWI2Sgb86Dk8ryxj8bacx+sLWxOv3PwdCuideQb21d+zlB2OEMJH40KMrgdLxfUnVtTJI/DjWm372IhFmyvPepUc6ESMsmg/zg/aIc= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=redhat.com; spf=pass smtp.mailfrom=redhat.com; dkim=pass (1024-bit key) header.d=redhat.com header.i=@redhat.com header.b=F5kuYCv/; arc=none smtp.client-ip=170.10.133.124 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=redhat.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=redhat.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=redhat.com header.i=@redhat.com header.b="F5kuYCv/" DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1738245401; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=brc+2qpv6u8MpYg1/dCpf83rKYH1pTRJqq8pdAOzE2k=; b=F5kuYCv/z16CH21TZuKoE1ELqkZLbVjXBE0JIu85p5vd0wFpDChEgrhprZeWQfsJgmihM7 6k0lugSkH4epIm8/I1d6KH7IV0/sKb4vr68wF/m+gYl7QZqe255m4vx+WVY7wCI1dI2RDK iVIvD9JdZv8JJP8p58iAbGhjYSAxxXA= Received: from mx-prod-mc-01.mail-002.prod.us-west-2.aws.redhat.com (ec2-54-186-198-63.us-west-2.compute.amazonaws.com [54.186.198.63]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.3, cipher=TLS_AES_256_GCM_SHA384) id us-mta-356-4rzd7El_Nniw8Fw7qr9X5g-1; Thu, 30 Jan 2025 08:56:38 -0500 X-MC-Unique: 4rzd7El_Nniw8Fw7qr9X5g-1 X-Mimecast-MFC-AGG-ID: 4rzd7El_Nniw8Fw7qr9X5g Received: from mx-prod-int-06.mail-002.prod.us-west-2.aws.redhat.com (mx-prod-int-06.mail-002.prod.us-west-2.aws.redhat.com [10.30.177.93]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (2048 bits) server-digest SHA256) (No client certificate requested) by mx-prod-mc-01.mail-002.prod.us-west-2.aws.redhat.com (Postfix) with ESMTPS id ADD8419560B7; Thu, 30 Jan 2025 13:56:36 +0000 (UTC) Received: from pasta.fast.eng.rdu2.dc.redhat.com (unknown [10.45.224.234]) by mx-prod-int-06.mail-002.prod.us-west-2.aws.redhat.com (Postfix) with ESMTP id 374D318008D8; Thu, 30 Jan 2025 13:56:33 +0000 (UTC) From: Andreas Gruenbacher To: Christian Brauner Cc: Andreas Gruenbacher , Christoph Hellwig , gfs2@lists.linux.dev, linux-fsdevel@vger.kernel.org, linux-kernel@vger.kernel.org Subject: [PATCH v2 3/3] lockref: remove count argument of lockref_init Date: Thu, 30 Jan 2025 14:56:23 +0100 Message-ID: <20250130135624.1899988-4-agruenba@redhat.com> In-Reply-To: <20250130135624.1899988-1-agruenba@redhat.com> References: <20250130135624.1899988-1-agruenba@redhat.com> Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable X-Scanned-By: MIMEDefang 3.4.1 on 10.30.177.93 Content-Type: text/plain; charset="utf-8" All users of lockref_init() now initialize the count to 1, so hardcode that and remove the count argument. Reviewed-by: Christoph Hellwig Signed-off-by: Andreas Gruenbacher --- fs/dcache.c | 2 +- fs/erofs/zdata.c | 2 +- fs/gfs2/glock.c | 2 +- fs/gfs2/quota.c | 2 +- include/linux/lockref.h | 7 ++++--- 5 files changed, 8 insertions(+), 7 deletions(-) diff --git a/fs/dcache.c b/fs/dcache.c index 1a01d7a6a7a9..973a66dd3adf 100644 --- a/fs/dcache.c +++ b/fs/dcache.c @@ -1682,7 +1682,7 @@ static struct dentry *__d_alloc(struct super_block *s= b, const struct qstr *name) smp_store_release(&dentry->d_name.name, dname); /* ^^^ */ =20 dentry->d_flags =3D 0; - lockref_init(&dentry->d_lockref, 1); + lockref_init(&dentry->d_lockref); seqcount_spinlock_init(&dentry->d_seq, &dentry->d_lock); dentry->d_inode =3D NULL; dentry->d_parent =3D dentry; diff --git a/fs/erofs/zdata.c b/fs/erofs/zdata.c index 254f6ad2c336..85a08230d7c2 100644 --- a/fs/erofs/zdata.c +++ b/fs/erofs/zdata.c @@ -747,7 +747,7 @@ static int z_erofs_register_pcluster(struct z_erofs_dec= ompress_frontend *fe) if (IS_ERR(pcl)) return PTR_ERR(pcl); =20 - lockref_init(&pcl->lockref, 1); /* one ref for this request */ + lockref_init(&pcl->lockref); /* one ref for this request */ pcl->algorithmformat =3D map->m_algorithmformat; pcl->length =3D 0; pcl->partial =3D true; diff --git a/fs/gfs2/glock.c b/fs/gfs2/glock.c index b29eb71e3e29..65c07aa95718 100644 --- a/fs/gfs2/glock.c +++ b/fs/gfs2/glock.c @@ -1201,7 +1201,7 @@ int gfs2_glock_get(struct gfs2_sbd *sdp, u64 number, if (glops->go_instantiate) gl->gl_flags |=3D BIT(GLF_INSTANTIATE_NEEDED); gl->gl_name =3D name; - lockref_init(&gl->gl_lockref, 1); + lockref_init(&gl->gl_lockref); lockdep_set_subclass(&gl->gl_lockref.lock, glops->go_subclass); gl->gl_state =3D LM_ST_UNLOCKED; gl->gl_target =3D LM_ST_UNLOCKED; diff --git a/fs/gfs2/quota.c b/fs/gfs2/quota.c index 6ae529a5388b..2298e06797ac 100644 --- a/fs/gfs2/quota.c +++ b/fs/gfs2/quota.c @@ -236,7 +236,7 @@ static struct gfs2_quota_data *qd_alloc(unsigned hash, = struct gfs2_sbd *sdp, str return NULL; =20 qd->qd_sbd =3D sdp; - lockref_init(&qd->qd_lockref, 1); + lockref_init(&qd->qd_lockref); qd->qd_id =3D qid; qd->qd_slot =3D -1; INIT_LIST_HEAD(&qd->qd_lru); diff --git a/include/linux/lockref.h b/include/linux/lockref.h index c39f119659ba..676721ee878d 100644 --- a/include/linux/lockref.h +++ b/include/linux/lockref.h @@ -37,12 +37,13 @@ struct lockref { /** * lockref_init - Initialize a lockref * @lockref: pointer to lockref structure - * @count: initial count + * + * Initializes @lockref->count to 1. */ -static inline void lockref_init(struct lockref *lockref, unsigned int coun= t) +static inline void lockref_init(struct lockref *lockref) { spin_lock_init(&lockref->lock); - lockref->count =3D count; + lockref->count =3D 1; } =20 void lockref_get(struct lockref *lockref); --=20 2.48.1