From patchwork Wed Sep 4 14:18:01 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Pavel Begunkov X-Patchwork-Id: 13790932 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from kanga.kvack.org (kanga.kvack.org [205.233.56.17]) by smtp.lore.kernel.org (Postfix) with ESMTP id CEC14CD484A for ; Wed, 4 Sep 2024 14:17:50 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id 6243F8D0258; Wed, 4 Sep 2024 10:17:50 -0400 (EDT) Received: by kanga.kvack.org (Postfix, from userid 40) id 5866F8D0253; Wed, 4 Sep 2024 10:17:50 -0400 (EDT) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id 400A18D0258; Wed, 4 Sep 2024 10:17:50 -0400 (EDT) X-Delivered-To: linux-mm@kvack.org Received: from relay.hostedemail.com (smtprelay0015.hostedemail.com [216.40.44.15]) by kanga.kvack.org (Postfix) with ESMTP id 1E26B8D0253 for ; Wed, 4 Sep 2024 10:17:50 -0400 (EDT) Received: from smtpin18.hostedemail.com (a10.router.float.18 [10.200.18.1]) by unirelay09.hostedemail.com (Postfix) with ESMTP id BDA5D815CC for ; Wed, 4 Sep 2024 14:17:49 +0000 (UTC) X-FDA: 82527259458.18.FBD9EC6 Received: from mail-ej1-f50.google.com (mail-ej1-f50.google.com [209.85.218.50]) by imf24.hostedemail.com (Postfix) with ESMTP id C74B9180004 for ; Wed, 4 Sep 2024 14:17:47 +0000 (UTC) Authentication-Results: imf24.hostedemail.com; dkim=pass header.d=gmail.com header.s=20230601 header.b=A0tc6jLy; spf=pass (imf24.hostedemail.com: domain of asml.silence@gmail.com designates 209.85.218.50 as permitted sender) smtp.mailfrom=asml.silence@gmail.com; dmarc=pass (policy=none) header.from=gmail.com ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=hostedemail.com; s=arc-20220608; t=1725459371; h=from:from:sender:reply-to:subject:subject:date:date: message-id:message-id:to:to:cc:cc:mime-version:mime-version: content-type:content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references:dkim-signature; bh=yyZRXxiAI12SAMIbkwT8bn9l7S8e/TKEaLOeKBVDL1c=; b=0C3cPvtqnOq44CFLnblCHAjTMfsstoShyAQFIXZSatWvUahinkP4YMZUJ/vBrd8SzDXKnr weJRn4oDOz3YH/f4RkhbZ76Y3cbsjPTd8ny//iIzqNkmjwsfb+UMSkce5Uxkuuu7ekt5Lz FFljKGZ+7oMaI2OJ3SkaqPKQD3Kzmc4= ARC-Seal: i=1; s=arc-20220608; d=hostedemail.com; t=1725459371; a=rsa-sha256; cv=none; b=m5tnl6o6eGyt5kDfNJXoK+SYfaLsqXTgYL9Ddz4rSH0WBn+bkoUr8/0SawydmgHMlMzWMo qIrEmWM0aMqy1nE3gvWCn1P5+AJE/NCkhWvbTsTiJzg2mhMtXp57st077+Okl6Sbf8CItl Zr0sGj4jnFDVE68tBkQnAoZNashvcP4= ARC-Authentication-Results: i=1; imf24.hostedemail.com; dkim=pass header.d=gmail.com header.s=20230601 header.b=A0tc6jLy; spf=pass (imf24.hostedemail.com: domain of asml.silence@gmail.com designates 209.85.218.50 as permitted sender) smtp.mailfrom=asml.silence@gmail.com; dmarc=pass (policy=none) header.from=gmail.com Received: by mail-ej1-f50.google.com with SMTP id a640c23a62f3a-a86883231b4so814828466b.3 for ; Wed, 04 Sep 2024 07:17:47 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1725459466; x=1726064266; darn=kvack.org; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to; bh=yyZRXxiAI12SAMIbkwT8bn9l7S8e/TKEaLOeKBVDL1c=; b=A0tc6jLycDvUOeJh1sNbEEZFb/Y091x2EtanpqXU5PMMqhH3zRRiE4rtLWtOgZG3hX uKGBEZRnYIiEwu9UZN6T7h1FJzfo4XuINl4DbXJAm/dI52YzmJhCJaq0dlUDkp38yNNi OFx6oqmg6c2wTiBNxH+1jBNLeX8k0H5sf7X1BmkfkP+724wbHsaCVahcGokg7bTlKFW9 kgMK36EZrz3RwiuD6Hu1FdjlpDlS7om7a+tQhEq9/pdRaIth55zTJBe89tbfL1xs+tHv v1dbKavVup9WKOhH0ITZ0IdUDEDPOc1j99b1VEiqt4ZcvLSAKGwhc1emtrLAt0UEyLoZ UYDg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1725459466; x=1726064266; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=yyZRXxiAI12SAMIbkwT8bn9l7S8e/TKEaLOeKBVDL1c=; b=pzIRWcdp0jzq0T7NnmXkcz9I93JYaVJUQ+Yyg3SNpd7I36jUD8f1xLSpKi86H3n0Uy 6R5MoAEWChDQCrrcQH16vuas4PJqzeX6kg91jtSuYRdPWWPkGowG7zvFx38Bo1LMU8lH saP6Sv3k7j5QATSs8HvyOsuGy3yjBp2e0gvNrCNxsRUM9iFNjejyqgDBxsdZlEnyKEor +q5D/olASyyHL0pw6umxKyNCHabXPr7FXtkgLBTRt+FweYo/aFB6Ow4PzamCGrwUoF8u fkztdo+fKkNbXULJyF0od8PQVyoi8PvGhbJKXseRzpqEgcROxenCxvyHrN8cts3wAKkD mEJA== X-Forwarded-Encrypted: i=1; AJvYcCUmrg5l1vh6yDb8DCHZaCP99/iMMRlJ6JFtYdUvgdq9UNEzfPeMAvClNrda/aRClfjO0b5eD0r+Sw==@kvack.org X-Gm-Message-State: AOJu0YwrHhgi4nvUDzlz9bioBAt6Ur0W9MoD85mKk4sbUDxEfqP9fz/Z Y1Gk32s8veqsc5+doWOXDNv16yedordlTzXzXmZQQg3qGpnFrCmrf+47bg== X-Google-Smtp-Source: AGHT+IElud/tGXrs7q4hPENcWMYIZSj7RTtRqWMNx0QoFf5mcRK9CPIkT2ZU7thyj+ZNDXYdgCuEaw== X-Received: by 2002:a17:907:a07:b0:a7d:e84c:a9e7 with SMTP id a640c23a62f3a-a89d8848bd3mr1056922166b.53.1725459466090; Wed, 04 Sep 2024 07:17:46 -0700 (PDT) Received: from 127.0.0.1localhost ([163.114.131.193]) by smtp.gmail.com with ESMTPSA id a640c23a62f3a-a8989196c88sm811160766b.102.2024.09.04.07.17.42 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 04 Sep 2024 07:17:43 -0700 (PDT) From: Pavel Begunkov To: io-uring@vger.kernel.org Cc: Jens Axboe , asml.silence@gmail.com, Conrad Meyer , linux-block@vger.kernel.org, linux-mm@kvack.org, Christoph Hellwig Subject: [PATCH v3 2/8] io_uring/cmd: give inline space in request to cmds Date: Wed, 4 Sep 2024 15:18:01 +0100 Message-ID: <7ca779a61ee5e166e535d70df9c7f07b15d8a0ce.1725459175.git.asml.silence@gmail.com> X-Mailer: git-send-email 2.45.2 In-Reply-To: References: MIME-Version: 1.0 X-Stat-Signature: y9k1mgfg8g8r9hnz4gzz1tj43xt44hgw X-Rspamd-Queue-Id: C74B9180004 X-Rspam-User: X-Rspamd-Server: rspam08 X-HE-Tag: 1725459467-375975 X-HE-Meta: U2FsdGVkX1+uFxnhDeod5t/OG2OB18qwOdjams+83bD089KW8rEee7kwJCuzTrLwIc+omuYdT+rm5gNXCnbOzqp60SIvpiMjNYhpu7ZWaQ7bi8cDNc7cd79Xls0+ozrYYvHtM5rJ12UhLMwEz4LgSxCU8ezw7tad8dWFWc/jybGzsvLdoXnTEtHxxhY49zs5yCPupFDhsk270kkvu7EX3Xb0+9Vo+jRl72XUCxto/stl+vaVLh/sDB0WImAgGgiP3Bg+vdEMHGgXjQXL91WVhG2iPvyBnD5UjJ1/6tL1dkTSWwxLc0KYPga1RqVDvKzo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bdGwA683fl/Siv7+CqxuP/tJw/bxKBpwHeHY00+xfojb881jFiaCJxr6amMT2epV+dcI/rFS4bWWaNlglVryx/d6zbhv2w0994eS/QpuABcmZ4= X-Bogosity: Ham, tests=bogofilter, spamicity=0.000011, version=1.2.4 Sender: owner-linux-mm@kvack.org Precedence: bulk X-Loop: owner-majordomo@kvack.org List-ID: List-Subscribe: List-Unsubscribe: Some io_uring commands can use some inline space in io_kiocb. We have 32 bytes in struct io_uring_cmd, expose it. Signed-off-by: Pavel Begunkov --- include/linux/io_uring/cmd.h | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/include/linux/io_uring/cmd.h b/include/linux/io_uring/cmd.h index 86ceb3383e49..c189d36ad55e 100644 --- a/include/linux/io_uring/cmd.h +++ b/include/linux/io_uring/cmd.h @@ -23,6 +23,15 @@ static inline const void *io_uring_sqe_cmd(const struct io_uring_sqe *sqe) return sqe->cmd; } +static inline void io_uring_cmd_private_sz_check(size_t cmd_sz) +{ + BUILD_BUG_ON(cmd_sz > sizeof_field(struct io_uring_cmd, pdu)); +} +#define io_uring_cmd_to_pdu(cmd, pdu_type) ( \ + io_uring_cmd_private_sz_check(sizeof(pdu_type)), \ + ((pdu_type *)&(cmd)->pdu) \ +) + #if defined(CONFIG_IO_URING) int io_uring_cmd_import_fixed(u64 ubuf, unsigned long len, int rw, struct iov_iter *iter, void *ioucmd);