From nobody Fri Oct 3 10:11:21 2025 Received: from mail-yb1-f226.google.com (mail-yb1-f226.google.com [209.85.219.226]) (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 0675A219A8E for ; Tue, 2 Sep 2025 16:07:01 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.219.226 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1756829223; cv=none; b=FxKP3MVyXuRB2jOhMe0JRvlhH9UHXj9uUGCfN0if6JP5QW9JdbWgUqntnnIqlznOCMbTwsRFkrO3aW/yB4LfTXZgqNuwmGC9/5bEKi5yAkBYqnYZblouaXaSDvdNgbNqQbvrOYNTgGbLkWjit5bkWRrYWX0LDBYNJHOqRJd2rK8= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1756829223; c=relaxed/simple; bh=oscotWeu2ofDRZ2I7B+ST50R3lMq/oklG8FOxuKuJzw=; h=From:To:Cc:Subject:Date:Message-ID:MIME-Version; b=fC2Rc7ooksNkqZtTIDNQAvQbqye4cBzNCCyZOiSNREWJrHDYfY8MMRG1hSI1mnAQtKiAtqqsoeHut8zarFMfa1VWQWBoKG0oB3M8xBc3LRaSJql1aRaPe8thoTTLPI0ZxoSQMT9RMcGAvQiWMisWsItHMrcqxNQbvhaiHQ0fQhs= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=reject dis=none) header.from=purestorage.com; spf=fail smtp.mailfrom=purestorage.com; dkim=pass (2048-bit key) header.d=purestorage.com header.i=@purestorage.com header.b=ORBapOli; arc=none smtp.client-ip=209.85.219.226 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=reject dis=none) header.from=purestorage.com Authentication-Results: smtp.subspace.kernel.org; spf=fail smtp.mailfrom=purestorage.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=purestorage.com header.i=@purestorage.com header.b="ORBapOli" Received: by mail-yb1-f226.google.com with SMTP id 3f1490d57ef6-e973f268b07so730270276.1 for ; Tue, 02 Sep 2025 09:07:01 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=purestorage.com; s=google2022; t=1756829221; x=1757434021; 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=RlJrQ5tmWGYzBhNWJHSwFwCHVK4G1iWt6SUsZakgOpw=; b=ORBapOli6/6JhTr2x9gqyDu9E5YWMhdLqsDfJG8Z4QUMslowi/Ce2a5P0jRX1Jo2Sd VESAeNi0/DKlSUM7eh9s8rO6cxuYN1sHAUOQBxq0NIvdZKhbKkjOKCxjEbrasRQDRCYA vL88jlzinCMwYwmWTIx8cUJDz5fDZ3pfQz4CZ4QMMJfpH3HrX5fRErRZpUtm00hrNx0y 0oO6UeRsVQK1ewgzY8mmH2mTwaTbPIZvP2WUOnsEEsmqltqTZIAXZnqXq0yw8Yg7FZdd WiF1/9iLu8Sl2sFEGu3k2jSW6yt7v86DpU1yePnvaIKN6tnBzkQRqrCbGmmCIGfAIPdn YZsQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1756829221; x=1757434021; h=content-transfer-encoding:mime-version:message-id:date:subject:cc :to:from:x-gm-message-state:from:to:cc:subject:date:message-id :reply-to; bh=RlJrQ5tmWGYzBhNWJHSwFwCHVK4G1iWt6SUsZakgOpw=; b=vR0NGM4Y4B8vQ15FksFuCUaUFbhdEb6K7ktSxuUuup37QOIyBsV48fehbB51WkehAV 0T79iTMYoWH/hbh82cN+htuEGSSsm4o0FJOnWwDrdWYrZncybGbKIihjeSGx7FLrbb+l hRqwYu0KcX3f2k00ZDBKBSwxTiLkwKMpX15ob5VYLF5tAkkKKFWAoXC3/+sfaJH0kLHe WZOmRuCcnQ3G60vhCLYrhxDrxbazd7ea1DY1/C7Wd3hrZhpsNYxjf9HWFeDgi6pTBAUY prFFlm9vGs3kIEC2kfG8N7mOjhpcLjhmzQPgD+wZqV4Mli6Ox0mQmonAobLwXLyebRqU R1vg== X-Forwarded-Encrypted: i=1; AJvYcCVBCZqa2rbdPNi5WgBZhmM5v3GDtqVsyL0Rozn0WMbe7IgV28RPTNQaF+7I8ZC6HHodeaMXbeJUS6arS0Q=@vger.kernel.org X-Gm-Message-State: AOJu0Ywo/hjJ/PijXp21nASIFSNWmFa4u3ZF+hThNTJ3orRPBT7IkC+T WBAfGblQWH5ueq8tHdsDkpoipQDVZrOJrqsgErut6t3E9enac6u6r19qeYle4XOiHmSW1tvdkas 3V4q+oLQJCiMR1N1K3+UOQpRDg/Udx+k26ATiIuaMpg1BN7l/C0Pz X-Gm-Gg: ASbGncsR9k/OZ/2bV5IEU0m6ChvVogbPgLT+q2VVbK97fTru3RkmUC1cmsfyixFZ+UC QPLWFSS860xOoxsRVnvZWd26ve0bJGV3lndhgmd3kHJt+4KKQzpt2bqRCY9gEBYyesr5mNbuGH1 Gp9OyBL3XIkuK9KxevgyLi9N5ImS6AgJP4A4EGwojHzzjydf7CD1uM5sAfiyzxhrR+v7XB9W6EJ kTTuQ1JLhs+BK+u8h5WwvhNOlr3fisMKl3qDHClQTvTmJoudp94AkjTY0luVFInCaw9mrn6owDI sYbG61ac+7j/WSJnj8tj+6+f9ptZ3o9AgFbrhBW3B/K3JBXIrmSsTQdhvw== X-Google-Smtp-Source: AGHT+IGehGKy1s/4ECGVhm6Ytshrk21h/CKWiX53aH303nut6igUt+bsRoA2rH9L1NNTY357MPkA4BL/eq2s X-Received: by 2002:a05:6902:1148:b0:e97:604c:ce6f with SMTP id 3f1490d57ef6-e989be98834mr8924297276.1.1756829220457; Tue, 02 Sep 2025 09:07:00 -0700 (PDT) Received: from c7-smtp-2023.dev.purestorage.com ([2620:125:9017:12:36:3:5:0]) by smtp-relay.gmail.com with ESMTPS id 3f1490d57ef6-e9bbe1a9f19sm171338276.17.2025.09.02.09.07.00 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 02 Sep 2025 09:07:00 -0700 (PDT) X-Relaying-Domain: purestorage.com Received: from dev-csander.dev.purestorage.com (dev-csander.dev.purestorage.com [10.7.70.37]) by c7-smtp-2023.dev.purestorage.com (Postfix) with ESMTP id CD706340214; Tue, 2 Sep 2025 10:06:58 -0600 (MDT) Received: by dev-csander.dev.purestorage.com (Postfix, from userid 1557716354) id C92A7E415E2; Tue, 2 Sep 2025 10:06:58 -0600 (MDT) From: Caleb Sander Mateos To: Jens Axboe Cc: Caleb Sander Mateos , io-uring@vger.kernel.org, linux-kernel@vger.kernel.org Subject: [PATCH] io_uring/uring_cmd: add io_uring_cmd_tw_t type alias Date: Tue, 2 Sep 2025 10:06:56 -0600 Message-ID: <20250902160657.1726828-1-csander@purestorage.com> X-Mailer: git-send-email 2.45.2 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" Introduce a function pointer type alias io_uring_cmd_tw_t for the uring_cmd task work callback. This avoids repeating the signature in several places. Also name both arguments to the callback to clarify what they represent. Signed-off-by: Caleb Sander Mateos Reported-by for you, thanks for catching that! Reviewed-by: Keith Busch --- include/linux/io_uring/cmd.h | 13 ++++++++----- io_uring/uring_cmd.c | 2 +- 2 files changed, 9 insertions(+), 6 deletions(-) diff --git a/include/linux/io_uring/cmd.h b/include/linux/io_uring/cmd.h index 4bd3a7339243..7211157edfe9 100644 --- a/include/linux/io_uring/cmd.h +++ b/include/linux/io_uring/cmd.h @@ -9,15 +9,18 @@ /* only top 8 bits of sqe->uring_cmd_flags for kernel internal use */ #define IORING_URING_CMD_CANCELABLE (1U << 30) /* io_uring_cmd is being issued again */ #define IORING_URING_CMD_REISSUE (1U << 31) =20 +typedef void (*io_uring_cmd_tw_t)(struct io_uring_cmd *cmd, + unsigned issue_flags); + struct io_uring_cmd { struct file *file; const struct io_uring_sqe *sqe; /* callback to defer completions to task context */ - void (*task_work_cb)(struct io_uring_cmd *cmd, unsigned); + io_uring_cmd_tw_t task_work_cb; u32 cmd_op; u32 flags; u8 pdu[32]; /* available inline for free use */ }; =20 @@ -55,11 +58,11 @@ int io_uring_cmd_import_fixed_vec(struct io_uring_cmd *= ioucmd, */ void io_uring_cmd_done(struct io_uring_cmd *cmd, ssize_t ret, u64 res2, unsigned issue_flags); =20 void __io_uring_cmd_do_in_task(struct io_uring_cmd *ioucmd, - void (*task_work_cb)(struct io_uring_cmd *, unsigned), + io_uring_cmd_tw_t task_work_cb, unsigned flags); =20 /* * Note: the caller should never hard code @issue_flags and only use the * mask provided by the core io_uring code. @@ -104,11 +107,11 @@ static inline int io_uring_cmd_import_fixed_vec(struc= t io_uring_cmd *ioucmd, static inline void io_uring_cmd_done(struct io_uring_cmd *cmd, ssize_t ret, u64 ret2, unsigned issue_flags) { } static inline void __io_uring_cmd_do_in_task(struct io_uring_cmd *ioucmd, - void (*task_work_cb)(struct io_uring_cmd *, unsigned), + io_uring_tw_t task_work_cb, unsigned flags) { } static inline void io_uring_cmd_mark_cancelable(struct io_uring_cmd *cmd, unsigned int issue_flags) @@ -141,17 +144,17 @@ static inline void io_uring_cmd_iopoll_done(struct io= _uring_cmd *ioucmd, io_uring_cmd_done(ioucmd, ret, res2, 0); } =20 /* users must follow the IOU_F_TWQ_LAZY_WAKE semantics */ static inline void io_uring_cmd_do_in_task_lazy(struct io_uring_cmd *ioucm= d, - void (*task_work_cb)(struct io_uring_cmd *, unsigned)) + io_uring_cmd_tw_t task_work_cb) { __io_uring_cmd_do_in_task(ioucmd, task_work_cb, IOU_F_TWQ_LAZY_WAKE); } =20 static inline void io_uring_cmd_complete_in_task(struct io_uring_cmd *iouc= md, - void (*task_work_cb)(struct io_uring_cmd *, unsigned)) + io_uring_cmd_tw_t task_work_cb) { __io_uring_cmd_do_in_task(ioucmd, task_work_cb, 0); } =20 static inline struct task_struct *io_uring_cmd_get_task(struct io_uring_cm= d *cmd) diff --git a/io_uring/uring_cmd.c b/io_uring/uring_cmd.c index f5a2642bb407..d76d6d27765c 100644 --- a/io_uring/uring_cmd.c +++ b/io_uring/uring_cmd.c @@ -124,11 +124,11 @@ static void io_uring_cmd_work(struct io_kiocb *req, i= o_tw_token_t tw) /* task_work executor checks the deffered list completion */ ioucmd->task_work_cb(ioucmd, flags); } =20 void __io_uring_cmd_do_in_task(struct io_uring_cmd *ioucmd, - void (*task_work_cb)(struct io_uring_cmd *, unsigned), + io_uring_cmd_tw_t task_work_cb, unsigned flags) { struct io_kiocb *req =3D cmd_to_io_kiocb(ioucmd); =20 if (WARN_ON_ONCE(req->flags & REQ_F_APOLL_MULTISHOT)) --=20 2.45.2