Received: by 2002:a05:7412:d8a:b0:e2:908c:2ebd with SMTP id b10csp3527969rdg; Tue, 17 Oct 2023 19:22:31 -0700 (PDT) X-Google-Smtp-Source: AGHT+IHrgmRlntLIS8tm+Dk8uBN0xYrWOSjrVDB3x/6VRBiOUpIbTCXNW4u6793Am0GTI7lurfWA X-Received: by 2002:a05:6870:1f13:b0:1e9:de37:a761 with SMTP id pd19-20020a0568701f1300b001e9de37a761mr3895958oab.22.1697595751148; Tue, 17 Oct 2023 19:22:31 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1697595751; cv=none; d=google.com; s=arc-20160816; b=RrVc7dlcMM8yo5BD6+YGlp86+HbBa1oQFv0rebnsK8xr11KBotkflmKz2thPyGp+nN 8UIE6QPZPbWlRNgPXWVOi3dWvx6UtqR04R1viBuKoWReMxnBGdvFsE2GFklxlDKBebNt TRYn5Ol9KJLUcbtgXaz0MQJInXosFiuSbSN01u14i+rwl3HYUbngM4O/ikcauIvvFJUj vTtLNPi2eX1yKB3hlOy/+wfhiv/wic88ndr4TL4l50mNWDbtE5A4bnnKTUsQCeLc/uJ+ VWyE4UQS4qC7waMPUpPm9OSDoJTTb2+Spjm3DH/h+Z+Bub1bVW7q+pHUq6fDfXJwBxFZ kO5A== 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:content-language:subject:user-agent:mime-version :date:message-id; bh=o+qBB0psTHM4GdC+LMM3A5PErUDoY8glW7JFAsOVSCE=; fh=onr0/RZ/cLL0we95FTjDzSgxAIzfJ8Q8wC5ZGrmwFy4=; b=0lkLWlhmZFCLLtQj+emGl2AcwJxX+m4g1ReKIYln5P/8WfBBc+e/5EjR/NF/fcUcGP uD2A1SJjNa6v+HRgUR0Jq6KtkbpfSjo4kEm5tJPvUIX26XzQWQyDRlIZkPKCFqc96wLm wtOV/mWB13Pk+FA7zBIoPH0R6UAumFh+zAE6rgAs0nfu6F9egA/02JzjiTmSoDGeXiN0 j0+3OeTwLpuc8wuOAndIOUHf0Y5HFD4nIIqOa122Vhz967DMT+s2AU83xcK2kZt77Rlk h2grKaXK37HvReYjlusmMW4y3RyafaaU9gPc+tvQZf17bXB31FcPrDPKPuZAv25OlW/7 +Diw== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::3:6 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 pete.vger.email (pete.vger.email. [2620:137:e000::3:6]) by mx.google.com with ESMTPS id z16-20020a656650000000b00578889362a2si1004910pgv.663.2023.10.17.19.22.30 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 17 Oct 2023 19:22:31 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::3:6 as permitted sender) client-ip=2620:137:e000::3:6; Authentication-Results: mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::3:6 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=fail (p=QUARANTINE sp=QUARANTINE dis=NONE) header.from=huawei.com Received: from out1.vger.email (depot.vger.email [IPv6:2620:137:e000::3:0]) by pete.vger.email (Postfix) with ESMTP id D2A9C80307A9; Tue, 17 Oct 2023 19:22:28 -0700 (PDT) X-Virus-Status: Clean X-Virus-Scanned: clamav-milter 0.103.10 at pete.vger.email Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S229454AbjJRCWV (ORCPT + 99 others); Tue, 17 Oct 2023 22:22:21 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:41062 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229458AbjJRCWU (ORCPT ); Tue, 17 Oct 2023 22:22:20 -0400 Received: from szxga08-in.huawei.com (szxga08-in.huawei.com [45.249.212.255]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 01D01C6; Tue, 17 Oct 2023 19:22:17 -0700 (PDT) Received: from kwepemm000012.china.huawei.com (unknown [172.30.72.57]) by szxga08-in.huawei.com (SkyGuard) with ESMTP id 4S9F0h3hqjz15NJf; Wed, 18 Oct 2023 10:19:32 +0800 (CST) Received: from [10.174.178.220] (10.174.178.220) by kwepemm000012.china.huawei.com (7.193.23.142) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.2507.31; Wed, 18 Oct 2023 10:22:14 +0800 Message-ID: <3a76730a-d414-c67d-8851-826f86669f2b@huawei.com> Date: Wed, 18 Oct 2023 10:22:13 +0800 MIME-Version: 1.0 User-Agent: Mozilla/5.0 (Windows NT 10.0; Win64; x64; rv:102.0) Gecko/20100101 Thunderbird/102.8.0 Subject: Re: [PATCH v2 1/2] scsi: core: cleanup scsi_dev_queue_ready() Content-Language: en-US To: Bart Van Assche , "James E . J . Bottomley" , "Martin K . Petersen" , CC: , References: <20231016020847.1270258-1-haowenchao2@huawei.com> <20231016020847.1270258-2-haowenchao2@huawei.com> From: Wenchao Hao In-Reply-To: Content-Type: text/plain; charset="UTF-8"; format=flowed Content-Transfer-Encoding: 8bit X-Originating-IP: [10.174.178.220] X-ClientProxiedBy: dggems706-chm.china.huawei.com (10.3.19.183) To kwepemm000012.china.huawei.com (7.193.23.142) X-CFilter-Loop: Reflected X-Spam-Status: No, score=-4.1 required=5.0 tests=HEADER_FROM_DIFFERENT_DOMAINS, MAILING_LIST_MULTI,NICE_REPLY_A,SPF_HELO_NONE,SPF_PASS autolearn=unavailable autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on pete.vger.email Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org X-Greylist: Sender passed SPF test, not delayed by milter-greylist-4.6.4 (pete.vger.email [0.0.0.0]); Tue, 17 Oct 2023 19:22:29 -0700 (PDT) On 2023/10/18 5:15, Bart Van Assche wrote: > On 10/15/23 19:08, Wenchao Hao wrote: >> +    /* >> +     * device_blocked is not set at mostly time, so check it first >> +     * and return token when it is not set. >> +     */ >> +    if (!atomic_read(&sdev->device_blocked)) >> +        return token; > > This patch looks like an improvement to me. But I don't think that the > above comment is useful. I propose to move it into the patch > description. > >> -        /* >> -         * unblock after device_blocked iterates to zero >> -         */ >> -        if (atomic_dec_return(&sdev->device_blocked) > 0) >> -            goto out_dec; >> -        SCSI_LOG_MLQUEUE(3, sdev_printk(KERN_INFO, sdev, >> -                   "unblocking device at zero depth\n")); >> +    /* >> +     * unblock after device_blocked iterates to zero >> +     */ > > +    if (scsi_device_busy(sdev) > 1 || > > +        atomic_dec_return(&sdev->device_blocked) > 0) { > > +        sbitmap_put(&sdev->budget_map, token); > > +        return -1; > >       } > > Please make the above comment match the new code, e.g. by changing it > into the following: "Only unblock if no other commands are pending and > if device_blocked has decreased to zero". > OK, would update. Thanks. > Thanks, > > Bart. >