Received: by 2002:a05:6358:700f:b0:131:369:b2a3 with SMTP id 15csp1640060rwo; Wed, 2 Aug 2023 18:39:55 -0700 (PDT) X-Google-Smtp-Source: APBJJlGCC2L0VC0d1OYu/RreAlRWgO0kkNOoREh2IICjWq4TaAoxhXHsQvke0uUFkye2TlV3xeJg X-Received: by 2002:a50:ed91:0:b0:522:30cc:a1f4 with SMTP id h17-20020a50ed91000000b0052230cca1f4mr7033106edr.0.1691026795340; Wed, 02 Aug 2023 18:39:55 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1691026795; cv=none; d=google.com; s=arc-20160816; b=zn7VzRQdC4Ux9bXXWRHam/JDONE4xPxue0HiGxlnWkv3xSypQy+2KtEGatfzjqg7vF msDW8HKio92K4wp1mwTx4rCCjM0gbfrhRPvigtgLN5JR3TXlXxR70/bkwtDMxkfD+gOK aY+80guqcg8wpDE1Xuq19zupjzkljC6g1XBAS4aZVMydpVg8SrfKkji6fawCGkjFELof iGI6TDVZcT+1mVT6SJtsflEBnw81Dxln0HCiFQ/dTgapoBccBdkjJAgc61c1raY2y9ai 7hWqkanFZk6eJFcXsbGfp3fV9ESaDkggHFVorVOkqGw/FAC0T1uF+9B/MGqPZUskNFuN U6OQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:in-reply-to:content-disposition:mime-version :references:message-id:subject:cc:to:from:date:dkim-signature; bh=E4JlhFPikF+sSc4TfuvT2iSqBvcIXhfFcOmWT8+LXOA=; fh=QxrdSkj9gn6lksYV7icI6Q7m+zGHOz+VNQC7otFdUeU=; b=eWmntk9yKXNI6i7FbkVfg10clTIgSyKhPghKBypHF1Qsr8MA/2LUaiGjgNyf94/Ey0 Utwj3d70ae4uvKnNz1vyv+xTAHIYP8SgooS12kdI1LHQvLwKpGgnX/W7+OuyxA3yZOTD M1i7xhTUTT1Zm7sVTg1lUbsS9c5lyGEn0+nTgyoFwZGMnX0rf7Vl1xe/tgnL8R3WZEkQ D3YWDdvjchCj2izcJ/5Qv31SaI4zWVI76T8NNBe+SGZBI0IevYk0H/9mQNUdENsYzcO0 zh/km8Rqt4zVNwP43GYx6xvL6YNM+cXLQKvme8ivl4z4eaA5OXpQDCj8b6QkeRETPE2U JxsQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@redhat.com header.s=mimecast20190719 header.b="Phs/Px0s"; 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; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=redhat.com Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id d20-20020a50fb14000000b00522ba3c7f50si5174740edq.631.2023.08.02.18.39.31; Wed, 02 Aug 2023 18:39:55 -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; dkim=pass header.i=@redhat.com header.s=mimecast20190719 header.b="Phs/Px0s"; 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; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=redhat.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S230205AbjHCAIG (ORCPT + 99 others); Wed, 2 Aug 2023 20:08:06 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:53836 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S233471AbjHCAHj (ORCPT ); Wed, 2 Aug 2023 20:07:39 -0400 Received: from us-smtp-delivery-124.mimecast.com (us-smtp-delivery-124.mimecast.com [170.10.133.124]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 7562E30FD for ; Wed, 2 Aug 2023 17:06:31 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1691021190; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: in-reply-to:in-reply-to:references:references; bh=E4JlhFPikF+sSc4TfuvT2iSqBvcIXhfFcOmWT8+LXOA=; b=Phs/Px0stJCrHap5f7DXY6XJyTB6L+SlcR96PbFC2twx8/g4g8KjjED73AdfcsHdv9PkNc Dzo6QFk1EMh+IpGjsYqbfpNVHZvydTi+hEGql3WRfoFjcrme6K2nQsNZ8B5/9R9vZ4v8iQ aG3vsVsW26m+z+Fdo8IvYWVm0DnAbCI= Received: from mimecast-mx02.redhat.com (66.187.233.73 [66.187.233.73]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id us-mta-30-y-ZaeKMtPM2ckAmg_G7-VA-1; Wed, 02 Aug 2023 20:06:25 -0400 X-MC-Unique: y-ZaeKMtPM2ckAmg_G7-VA-1 Received: from smtp.corp.redhat.com (int-mx03.intmail.prod.int.rdu2.redhat.com [10.11.54.3]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx02.redhat.com (Postfix) with ESMTPS id A16441C0782A; Thu, 3 Aug 2023 00:06:24 +0000 (UTC) Received: from fedora (unknown [10.72.120.3]) by smtp.corp.redhat.com (Postfix) with ESMTPS id 86EBC112132D; Thu, 3 Aug 2023 00:06:06 +0000 (UTC) Date: Thu, 3 Aug 2023 08:06:00 +0800 From: Ming Lei To: "Andreas Hindborg (Samsung)" Cc: Niklas Cassel , Matias =?iso-8859-1?Q?Bj=F8rling?= , open list , Damien Le Moal , Jens Axboe , "gost.dev@samsung.com" , "hch@infradead.org" , Johannes Thumshirn , Aravind Ramesh , "open list:BLOCK LAYER" , Hans Holmberg , Minwoo Im Subject: Re: [PATCH v9 2/2] ublk: enable zoned storage support Message-ID: References: <20230714072510.47770-1-nmi@metaspace.dk> <20230714072510.47770-3-nmi@metaspace.dk> <87il9zot9c.fsf@metaspace.dk> <87a5v9pzx7.fsf@metaspace.dk> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <87a5v9pzx7.fsf@metaspace.dk> X-Scanned-By: MIMEDefang 3.1 on 10.11.54.3 X-Spam-Status: No, score=-2.1 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_NONE, RCVD_IN_MSPIKE_H4,RCVD_IN_MSPIKE_WL,SPF_HELO_NONE,SPF_NONE, T_SCC_BODY_TEXT_LINE autolearn=unavailable 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, Aug 02, 2023 at 11:09:56AM +0200, Andreas Hindborg (Samsung) wrote: > > Ming Lei writes: > > > On Tue, Aug 01, 2023 at 02:11:56PM +0200, Andreas Hindborg (Samsung) wrote: > >> > >> Niklas Cassel writes: > >> > >> > On Fri, Jul 14, 2023 at 09:25:10AM +0200, Andreas Hindborg wrote: > >> >> From: Andreas Hindborg > >> > > >> > Hello Andreas! > >> > > >> > >> > >> > >> >> /* for READ request, writing data in iod->addr to rq buffers */ > >> >> @@ -1120,6 +1404,11 @@ static void ublk_commit_completion(struct ublk_device *ub, > >> >> /* find the io request and complete */ > >> >> req = blk_mq_tag_to_rq(ub->tag_set.tags[qid], tag); > >> >> > >> >> + if (io->flags & UBLK_IO_FLAG_ZONE_APPEND) { > >> > > >> > Do we really need to introduce a completely new flag just for this? > >> > > >> > if (req_op(req) == REQ_OP_ZONE_APPEND) > >> > > >> > should work just as well, no? > >> > >> Makes sense, thanks. > > > > The above one can be replaced with req_op(). > > > > But extra cost is added when retrieving request for the check in > > __ublk_ch_uring_cmd(). > > > > How about this (diff to v9): > > @@ -1709,7 +1702,7 @@ static int __ublk_ch_uring_cmd(struct io_uring_cmd *cmd, > goto out; > > if (ublk_support_user_copy(ubq) && > - !(io->flags & UBLK_IO_FLAG_ZONE_APPEND) && ub_cmd->addr) { > + _IOC_NR(cmd_op) != UBLK_IO_COMMIT_AND_FETCH_REQ && ub_cmd->addr) { > ret = -EINVAL; > goto out; > } Let's merge the above original user_copy check into 'case UBLK_IO_FETCH_REQ' & 'case UBLK_IO_COMMIT_AND_FETCH_REQ' first, then this patch can be cleaner, which can be done as one prep change for zoned support. > @@ -1751,6 +1744,12 @@ static int __ublk_ch_uring_cmd(struct io_uring_cmd *cmd, > if (!(io->flags & UBLK_IO_FLAG_OWNED_BY_SRV)) > goto out; > > + if (ublk_support_user_copy(ubq) && > + req_op(req) != REQ_OP_ZONE_APPEND && ub_cmd->addr) { > + ret = -EINVAL; > + goto out; > + } > + Given request is available for UBLK_IO_COMMIT_AND_FETCH_REQ, this approach is good, and UBLK_IO_FETCH_REQ cmd doesn't have OP. Thanks, Ming