From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 37228C32771 for ; Thu, 22 Sep 2022 00:28:21 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S229803AbiIVA2U (ORCPT ); Wed, 21 Sep 2022 20:28:20 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:38334 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229716AbiIVA2T (ORCPT ); Wed, 21 Sep 2022 20:28:19 -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 6E8599FA98 for ; Wed, 21 Sep 2022 17:28:18 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1663806497; 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=Lt38D7nlLrIvQpx45B0YYUAs54VyUIvE6crk8DTFCbE=; b=Tr46/jWrW3CbWTBTu9RkdUKVywA2DMnNtNkbzRz5PXueiG+hbc5FNPss/V8EHjnlc3ihZJ XFRcN+Nl+CkVCNGSG82H1xLB/WlrC13gx7496ifA1sIo3VFHXUStbvtShiLNcpVf2GmrBw fkfqpSLveK0EP7Qu2sw6/folEk69EJk= Received: from mimecast-mx02.redhat.com (mimecast-mx02.redhat.com [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-631-F7ASIG0lN362IjjVOS6T5w-1; Wed, 21 Sep 2022 20:28:13 -0400 X-MC-Unique: F7ASIG0lN362IjjVOS6T5w-1 Received: from smtp.corp.redhat.com (int-mx01.intmail.prod.int.rdu2.redhat.com [10.11.54.1]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx02.redhat.com (Postfix) with ESMTPS id B8E5D80029D; Thu, 22 Sep 2022 00:28:12 +0000 (UTC) Received: from T590 (ovpn-8-16.pek2.redhat.com [10.72.8.16]) by smtp.corp.redhat.com (Postfix) with ESMTPS id 60FD140C2064; Thu, 22 Sep 2022 00:28:06 +0000 (UTC) Date: Thu, 22 Sep 2022 08:28:01 +0800 From: Ming Lei To: ZiyangZhang Cc: axboe@kernel.dk, xiaoguang.wang@linux.alibaba.com, linux-block@vger.kernel.org, linux-kernel@vger.kernel.org, joseph.qi@linux.alibaba.com Subject: Re: [PATCH V4 4/8] ublk_drv: requeue rqs with recovery feature enabled Message-ID: References: <20220921095849.84988-1-ZiyangZhang@linux.alibaba.com> <20220921095849.84988-5-ZiyangZhang@linux.alibaba.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20220921095849.84988-5-ZiyangZhang@linux.alibaba.com> X-Scanned-By: MIMEDefang 3.1 on 10.11.54.1 Precedence: bulk List-ID: X-Mailing-List: linux-block@vger.kernel.org On Wed, Sep 21, 2022 at 05:58:45PM +0800, ZiyangZhang wrote: > With recovery feature enabled, in ublk_queue_rq or task work > (in exit_task_work or fallback wq), we requeue rqs instead of > ending(aborting) them. Besides, No matter recovery feature is enabled > or disabled, we schedule monitor_work immediately. > > Signed-off-by: ZiyangZhang > --- > drivers/block/ublk_drv.c | 31 +++++++++++++++++++++++++++++-- > 1 file changed, 29 insertions(+), 2 deletions(-) > > diff --git a/drivers/block/ublk_drv.c b/drivers/block/ublk_drv.c > index 3bdac4bdf46f..b940e490ebab 100644 > --- a/drivers/block/ublk_drv.c > +++ b/drivers/block/ublk_drv.c > @@ -655,6 +655,19 @@ static void ubq_complete_io_cmd(struct ublk_io *io, int res) > > #define UBLK_REQUEUE_DELAY_MS 3 > > +static inline void __ublk_abort_rq_in_task_work(struct ublk_queue *ubq, > + struct request *rq) > +{ > + pr_devel("%s: %s q_id %d tag %d io_flags %x.\n", __func__, > + (ublk_queue_can_use_recovery(ubq)) ? "requeue" : "abort", > + ubq->q_id, rq->tag, ubq->ios[rq->tag].flags); > + /* We cannot process this rq so just requeue it. */ > + if (ublk_queue_can_use_recovery(ubq)) > + blk_mq_requeue_request(rq, false); > + else > + blk_mq_end_request(rq, BLK_STS_IOERR); > +} > + > static inline void __ublk_rq_task_work(struct request *req) > { > struct ublk_queue *ubq = req->mq_hctx->driver_data; > @@ -677,7 +690,7 @@ static inline void __ublk_rq_task_work(struct request *req) > * (2) current->flags & PF_EXITING. > */ > if (unlikely(current != ubq->ubq_daemon || current->flags & PF_EXITING)) { > - blk_mq_end_request(req, BLK_STS_IOERR); > + __ublk_abort_rq_in_task_work(ubq, req); > mod_delayed_work(system_wq, &ub->monitor_work, 0); > return; > } > @@ -752,6 +765,20 @@ static void ublk_rq_task_work_fn(struct callback_head *work) > __ublk_rq_task_work(req); > } > > +static inline blk_status_t __ublk_abort_rq(struct ublk_queue *ubq, > + struct request *rq) > +{ > + pr_devel("%s: %s q_id %d tag %d io_flags %x.\n", __func__, > + (ublk_queue_can_use_recovery(ubq)) ? "requeue" : "abort", > + ubq->q_id, rq->tag, ubq->ios[rq->tag].flags); > + /* We cannot process this rq so just requeue it. */ > + if (ublk_queue_can_use_recovery(ubq)) { > + blk_mq_requeue_request(rq, false); > + return BLK_STS_OK; > + } > + return BLK_STS_IOERR; > +} > + Please remove the two added logging, otherwise this patch looks fine. Thanks, Ming