Received: by 2002:a05:6358:9144:b0:117:f937:c515 with SMTP id r4csp266668rwr; Wed, 19 Apr 2023 22:03:31 -0700 (PDT) X-Google-Smtp-Source: AKy350YTYDJw3HRefjXCVZYLHoQlp0pMovnB1Zb5o03mHBJJ2SwXj46KgFSpSu1r7pGgBns80hjJ X-Received: by 2002:a05:6a00:cd2:b0:63b:67d5:be9c with SMTP id b18-20020a056a000cd200b0063b67d5be9cmr7181918pfv.29.1681967010782; Wed, 19 Apr 2023 22:03:30 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1681967010; cv=none; d=google.com; s=arc-20160816; b=jleveSwQop2pMtgFi2ChM5Jj40QZws/yY21Oz9N+41PfV32jDo7dgH2RP89wnjtQv/ c/u8jqlRPsQahz1qFJZOMUJQ04A080joXo6oGbPZBce7PhcuV2iIAdL/JlLNXPMkSMiz ESatlfdbZ4SC2CahUehmyPxUiRkhckT0GzcQVyU1EleJOeZaG3s48eEQN1cP63SkwAIE a8MVd0oMszPwaAfFl10KdL5AjL91xfRSImiLuR05rphGh7bto3wtwwZstsw4WXeiLY8H fQU0GfM0DCiiqfXuhf10jPWcl1DXc6LccjSGFAf1rMJu9GZo56zbpsHZE4DELGWsLZNt VKAQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:user-agent:in-reply-to:content-disposition :mime-version:references:message-id:subject:cc:to:from:date; bh=rDMLBUCtyPG8PVh78F4dhl5RPOXrDhzH/tEUEyC0Qd8=; b=CcnWNdoVp4YvqFgyDFkE8WFPEZvp9V6zGfTbHdbmT5ukx/a/AE691+BmbzKGbd0JmC tXMJfcaVmJvQ3OTxS6Uj9PrqnrD7nDKN9oo8Pawb5CCaJMiUv6rIopyLQnA5UFFP/jBt Me1/cMoTIRh9ruKLaH6f6AnssMWBn8xtWe9gXc6O3921NBFoIRkGSI6jWSWWrvpcpJKw Jnv+ty5f/XUcDo1JlZKivfu4HLd0TdFxBPkW4Q80+SrnSNOn27iTWWg9IGGbaeD07cMk VcLK+wrEGL74Po6cROmasd3zQbGJsosiCy2whYbacKE8WiLCi/AsV1Dh2ojRR2SU3Jz+ Xn6A== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id b186-20020a62cfc3000000b0063788e7589dsi632718pfg.95.2023.04.19.22.03.19; Wed, 19 Apr 2023 22:03:30 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S233609AbjDTE5U (ORCPT + 99 others); Thu, 20 Apr 2023 00:57:20 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:59160 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S230102AbjDTE5S (ORCPT ); Thu, 20 Apr 2023 00:57:18 -0400 Received: from verein.lst.de (verein.lst.de [213.95.11.211]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 6CC9346AA; Wed, 19 Apr 2023 21:57:17 -0700 (PDT) Received: by verein.lst.de (Postfix, from userid 2407) id 85E8E68AFE; Thu, 20 Apr 2023 06:57:12 +0200 (CEST) Date: Thu, 20 Apr 2023 06:57:12 +0200 From: Christoph Hellwig To: Breno Leitao Cc: io-uring@vger.kernel.org, linux-nvme@lists.infradead.org, asml.silence@gmail.com, axboe@kernel.dk, leit@fb.com, linux-kernel@vger.kernel.org, linux-block@vger.kernel.org, sagi@grimberg.me, hch@lst.de, kbusch@kernel.org, ming.lei@redhat.com Subject: Re: [PATCH 1/2] io_uring: Pass whole sqe to commands Message-ID: <20230420045712.GA4239@lst.de> References: <20230419102930.2979231-1-leitao@debian.org> <20230419102930.2979231-2-leitao@debian.org> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20230419102930.2979231-2-leitao@debian.org> User-Agent: Mutt/1.5.17 (2007-11-01) X-Spam-Status: No, score=-1.9 required=5.0 tests=BAYES_00,SPF_HELO_NONE, SPF_NONE,T_SCC_BODY_TEXT_LINE autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Wed, Apr 19, 2023 at 03:29:29AM -0700, Breno Leitao wrote: > struct nvme_uring_cmd_pdu *pdu = nvme_uring_cmd_pdu(ioucmd); > - const struct nvme_uring_cmd *cmd = ioucmd->cmd; > + const struct nvme_uring_cmd *cmd = (struct nvme_uring_cmd *)ioucmd->sqe->cmd; Please don't add the pointless cast. And in general avoid the overly long lines. I suspect most other users should just also defined their structures const instead of adding all theses casts thare are a sign of problems, but that's a pre-existing issue. > struct io_uring_cmd *ioucmd = io_kiocb_to_cmd(req, struct io_uring_cmd); > - size_t cmd_size; > + size_t size = sizeof(struct io_uring_sqe); > > BUILD_BUG_ON(uring_cmd_pdu_size(0) != 16); > BUILD_BUG_ON(uring_cmd_pdu_size(1) != 80); > > - cmd_size = uring_cmd_pdu_size(req->ctx->flags & IORING_SETUP_SQE128); > + if (req->ctx->flags & IORING_SETUP_SQE128) > + size <<= 1; Why does this stop using uring_cmd_pdu_size()?