Received: by 2002:a05:7412:d8a:b0:e2:908c:2ebd with SMTP id b10csp3417681rdg; Tue, 17 Oct 2023 14:16:03 -0700 (PDT) X-Google-Smtp-Source: AGHT+IFopxIHYI8NgZsCL6z+sR/D20ZyDA0JWLBOVTzwpBL4iGJ+sBjqoXhH5LOQ73OUc85gF1b6 X-Received: by 2002:a17:902:ea0c:b0:1bb:c06e:647a with SMTP id s12-20020a170902ea0c00b001bbc06e647amr4511538plg.53.1697577362612; Tue, 17 Oct 2023 14:16:02 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1697577362; cv=none; d=google.com; s=arc-20160816; b=ZEnvIZ4UL03B4qgDy+YdRKE87cDp9UfoqP5SpUiAfLXnjcqrgQM8V1c/7LYGYmRVVD XqDTisaLJJqpeK3LrNFkxj9MmLwzH6XwOaLMoArIfh/aE7Bhx2mQuv0MWBVDzFEBYAJ1 3+0haIKqvGX2Ak5UYRtWKI9BuVjv7NUkvX5ox+dDYJYJ0Q3T3XFguziEpVSo3Pm/rf4+ LFoQWeNNoedK2viV8ug6uyTHHrNmP9RBCTxe0lWtb92mSMhj/AaKnsI/mgDhtZrINW25 37jADA2/grPJkYxbHu2dtqPr+wiGwnlQqm9T+oCPXWWFqT5WrSvlEBYD7DVmgrnA7Vy+ MT/g== 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=9zUohBhM2mgKneqqIllIieESuwIKjaG+ILxik6Us3n8=; fh=JvkXUnDQB0iKsaI3cqy3eFUfWBCGaGvMfIz114EHkKo=; b=HGVhJ4Zj3OfURCdYhtDx2h3oKg+CzDOqD2X+C7uaU/NbuQQsp6Pq1aOambuoRNEjET 4u7/JEzlb32Sv6VQbqJ6RWnHDV+No8h2hmgN9IXtoBoOVFGXIaGastPapfO9Uu+5bhcL TMDA4MwMD23oQbSG1lLl/C6UQRFxOxGT5Vwm3tITmSfokmEa+7mLMU38YmP0DHnsXXvn ljUBya670GHYPmI13IBFJHJpQC+TxDtvNsDuWjqYt168zwmA5jUoE05/gT6N7pK+OOTo 8keJ48kZuBaMyGpmYCPcbh66dzn2M3ZOgstK5HrxVtR2p6p0DGw63XOF7iv6w5olWdd1 gRZg== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.38 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=acm.org Return-Path: Received: from fry.vger.email (fry.vger.email. [23.128.96.38]) by mx.google.com with ESMTPS id x6-20020a170902ec8600b001c3fa95ca18si2857040plg.333.2023.10.17.14.16.02 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 17 Oct 2023 14:16:02 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.38 as permitted sender) client-ip=23.128.96.38; Authentication-Results: mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.38 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=acm.org Received: from out1.vger.email (depot.vger.email [IPv6:2620:137:e000::3:0]) by fry.vger.email (Postfix) with ESMTP id 7EF0D8047D06; Tue, 17 Oct 2023 14:15:49 -0700 (PDT) X-Virus-Status: Clean X-Virus-Scanned: clamav-milter 0.103.10 at fry.vger.email Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S234143AbjJQVPk (ORCPT + 99 others); Tue, 17 Oct 2023 17:15:40 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:52230 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229848AbjJQVPi (ORCPT ); Tue, 17 Oct 2023 17:15:38 -0400 Received: from mail-oa1-f51.google.com (mail-oa1-f51.google.com [209.85.160.51]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 18A27ED; Tue, 17 Oct 2023 14:15:37 -0700 (PDT) Received: by mail-oa1-f51.google.com with SMTP id 586e51a60fabf-1e5bc692721so3432826fac.0; Tue, 17 Oct 2023 14:15:37 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1697577336; x=1698182136; h=content-transfer-encoding:in-reply-to:from:references:cc:to :content-language:subject:user-agent:mime-version:date:message-id :x-gm-message-state:from:to:cc:subject:date:message-id:reply-to; bh=9zUohBhM2mgKneqqIllIieESuwIKjaG+ILxik6Us3n8=; b=A00og0sbOvj0CEFXjxaEM5V5jpFguxh5X4NA8+zRXeGujIzAiwvjcl8FXyIXC2t+Vg ZewggWsZPdtfpxP9SVnfOa8VCyNI8egFJhrYywN4KeTz/UIwHVhZ7ko1adp3uwdTkZiA Bgcw95X8uhAgwZiS4AOIitXRMK/flwVLv4FsyU1ME7tQsLwav0/pY+I5IR1I5skglAI8 mideW7P3nCLNRt2SFYDP73KlV2K38gEhA653dg3mYNMEck/ocsECQKYgHFOzYt7Us2Hp e7knhcaUWGbOqV1CFYwEHb4zl3/8Obr1SsorUkx+r9V2cmOL282k8YaWqNq8GPfrabgE VLFg== X-Gm-Message-State: AOJu0Yw6/Y7s3x6jxLZZCc8ccWHSOy28HrhF+/PP9pHgzV7sjDuFAYnB H8eETyTtcb6NrbkY26mm7kc= X-Received: by 2002:a05:6870:d188:b0:1e9:bb3a:9a89 with SMTP id a8-20020a056870d18800b001e9bb3a9a89mr4023070oac.47.1697577336272; Tue, 17 Oct 2023 14:15:36 -0700 (PDT) Received: from ?IPV6:2620:15c:211:201:8f02:2919:9600:ac09? ([2620:15c:211:201:8f02:2919:9600:ac09]) by smtp.gmail.com with ESMTPSA id o9-20020a655209000000b005b46e691108sm282600pgp.68.2023.10.17.14.15.34 (version=TLS1_3 cipher=TLS_AES_128_GCM_SHA256 bits=128/128); Tue, 17 Oct 2023 14:15:35 -0700 (PDT) Message-ID: Date: Tue, 17 Oct 2023 14:15:34 -0700 MIME-Version: 1.0 User-Agent: Mozilla Thunderbird Subject: Re: [PATCH v2 1/2] scsi: core: cleanup scsi_dev_queue_ready() Content-Language: en-US To: Wenchao Hao , "James E . J . Bottomley" , "Martin K . Petersen" , linux-scsi@vger.kernel.org Cc: linux-kernel@vger.kernel.org, louhongxiang@huawei.com References: <20231016020847.1270258-1-haowenchao2@huawei.com> <20231016020847.1270258-2-haowenchao2@huawei.com> From: Bart Van Assche In-Reply-To: <20231016020847.1270258-2-haowenchao2@huawei.com> Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: 7bit X-Spam-Status: No, score=-0.8 required=5.0 tests=HEADER_FROM_DIFFERENT_DOMAINS, MAILING_LIST_MULTI,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 fry.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 (fry.vger.email [0.0.0.0]); Tue, 17 Oct 2023 14:15:49 -0700 (PDT) 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". Thanks, Bart.