Received: by 2002:a05:6358:9144:b0:117:f937:c515 with SMTP id r4csp5233202rwr; Mon, 24 Apr 2023 00:31:52 -0700 (PDT) X-Google-Smtp-Source: AKy350YevNpnbgJraOeUbvH/prOw+3Amo42l3BzXH4Xbo87SA3rIRNm5/LQtBXvSLsfJiTpzuhqh X-Received: by 2002:a05:6a20:8e26:b0:f1:1af5:75fe with SMTP id y38-20020a056a208e2600b000f11af575femr15601327pzj.36.1682321512006; Mon, 24 Apr 2023 00:31:52 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1682321511; cv=none; d=google.com; s=arc-20160816; b=uuqzoy9P/e/jsyH/y9+R6cj5+MqI063a/lrq9IA+yweD/oswd5vMpGuGS2niEBN8/v oQnU6iIHET4MLTk0T7X/WtBztDbn7h0YW4tjjWXiJXrcw8w4FM3BfpOOIC3hoqdrEZzI dm5z3x7my/bKqPBmkXOOSc7RQuV+Kk6BsvgcMVaLZaOlMqN8twvz1dqTOXrjYFRlgVi5 6X2Bc+EjLFWKU4BRzZyuM+z9RpQV3jhf7Es6gTtfduU2OuLHX1yug2NjV/+qv079TbYz U3Z2YEteshmJap0J1dqXIlfB/81SW6AXGekTOwP/ir/BvaW+AeGiVfGeMj6cTbp0BAPA x40A== 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=ugEZXEVJeKw7jPNlfeyvvmafXs6OL7AvKzq+caPRhYs=; b=doSIFLcn4kwQuQlHYGK/CG0vudg2LeUPQGeuohF4qhVoA8VdDpY9sDG/A6qcdYvvI0 Fm7bPNTbMAguUlHRv0opGRTl8pfs+Vq/pWQSsvRbQIcs0A5Isjs+HRRZ1efp0/lQUyI2 EQ+KYExAbHaPwBm1tmfK5Nq+vWDApL6LtIaUo7mwD5YRg+A6pvbhgilmsc5Pvm5HBRNu EVp9yjXqeP1JSInQoAQmZ9VOujGpEgPM8sVV9789HJXZrj4uV9e/N8GDpHLTMWxfFJLK OljnQPz+JTMg0FsuIFcUs6ZnWO2k/UtGLVwXpxwEEIzIclexsWNH/heHxSfme0jx3gnj aE9A== 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 x13-20020aa79acd000000b0063b8a36cbedsi10798646pfp.148.2023.04.24.00.31.38; Mon, 24 Apr 2023 00:31:51 -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 S231290AbjDXHYZ (ORCPT + 99 others); Mon, 24 Apr 2023 03:24:25 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:48074 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S230197AbjDXHYY (ORCPT ); Mon, 24 Apr 2023 03:24:24 -0400 Received: from verein.lst.de (verein.lst.de [213.95.11.211]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 91E86358E; Mon, 24 Apr 2023 00:23:48 -0700 (PDT) Received: by verein.lst.de (Postfix, from userid 2407) id A1FE06732D; Mon, 24 Apr 2023 09:23:39 +0200 (CEST) Date: Mon, 24 Apr 2023 09:23:39 +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 v2 2/3] io_uring: Pass whole sqe to commands Message-ID: <20230424072339.GB13287@lst.de> References: <20230421114440.3343473-1-leitao@debian.org> <20230421114440.3343473-3-leitao@debian.org> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20230421114440.3343473-3-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 Fri, Apr 21, 2023 at 04:44:39AM -0700, Breno Leitao wrote: > - struct ublksrv_io_cmd *ub_cmd = (struct ublksrv_io_cmd *)cmd->cmd; > + struct ublksrv_io_cmd *ub_cmd = (struct ublksrv_io_cmd *)cmd->sqe->cmd; As mentioned in my (late) reply to the previous series, please add a helper like: static inline const void *io_uring_sqe_cmd(struct io_uring_sqe *sqe) { return sqe->cmd; } and then avoid all these casts. > int io_uring_cmd_prep_async(struct io_kiocb *req) > { > struct io_uring_cmd *ioucmd = io_kiocb_to_cmd(req, struct io_uring_cmd); > + size_t size = uring_sqe_size(req->ctx); > > BUILD_BUG_ON(uring_cmd_pdu_size(0) != 16); > BUILD_BUG_ON(uring_cmd_pdu_size(1) != 80); > > + memcpy(req->async_data, ioucmd->sqe, size); > + ioucmd->sqe = req->async_data; This can skip the size local variable now.