Received: by 2002:a05:6358:11c7:b0:104:8066:f915 with SMTP id i7csp4561372rwl; Tue, 28 Mar 2023 08:25:05 -0700 (PDT) X-Google-Smtp-Source: AKy350amaSaR9J2tf0Lr+Hfv497JiXlCkjHqji2NvycK5T5B8kzDelCxmrkQVfBQWeuUxNYV5okr X-Received: by 2002:a17:907:c606:b0:946:c1d2:8b5d with SMTP id ud6-20020a170907c60600b00946c1d28b5dmr2988926ejc.17.1680017104815; Tue, 28 Mar 2023 08:25:04 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1680017104; cv=none; d=google.com; s=arc-20160816; b=qcua6wjWDbPRuhBaAAvwpW4XcBK6qdLGFgt1UGsqkLrdW8ZJ0xlMI5x2RzajHFgOH2 EHLcbvWTEOokPXHKzRyl8Ar4u1CtNH5JjLdnhyzmwlxDkR15ZjP/0P5jnGUW5Ei8NiSi siStEM9CVR+fGhT4kDsZzz0Ncw7iY3Xy4hoSWp28rcW3Jgs4rcUBFfujN0uBeJpc6iXd zGySdauhZH1GQJeuZN1Dz3NHHciDRTgSmYc1MUeDv5jzmM1C2ADZgaSxtIEDgC8VR+oL w5M8sC6AmYkrPPUWosFAIMkwtyJ6aXKJk2xuCkDTI+AU0ymhAO4v1qMpaTlXhn3L8r8S eLfQ== 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=s89n5MVHIm/yrA8YFK9Xcfzas4VQ/6rU7DsLdSVa7Sk=; b=JXzt+R6Fzk3JNBz4Iw71JA34ADgaoUK00HayoI0wa4i3v1NDK7vrZFvY/oh7y3u2nB FizdzGH9YXOTiII7g270G2oBanskuiQjDsvqvHoJGiQzFwJamqHrejc5clF6uayloFRy r7jwdsvgSwD9wi7eZg63xmxe5ugkHClhDRDAx4gjo3EaNmtFDzEcqbjW0q0P0oIw1a+1 QNHpCO7GUzMV+DBjZPu+YUSDVspNytkm6TLEfAedNKVe5AFfKP5B3oM0Tcg6b4WhQlEz MV01UZ6hwZJ84/+t94eOSJtMPux/PshTBa5hlHLy7SOoWPZfHylFWpntxXQNebDIU3Tn I9oQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@redhat.com header.s=mimecast20190719 header.b=R+hLP4oO; 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 h8-20020a1709063b4800b0093001429138si25070661ejf.13.2023.03.28.08.24.39; Tue, 28 Mar 2023 08:25:04 -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=R+hLP4oO; 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 S232977AbjC1PSK (ORCPT + 99 others); Tue, 28 Mar 2023 11:18:10 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:53504 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S233978AbjC1PRk (ORCPT ); Tue, 28 Mar 2023 11:17:40 -0400 Received: from us-smtp-delivery-124.mimecast.com (us-smtp-delivery-124.mimecast.com [170.10.129.124]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 6E14B11666 for ; Tue, 28 Mar 2023 08:16:11 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1680016494; 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=s89n5MVHIm/yrA8YFK9Xcfzas4VQ/6rU7DsLdSVa7Sk=; b=R+hLP4oOwHMa5sH3Wn8jctL0MltPpLSZ+/bSp9qD+qcEeSp6Lh0k/KWNEYURnPDm4xugs+ KnmHIlyN+zyGILqsXEG+1wJof4k4d3EV7KISRiDmEg8meKgBmuk6U2Kv+iM3OO8cIggBXp ARVxDG4QSe/1xFptzeqtbts/5XKgRnM= Received: from mimecast-mx02.redhat.com (66.187.233.88 [66.187.233.88]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id us-mta-637-iqk6bV3lOzq66C24ZkXuIg-1; Tue, 28 Mar 2023 11:11:31 -0400 X-MC-Unique: iqk6bV3lOzq66C24ZkXuIg-1 Received: from smtp.corp.redhat.com (int-mx07.intmail.prod.int.rdu2.redhat.com [10.11.54.7]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx02.redhat.com (Postfix) with ESMTPS id C0D2D100DEAD; Tue, 28 Mar 2023 15:11:25 +0000 (UTC) Received: from localhost (ovpn-8-20.pek2.redhat.com [10.72.8.20]) by smtp.corp.redhat.com (Postfix) with ESMTP id D553C140EBF4; Tue, 28 Mar 2023 15:11:24 +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 , Dan Williams , Ming Lei Subject: [PATCH V5 07/16] block: ublk_drv: don't consider flush request in map/unmap io Date: Tue, 28 Mar 2023 23:09:49 +0800 Message-Id: <20230328150958.1253547-8-ming.lei@redhat.com> In-Reply-To: <20230328150958.1253547-1-ming.lei@redhat.com> References: <20230328150958.1253547-1-ming.lei@redhat.com> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Scanned-By: MIMEDefang 3.1 on 10.11.54.7 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 bc46616710d4..c73b2dba25ce 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, @@ -774,9 +772,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