From nobody Mon Jun 8 04:20:00 2026 Received: from mail-106111.protonmail.ch (mail-106111.protonmail.ch [79.135.106.111]) (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 452CF376BF4 for ; Tue, 2 Jun 2026 11:25:18 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=79.135.106.111 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1780399519; cv=none; b=ahGM7iJfwfwdwdV1RFN4DeOo28bbEJKFDpJx8DEKBSUj99P9nvOWNzxOYYl91lss06qkbsR0EApIYGT+d5UAUOTO4qqdoaqlGHcBaJNaXpUfNsojHnTaCrFCnARAHBpaAzBqNrstedVZsA/TW0uNGf9Zg3ZCLQTun3T/rjKMGeE= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1780399519; c=relaxed/simple; bh=2U7LOhtHbcyKAmZ6eeBAVMhUtbgVnFD5Bpo7D9+65uo=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=GsYflXN2syYgPywJrO/oEWzSyNBgSXCUwJ2Pxvt6haPxTCakUHxRHP0eiH6PMIo8YhdY1s/cwzentV6Z93Kusx8tQuBCoYRQ6OkJeyrOYepKVuQ2sMuHln24b0ssuBOLx9ao5k1Ji7sE03WgoUdpeDBF7eikBbM3b0RZVuO2w4I= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=quarantine dis=none) header.from=theesfeld.net; spf=pass smtp.mailfrom=theesfeld.net; dkim=pass (2048-bit key) header.d=theesfeld.net header.i=@theesfeld.net header.b=nf++OdoY; arc=none smtp.client-ip=79.135.106.111 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=quarantine dis=none) header.from=theesfeld.net Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=theesfeld.net Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=theesfeld.net header.i=@theesfeld.net header.b="nf++OdoY" DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=theesfeld.net; s=protonmail2; t=1780399510; x=1780658710; bh=oVSFITDaMDcl8F5hxC/fPH9w/x2e4vNGrwqofJcPWKQ=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References:From:To: Cc:Date:Subject:Reply-To:Feedback-ID:Message-ID:BIMI-Selector; b=nf++OdoYgmrBJGlOqboAAeyuvwSEzGeFOx/3+v+2PYYKn8Ns1lvpOXFWfVI33kJ3O Pwkq0zlW/TwQIKdxAaXctGO84Vgj1QdlYurK7GdELL5a1OS9NvR57MEVlr9vVUnP4i Dksb/5uUM7AOiPdHqrFatWdDYuGYtiG07P/JZs+dvxQ4n33pn34Ho+TdqKn+xVJN8N jHR4MqwHnjL73MUFOMqEqkJ11hzeqwp/oaCP+Y1aXK7rwfb0NB9fZtgMl7ez2JDo77 cVM0USQt6K41aT2cSb5cTKu9w9A6b/Hne2SBm9SZl18o6I4T6JviOEx3cSbGqfgi2H J+/q/izIuQycQ== X-Pm-Submission-Id: 4gV7m52t7Fz2Scpl From: William Theesfeld To: Carlos Maiolino Cc: "Darrick J . Wong" , linux-xfs@vger.kernel.org, linux-kernel@vger.kernel.org Subject: [PATCH v2] xfs: convert dquot iterator map allocation to kmalloc_objs() Date: Tue, 2 Jun 2026 07:25:08 -0400 Message-ID: <20260602112508.25581-1-william@theesfeld.net> X-Mailer: git-send-email 2.54.0 In-Reply-To: <20260601191858.608270-1-william@theesfeld.net> References: <20260601191858.608270-1-william@theesfeld.net> 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 Content-Type: text/plain; charset="utf-8" v1 converted the open-coded kmalloc(N * sizeof(*p), ...) in xfs_qm_reset_dqcounts_buf() to kmalloc_array(). Per review feedback from Carlos Maiolino on the v1 thread, switch instead to the kmalloc_objs() helper, which is the preferred form for new XFS code and matches the style of recent conversions elsewhere in fs/xfs/. While touching this, also drop the __GFP_NOFAIL flag and handle the allocation failure explicitly by returning -ENOMEM. The function already has callers that propagate errors out of quotacheck setup, so an early -ENOMEM is harmless and avoids relying on the allocator to retry forever on memory pressure. No functional change for the success path. Signed-off-by: William Theesfeld --- fs/xfs/xfs_qm.c | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/fs/xfs/xfs_qm.c b/fs/xfs/xfs_qm.c index 7bd15d9e7..83e8d80bc 100644 --- a/fs/xfs/xfs_qm.c +++ b/fs/xfs/xfs_qm.c @@ -1170,8 +1170,9 @@ xfs_qm_reset_dqcounts_buf( if (qip->i_nblocks =3D=3D 0) return 0; =20 - map =3D kmalloc(XFS_DQITER_MAP_SIZE * sizeof(*map), - GFP_KERNEL | __GFP_NOFAIL); + map =3D kmalloc_objs(*map, XFS_DQITER_MAP_SIZE, GFP_KERNEL); + if (!map) + return -ENOMEM; =20 lblkno =3D 0; maxlblkcnt =3D XFS_B_TO_FSB(mp, mp->m_super->s_maxbytes); --=20 2.54.0