From nobody Mon May 25 04:33:47 2026 Received: from mail-qk1-f179.google.com (mail-qk1-f179.google.com [209.85.222.179]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 32F6D230BD9 for ; Tue, 19 May 2026 00:51:10 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.222.179 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1779151871; cv=none; b=gQaUNCotf/HmYW8iaVgFAga6m0AjQ93n0z1Bo+PD8wqu2T+L1qUCLxKk2ZwaWPW9HPxu143E0gT0EcW8E2XXvUf16aORw95+NA6F1RluRVtb5qV6dDFhtKenD1bCdUPbGu8r+ixTn8OVaOoJbBJcFySQjUDsXfONu3mPpXZxBLU= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1779151871; c=relaxed/simple; bh=zrbqW5qZ2/PrHRg2tdBFNqFHr7UVkVZdqxEzk/0Ztn8=; h=From:To:Cc:Subject:Date:Message-ID:MIME-Version; b=M+qgNj5MBvxBk3QU9njuwBYyM5UrNaBPSmQV0ze61VZpMtsOiOTSMviaTCwcEyJNyTQJtGgx+Ewi8kDw+36FXNUSFVgnp/m8WMCHt/lqGPrx+arnb0BKW3zEZcylUI68GncDiTovgdxs67n7u/pP8NS+Quup5g68kzPmsVN0BHU= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=gmail.com; spf=pass smtp.mailfrom=gmail.com; dkim=pass (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b=UVZO8MTb; arc=none smtp.client-ip=209.85.222.179 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=gmail.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=gmail.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b="UVZO8MTb" Received: by mail-qk1-f179.google.com with SMTP id af79cd13be357-90fbf21d9d3so549026285a.1 for ; Mon, 18 May 2026 17:51:10 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20251104; t=1779151869; x=1779756669; darn=vger.kernel.org; h=content-transfer-encoding:mime-version:message-id:date:subject:cc :to:from:from:to:cc:subject:date:message-id:reply-to; bh=HnqrgYL3NmUNTzmNXdPdscQGE6zaGHL6C9Nt0N58KNM=; b=UVZO8MTbTYLoCi+BrJ/UyYC8FzI5Ks6g8NZhO39QApCnibKcOULunCNbQljHqyRmqM 8eV55j0mBoCKGoOMBUi1Ck2fu0/vl5QNrJDu02E12XIGyP9Zd7CRQ2FImvo+vp+Yp1cg DVP6T3ydqBOiUIbN0qs3WTgpsZgZNiYsbC5nHVbXLr5FmilfxKeiEz6TaTufupScZKDO A8aG3rk4EQoMHqhcRQpckVnOj89tkjc50NrdV5W9u1O3AF/Sw5CnKu1z9txNRFj0hhwv jrp/vcA9DoU1ozZlRQ1X696CuC5yoXEPpA3poicdQ8VTf5V781wrq+Nz8R4+dWvMUHcm vPjg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20251104; t=1779151869; x=1779756669; h=content-transfer-encoding:mime-version:message-id:date:subject:cc :to:from:x-gm-gg:x-gm-message-state:from:to:cc:subject:date :message-id:reply-to; bh=HnqrgYL3NmUNTzmNXdPdscQGE6zaGHL6C9Nt0N58KNM=; b=CLw5LJCQ5Y+1otvU0HN9sDZDO2QCYK1fM8ANuDnSMroPP8NfulJea6ZPEPHj8CZ24V 5U8WWFB1NbdNF3Xeu0t5qD6hn1gJP9pFDHBFInD8s1et4r5d7qyrAzKZ1ao7NMZxIAMR CYq6Ztzsiol2pBKinLU4Y+flakSJoJsyH5T6zJNOuG9SdYFXGUB1yLQ2jXLvYu4FYIwN 2P5vfZRZeo4fY6MCSzlQ+OdTn7eB1Nbgh0nbeSSrh4yYzj0t1da7lqTAuyoLli5/SaV0 CvSUKluUlKa5444+Yt8+TdUHIguqwBzRlCe+ao/UvfB8Vt+/E4lHChcO2krh//BOyDMG 0NPQ== X-Forwarded-Encrypted: i=1; AFNElJ9ugVGPDgbRRLLmXwHs8WQqYFlZK7B3NfELK5sdG+Zuml6mIk0P9lJ+/S0uSJgu2OyaSUkQDNLt9GFUoQ4=@vger.kernel.org X-Gm-Message-State: AOJu0YwFR1tgRnV82/0ZTkTYMloIfnOOmQOu414Ypity8TQh2ohRuuML 2bqGuhzBqlfXeVvBhpzNtnTdpe9cZa7h2a0SjzLtPUMm5fbabu60TGji X-Gm-Gg: Acq92OFogOusYJq3llL8ZoJalACDWfuBFu/B4HtJgkQHom0pCxtrA2uWHxikyZpXmAx a3uUkfCn01PTJQn7Z9yDjYrf9Jev+EfCa3/wBGdcR93IsigZtwg3MlFuvf9as7P/INbiyGb879U 2JWP+Ouh2qI8MfPqUfvqz9e8RBmRBlQoiEMM1Dl4N6u8nyo8vev+k1msmwEu9/q/+aa6VAM5phi PrmETnLtGNWh0jKlDe7PVI9TJQqKVhutyoHkSJsVXMX+rQl2iMDwiv2p365UGEabRseLfpgVtqI 24IpstfGB2TcV9LRg5A23Ae+wWMt0tOmNGxJQi8+LVadGFXI1Lbh1NJHugelXWQsZpS4nqirbzc MjoQU2kDXZx34nnTQEFSj4ufGyKs2eq+IX51BX/xpnsd1M60131VYS1GmaEXeoe3pEJWQWXNyg7 8bDll9rS2yqj17PIN8Su/YGpVtqlJ5zBOJlmTCvwp/csdmUQ85cO5JwxNEc95F4AgsYKZB0qaR3 2S/lJ9X9leO1xUL4uxa2ECSE7uZpKtk+wo= X-Received: by 2002:a05:622a:aa08:10b0:509:44c3:5fe7 with SMTP id d75a77b69052e-5165a1e652emr183515141cf.46.1779151868643; Mon, 18 May 2026 17:51:08 -0700 (PDT) Received: from ryzen ([2601:644:8000:5b5d:7285:c2ff:fe45:8a32]) by smtp.gmail.com with ESMTPSA id d75a77b69052e-516457da48dsm147102541cf.17.2026.05.18.17.51.07 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 18 May 2026 17:51:08 -0700 (PDT) From: Rosen Penev To: linux-scsi@vger.kernel.org Cc: "Martin K. Petersen" , target-devel@vger.kernel.org (open list:SCSI TARGET SUBSYSTEM), linux-kernel@vger.kernel.org (open list) Subject: [PATCH] target: iblock: Use flexible array for per-CPU plugs Date: Mon, 18 May 2026 17:50:50 -0700 Message-ID: <20260519005050.627926-1-rosenp@gmail.com> X-Mailer: git-send-email 2.54.0 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" Store the per-CPU iblock plug array in the iblock_dev allocation instead of allocating it separately. This keeps the plug storage tied to the iblock device lifetime and simplifies the allocation and RCU cleanup paths. Assisted-by: Codex:GPT-5.5 Signed-off-by: Rosen Penev --- drivers/target/target_core_iblock.c | 11 +---------- drivers/target/target_core_iblock.h | 2 +- 2 files changed, 2 insertions(+), 11 deletions(-) diff --git a/drivers/target/target_core_iblock.c b/drivers/target/target_co= re_iblock.c index 1087d1d17c36..985197f0df26 100644 --- a/drivers/target/target_core_iblock.c +++ b/drivers/target/target_core_iblock.c @@ -59,24 +59,16 @@ static struct se_device *iblock_alloc_device(struct se_= hba *hba, const char *nam { struct iblock_dev *ib_dev =3D NULL; =20 - ib_dev =3D kzalloc_obj(struct iblock_dev); + ib_dev =3D kzalloc_flex(*ib_dev, ibd_plug, nr_cpu_ids); if (!ib_dev) { pr_err("Unable to allocate struct iblock_dev\n"); return NULL; } ib_dev->ibd_exclusive =3D true; =20 - ib_dev->ibd_plug =3D kzalloc_objs(*ib_dev->ibd_plug, nr_cpu_ids); - if (!ib_dev->ibd_plug) - goto free_dev; - pr_debug( "IBLOCK: Allocated ib_dev for %s\n", name); =20 return &ib_dev->dev; - -free_dev: - kfree(ib_dev); - return NULL; } =20 static bool iblock_configure_unmap(struct se_device *dev) @@ -189,7 +181,6 @@ static void iblock_dev_call_rcu(struct rcu_head *p) struct se_device *dev =3D container_of(p, struct se_device, rcu_head); struct iblock_dev *ib_dev =3D IBLOCK_DEV(dev); =20 - kfree(ib_dev->ibd_plug); kfree(ib_dev); } =20 diff --git a/drivers/target/target_core_iblock.h b/drivers/target/target_co= re_iblock.h index e2f28a69a11c..849c948368bc 100644 --- a/drivers/target/target_core_iblock.h +++ b/drivers/target/target_core_iblock.h @@ -35,7 +35,7 @@ struct iblock_dev { struct file *ibd_bdev_file; bool ibd_readonly; bool ibd_exclusive; - struct iblock_dev_plug *ibd_plug; + struct iblock_dev_plug ibd_plug[]; } ____cacheline_aligned; =20 #endif /* TARGET_CORE_IBLOCK_H */ --=20 2.54.0