From patchwork Thu Mar 30 11:36:21 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Ming Lei X-Patchwork-Id: 77126 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a59:b0ea:0:b0:3b6:4342:cba0 with SMTP id b10csp1060008vqo; Thu, 30 Mar 2023 04:41:49 -0700 (PDT) X-Google-Smtp-Source: AK7set8DD8Fh1qXnW1o68DCnqUhAx1xSu3kCaxyq6MJt7JVHmp0VVCzSgHBuxFQmWpO34lN5r66M X-Received: by 2002:a05:6a20:b291:b0:da:717e:6ada with SMTP id ei17-20020a056a20b29100b000da717e6adamr19776616pzb.59.1680176509116; Thu, 30 Mar 2023 04:41:49 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1680176509; cv=none; d=google.com; s=arc-20160816; b=MkxS0GFolIjZ38u/2X7OwbaiJS1LcWYuHHRNpwevOadQeT9b0qvSnTdC3ziyYnu81o ZWLj5utzICohA8lDRxzAaaOT+SGtz7LDKwG9qEj8StRkL3Jk4gpqthYlvPTOaxtvTOO0 oS/z4f91/6irp5Co0m3EeZEyPY0xZo20JLkt++zXR//8BNr3/Eb/IBwesV6meFaFk/oB SW262rTDCal4kEHu3x8KHnLoK2N5YKmvKpCJIzaxXNSdGD4JbdU6udjAtcv0M2BN/8Pi uReJOSxNKU0oKXCi+Ej9a5PZgQDn2tw30u269IHHUtkwWY3KvFTQcNkrEGIaS5SP2YPA wTDA== 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=yMIl/5++87vVm+VcA06oK7wM2b5sFjdBq3MbcKLw0La/8OAHP3Gszhl2MczORrgOcn aYbpInaDu4ZaVbDlwkBhIdG79hwbkyFCkWovZOs7uyhUAdxpzMomg6ntTLEoM/HLJAQw 4qJE7Hol+oZfXFXC5uX58a/xvtL6tdZ2JAcZj7g1FQCx4JbbTYojLi0hIpjcVI95ZPJu v9mde2w4QRl5L/N3B11y/qFGVS5rOYmpo8mXqyGiqYzWTpg0zM7KPT48XXkc5oG9HJ5k FaxlaGdDae4cSM+uHYmTGwv86kd+oTF/zlB+MMRk9iO3Cw0YLoetoR6MoAtNLnZRSi/7 2GaA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@redhat.com header.s=mimecast20190719 header.b=PfWOJ1d4; 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: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id h21-20020aa796d5000000b0062b90348411si13474443pfq.108.2023.03.30.04.41.36; Thu, 30 Mar 2023 04:41:49 -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=PfWOJ1d4; 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 S231748AbjC3Lje (ORCPT + 99 others); Thu, 30 Mar 2023 07:39:34 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:46906 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S231723AbjC3LjH (ORCPT ); Thu, 30 Mar 2023 07:39:07 -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 55E219EF6 for ; Thu, 30 Mar 2023 04:37:22 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1680176241; 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=PfWOJ1d44APBjEr4nENsnNxk5QYeY8S0ljpTyrRLCzq3wd1dc87n2z7yiChIlN7YV0kJPF zKNbuaBI+VeHWeHREeiKDVoywe/t5r1CXUvwJ6hFtC3xHP8xSisoR59obpOKZahwMlq54M 7N/vmynnwrj9mrVnl3Ilm2SohH86o1o= 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-604-YrZfWq1oOt6aE3h8QRqdYA-1; Thu, 30 Mar 2023 07:37:18 -0400 X-MC-Unique: YrZfWq1oOt6aE3h8QRqdYA-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 D51DF3815EF4; Thu, 30 Mar 2023 11:37:17 +0000 (UTC) Received: from localhost (ovpn-8-19.pek2.redhat.com [10.72.8.19]) by smtp.corp.redhat.com (Postfix) with ESMTP id F3EED14171BB; Thu, 30 Mar 2023 11:37:16 +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 V6 08/17] block: ublk_drv: don't consider flush request in map/unmap io Date: Thu, 30 Mar 2023 19:36:21 +0800 Message-Id: <20230330113630.1388860-9-ming.lei@redhat.com> In-Reply-To: <20230330113630.1388860-1-ming.lei@redhat.com> References: <20230330113630.1388860-1-ming.lei@redhat.com> MIME-Version: 1.0 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 X-getmail-retrieved-from-mailbox: =?utf-8?q?INBOX?= X-GMAIL-THRID: =?utf-8?q?1761792763343636836?= X-GMAIL-MSGID: =?utf-8?q?1761792763343636836?= 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