Received: by 2002:a05:6358:11c7:b0:104:8066:f915 with SMTP id i7csp1152459rwl; Fri, 24 Mar 2023 07:01:43 -0700 (PDT) X-Google-Smtp-Source: AKy350YWaUvSd+rS5j9UYjigy0Vl7TpvKG3HBzuKNy5CnEJ2/tJ0HMVHOK48IoO8NnLC+04t729Y X-Received: by 2002:a17:906:551:b0:92a:8067:7637 with SMTP id k17-20020a170906055100b0092a80677637mr2360932eja.61.1679666503397; Fri, 24 Mar 2023 07:01:43 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1679666503; cv=none; d=google.com; s=arc-20160816; b=wB82lAiLlc2dAQdo3h3DSWJAkqK1w0kOp3Ad5LG5Kl3JH+eoNlD/eYiFoGbmjmVdlN UAJvISm14n39bFjnAnvclVGam0mLYFcCfeNTiD9uHIhjYG0td+vqC5KooFSWVgKw26Pq p6biMC/TOGX1e6Kqaucak5PIzbTCOTvVmID7gg6w1xLh8VyXIRgoJjCVID4TulFLE2kv o+ycf94+cqj+Q0NvnQJUse/YBVKVYS/zMBx+exAfjidWNdJ6+tyr34/6c03c4UU3c7uf +Ky5jnW7bparGYZTCppP1XQj0dnw8itQJzYbRQL379X11HguS2r+7Wm4/GroQX/xtAmg v+Pw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :references:in-reply-to:message-id:date:subject:cc:to:from :dkim-signature; bh=wz2FGQNTIGH4rfgIOsbrI06KOjBXUtm/DnvsfScX6mQ=; b=hpYKNL9RzEpUqw0dFAoCvY4EyNHVtfti3VsNxaC4lbqbj/m08Czog+yCpv07c+FnG9 uAmO4CiIGlmpxHVDX4DTsniUuT6e5m41DRTEIU4D/TIFKValt+tPOj67hP5W3KsO3YQM BUyTU3DvgYru1Rtwzm73JuJ4o3b9FeD2D6WHYoLUsncwdGRA29QmRkssLy+m7uOB//q9 dgPc3MpaR+XaVX6asxT9k8qRY0y5GTFB6KneHlcOKCCfgCw6z94RVtRsv53tOptbFc3l xwy567pW0widWR6e8hRwoeg0DPhKPvlFiX9liyFpPmIeaT+4h5qREpiq3CQsGktbmUUG 2aYg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@redhat.com header.s=mimecast20190719 header.b=UDgUvIYr; 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 fy24-20020a1709069f1800b0093defbd626dsi2022192ejc.1012.2023.03.24.07.01.17; Fri, 24 Mar 2023 07:01:43 -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=UDgUvIYr; 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 S232039AbjCXOAW (ORCPT + 99 others); Fri, 24 Mar 2023 10:00:22 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:50698 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S232030AbjCXOAF (ORCPT ); Fri, 24 Mar 2023 10:00:05 -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 2AFC31B2C5 for ; Fri, 24 Mar 2023 06:58:54 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1679666333; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=wz2FGQNTIGH4rfgIOsbrI06KOjBXUtm/DnvsfScX6mQ=; b=UDgUvIYr43r3TaKVTiHe4AygYBzSXfY/Qj1X3yc8Mw2+gghkc5o+nAOoQnmdpjGlijpSwn uCiUCXQqcE9EE8gtmC5rhXHtmwe8gZyuQi+E9oD2j8iEtynp3I0aqBzFJ9JllHaCdkjuGR lAeVGSb33bJg7kE43mIpcLlinT5esrk= Received: from mimecast-mx02.redhat.com (mx3-rdu2.redhat.com [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-480-pgonzQZOOe-UOoX2wHsxtg-1; Fri, 24 Mar 2023 09:58:49 -0400 X-MC-Unique: pgonzQZOOe-UOoX2wHsxtg-1 Received: from smtp.corp.redhat.com (int-mx05.intmail.prod.int.rdu2.redhat.com [10.11.54.5]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx02.redhat.com (Postfix) with ESMTPS id 64B322817233; Fri, 24 Mar 2023 13:58:49 +0000 (UTC) Received: from localhost (ovpn-8-20.pek2.redhat.com [10.72.8.20]) by smtp.corp.redhat.com (Postfix) with ESMTP id 8A49D440D6; Fri, 24 Mar 2023 13:58:48 +0000 (UTC) From: Ming Lei To: Jens Axboe , io-uring@vger.kernel.org, linux-block@vger.kernel.org Cc: linux-kernel@vger.kernel.org, Miklos Szeredi , ZiyangZhang , Xiaoguang Wang , Bernd Schubert , Pavel Begunkov , Stefan Hajnoczi , Ming Lei Subject: [PATCH V4 08/17] block: ublk_drv: don't consider flush request in map/unmap io Date: Fri, 24 Mar 2023 21:57:59 +0800 Message-Id: <20230324135808.855245-9-ming.lei@redhat.com> In-Reply-To: <20230324135808.855245-1-ming.lei@redhat.com> References: <20230324135808.855245-1-ming.lei@redhat.com> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Scanned-By: MIMEDefang 3.1 on 10.11.54.5 X-Spam-Status: No, score=-0.2 required=5.0 tests=DKIMWL_WL_HIGH,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_NONE, RCVD_IN_MSPIKE_H2,SPF_HELO_NONE,SPF_NONE 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 There isn't data in request of REQ_OP_FLUSH always, so don't consider it in both ublk_map_io() and ublk_unmap_io(). Reviewed-by: Ziyang Zhang Signed-off-by: Ming Lei --- drivers/block/ublk_drv.c | 10 +++------- 1 file changed, 3 insertions(+), 7 deletions(-) diff --git a/drivers/block/ublk_drv.c b/drivers/block/ublk_drv.c index b8998ed87a0f..4fe324da97a0 100644 --- a/drivers/block/ublk_drv.c +++ b/drivers/block/ublk_drv.c @@ -529,15 +529,13 @@ static int ublk_map_io(const struct ublk_queue *ubq, const struct request *req, struct ublk_io *io) { const unsigned int rq_bytes = blk_rq_bytes(req); + /* * no zero copy, we delay copy WRITE request data into ublksrv * context and the big benefit is that pinning pages in current * context is pretty fast, see ublk_pin_user_pages */ - if (req_op(req) != REQ_OP_WRITE && req_op(req) != REQ_OP_FLUSH) - return rq_bytes; - - if (ublk_rq_has_data(req)) { + if (ublk_rq_has_data(req) && req_op(req) == REQ_OP_WRITE) { struct ublk_map_data data = { .ubq = ubq, .rq = req, @@ -772,9 +770,7 @@ static inline void __ublk_rq_task_work(struct request *req) return; } - if (ublk_need_get_data(ubq) && - (req_op(req) == REQ_OP_WRITE || - req_op(req) == REQ_OP_FLUSH)) { + if (ublk_need_get_data(ubq) && (req_op(req) == REQ_OP_WRITE)) { /* * We have not handled UBLK_IO_NEED_GET_DATA command yet, * so immepdately pass UBLK_IO_RES_NEED_GET_DATA to ublksrv -- 2.39.2