Received: by 2002:a05:6358:1087:b0:cb:c9d3:cd90 with SMTP id j7csp386054rwi; Thu, 27 Oct 2022 02:37:37 -0700 (PDT) X-Google-Smtp-Source: AMsMyM5Kn8EXOpUcLoH3Ovs6G8HUqswpLNGTAKBjVxQX2z1MbNI4kd2/DeQlZ/MGEwIusv92CM8E X-Received: by 2002:a05:6402:380a:b0:451:ae08:7a6c with SMTP id es10-20020a056402380a00b00451ae087a6cmr43551422edb.161.1666863456777; Thu, 27 Oct 2022 02:37:36 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1666863456; cv=none; d=google.com; s=arc-20160816; b=MlF21nk1hyidpUnloLajO6naruYA4zda/QGZVafZ31R6Sjeri2CqebO+/MNIW9S57/ O+P0kRjt4RqOD0+GpNJEVrKSd70/fS7EEsp5IgtTnzp/REeP1iNfr1GDXJn3xEL3GN0D bHk5ysxigVnvFHTr/kB4pG/tNg2cgBTAnIL47q71rqFYkOcXIWsXSrOKW6ujCVB2P9zz ZpiVrS1wgvMKuuDVWrV1JrWYOWUizE6o2FjRUeu7r8rh4Fh+GPJkNyxaN2bL+GBpxz83 eloo9us8I0PLHXO0kwcR3AHgrosok3OU32V6JKhbKX9SRNEx1YesMumKXb+VTAoIpsKw NRpg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:in-reply-to:from :references:cc:to:subject:user-agent:mime-version:date:message-id; bh=PbSbNd6EhzHa8hsR9NX6kURbCZcxf1Ty5fLFSayHFgE=; b=jW1FZLQ0uDQEKwS09lpdAP5IQYkttbzP2weu9zHTChMvPjCyQfM7jfwCb2GCtY5QHx bXrczBW9DCcPUSSYDsR7QBvrGanV5coyMlVs5iAKCMz7hOcbPZWoU0KPzf4SzGQO6l4H BAo2HJqpUIfg3ae6Zcqfu+rt4tq4csE4Mer0gSIYPTL8LXkkKHKNo3U6PI5hbzhW9/LV umyhhY8RyNLUWgXY3EgWq4iceIFMicKVo6KVollAkBUPhKQRsA9Vbo8a+n4CLJnO1ZLu +/EcfrfBZf2lKF23lyfE42eOIWNKYbuuGGCkApmcDnGDEi9yBQpIWTgjHAyEr7Rba/a8 vd+A== ARC-Authentication-Results: i=1; mx.google.com; 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=fail (p=QUARANTINE sp=QUARANTINE dis=NONE) header.from=huawei.com Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id he41-20020a1709073da900b007815e9c5b80si1124793ejc.617.2022.10.27.02.37.11; Thu, 27 Oct 2022 02:37:36 -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; 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=fail (p=QUARANTINE sp=QUARANTINE dis=NONE) header.from=huawei.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S235446AbiJ0JPG (ORCPT + 99 others); Thu, 27 Oct 2022 05:15:06 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:40748 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S235395AbiJ0JOn (ORCPT ); Thu, 27 Oct 2022 05:14:43 -0400 Received: from frasgout.his.huawei.com (frasgout.his.huawei.com [185.176.79.56]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 3D92D3B718; Thu, 27 Oct 2022 02:13:26 -0700 (PDT) Received: from fraeml742-chm.china.huawei.com (unknown [172.18.147.207]) by frasgout.his.huawei.com (SkyGuard) with ESMTP id 4MyfyN05Qnz67Psy; Thu, 27 Oct 2022 17:09:48 +0800 (CST) Received: from lhrpeml500003.china.huawei.com (7.191.162.67) by fraeml742-chm.china.huawei.com (10.206.15.223) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.2375.31; Thu, 27 Oct 2022 11:13:24 +0200 Received: from [10.195.32.169] (10.195.32.169) by lhrpeml500003.china.huawei.com (7.191.162.67) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.2375.31; Thu, 27 Oct 2022 10:13:23 +0100 Message-ID: <76fe5007-5c53-9cdf-7c57-6af7ebaf8c97@huawei.com> Date: Thu, 27 Oct 2022 10:13:24 +0100 MIME-Version: 1.0 User-Agent: Mozilla/5.0 (Windows NT 10.0; Win64; x64; rv:91.0) Gecko/20100101 Thunderbird/91.6.1 Subject: Re: [PATCH RFC v3 04/22] scsi: core: Add support to send reserved commands To: Damien Le Moal , , , , , , , , , CC: , , , , References: <1666693096-180008-1-git-send-email-john.garry@huawei.com> <1666693096-180008-5-git-send-email-john.garry@huawei.com> From: John Garry In-Reply-To: Content-Type: text/plain; charset="UTF-8"; format=flowed Content-Transfer-Encoding: 7bit X-Originating-IP: [10.195.32.169] X-ClientProxiedBy: lhrpeml100004.china.huawei.com (7.191.162.219) To lhrpeml500003.china.huawei.com (7.191.162.67) X-CFilter-Loop: Reflected X-Spam-Status: No, score=-4.2 required=5.0 tests=BAYES_00,NICE_REPLY_A, RCVD_IN_DNSWL_MED,RCVD_IN_MSPIKE_H2,SPF_HELO_NONE,SPF_PASS autolearn=ham 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 27/10/2022 02:21, Damien Le Moal wrote: >> >> + if (blk_mq_is_reserved_rq(rq)) { >> + struct scsi_device *sdev = cmd->device; > This variable is not really needed. You can call: > > scsi_device_unbusy(cmd->device, cmd); > > No ? ok, your suggestion is good > >> + >> + scsi_mq_uninit_cmd(cmd); >> + scsi_device_unbusy(sdev, cmd); >> + __blk_mq_end_request(rq, 0); >> + >> + return; >> + } >> + >> INIT_LIST_HEAD(&cmd->eh_entry); >> >> atomic_inc(&cmd->device->iodone_cnt); >> @@ -1718,6 +1728,21 @@ static blk_status_t scsi_queue_rq(struct blk_mq_hw_ctx *hctx, >> blk_status_t ret; >> int reason; >> >> + if (blk_mq_is_reserved_rq(req)) { >> + if (!(req->rq_flags & RQF_DONTPREP)) { >> + ret = scsi_prepare_cmd(req); >> + if (ret != BLK_STS_OK) >> + goto out_dec_host_busy; >> + >> + req->rq_flags |= RQF_DONTPREP; >> + } else { >> + clear_bit(SCMD_STATE_COMPLETE, &cmd->state); >> + } >> + blk_mq_start_request(req); >> + >> + return shost->hostt->reserved_queuecommand(shost, cmd); >> + } >> + >> WARN_ON_ONCE(cmd->budget_token < 0); >> >> /* >> diff --git a/include/scsi/scsi_host.h b/include/scsi/scsi_host.h >> index 91678c77398e..a39f36aa0b0d 100644 >> --- a/include/scsi/scsi_host.h >> +++ b/include/scsi/scsi_host.h >> @@ -73,6 +73,7 @@ struct scsi_host_template { >> * STATUS: REQUIRED >> */ >> int (* queuecommand)(struct Scsi_Host *, struct scsi_cmnd *); >> + int (*reserved_queuecommand)(struct Scsi_Host *, struct scsi_cmnd *); > Nit: This op name sound like something returning a bool... May be a > straight "queue_reserved_command" name would be clearer ? or queuecommand_reserved ? I'm just trying to have the name a variant of "queuecommand". > thanks, John