Received: by 2002:a05:6a10:5bc5:0:0:0:0 with SMTP id os5csp3620970pxb; Sun, 24 Oct 2021 06:58:38 -0700 (PDT) X-Google-Smtp-Source: ABdhPJwShp/SfYoatPbx5VreNQmZAc6O2ZpTT2oU5FVnqhtsh9wndYarRuB4yccI5zDyGUOhKiBo X-Received: by 2002:a05:6a00:24c8:b0:44c:654b:403b with SMTP id d8-20020a056a0024c800b0044c654b403bmr11778705pfv.55.1635083918243; Sun, 24 Oct 2021 06:58:38 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1635083918; cv=none; d=google.com; s=arc-20160816; b=RoQewCiPAwnPOlviXGZooAiOyI4H6wHSVYjj9wwFRPEiva9tjGsdEN6ed2k14FwGey ViOi+Q3CIdfWeC/+UjwmHbjMd0f3WOPnnzn0lzIqowGjrktfWXxSP3sQxUUefNpx+XiU UBEeerpywBAs0AtYcytU9wujVaeOiBYbwIQDXT2TROurd9F7AMXVvBKw2ZdXKPzGeApG xY6c6rX7qIMbMn1PEeMRVUABsDrRszHcFrurE5g3V0MszVr5QGZbEQC/Aj/jGhPu2KXy NUh+9psbaxSGRrO5ecnb6gdpmUkcXVheE7N4//hoYFWSA2qHv3UW0EpvRtMz+TVRDNR3 2GhQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-disposition:mime-version:message-id :subject:cc:to:from:date:dkim-signature; bh=tewEIaGWIVgpjWlRNV0G2f4scnW96h9ilayJkc4j6ck=; b=Tct0G0Vj8MbXIusP9I2xB1yuZk1pBQ+P2L381JdZCEMCn2uUVj7syaD6M2Thxr77TH F2w+Mvx5VBAC6gZUv88dwkh2x1zTO7rUlrLGuDskbqBz54KShZzt3iNTDilLIpoZlFPT 5C0pigfEdmwNxabkU1NB8x/nYH3xpdUgHnr8oytQv3XLq5itxCeZKb/+9BK9oGUzFWDo MVxNFL+v1afMdr7b7ls16MXO7kYQ41vwQZbngjjpu2f7TB91ncbs07pe1umvVU7OWAto M/CDjNefO3OLDVhkgGAQlMGezf7uwtHbgQafxvxdy0ETB6TVjqzMlyEDSD9VMQB7d8MJ XZQA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@redhat.com header.s=mimecast20190719 header.b=dUbN2F1d; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=redhat.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id c6si20069108pll.179.2021.10.24.06.58.25; Sun, 24 Oct 2021 06:58:38 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; dkim=pass header.i=@redhat.com header.s=mimecast20190719 header.b=dUbN2F1d; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 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 S231636AbhJXN60 (ORCPT + 99 others); Sun, 24 Oct 2021 09:58:26 -0400 Received: from us-smtp-delivery-124.mimecast.com ([170.10.133.124]:59818 "EHLO us-smtp-delivery-124.mimecast.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S231516AbhJXN6Z (ORCPT ); Sun, 24 Oct 2021 09:58:25 -0400 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1635083764; 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; bh=tewEIaGWIVgpjWlRNV0G2f4scnW96h9ilayJkc4j6ck=; b=dUbN2F1dBfEICNXE/Nt7sAqiXBkhTflM0dEnoo2mIRz9J3WJcR/9F+qcLS++oJUd05n6wF W3/J8DtZR1qMIEaJBfC7Gybq0jOtpe4NamFAphO0/Ka9GuwTgeF2Vuz9eIjgpY74+n93/K 2HCLQkZtfW/4wKlU8MbdzKQivJY+OCw= Received: from mail-ed1-f72.google.com (mail-ed1-f72.google.com [209.85.208.72]) (Using TLS) by relay.mimecast.com with ESMTP id us-mta-4-Wens4oHTMeCiLbn_aWKa9g-1; Sun, 24 Oct 2021 09:54:59 -0400 X-MC-Unique: Wens4oHTMeCiLbn_aWKa9g-1 Received: by mail-ed1-f72.google.com with SMTP id i9-20020a508709000000b003dd4b55a3caso1249020edb.19 for ; Sun, 24 Oct 2021 06:54:59 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:date:from:to:cc:subject:message-id:mime-version :content-disposition; bh=tewEIaGWIVgpjWlRNV0G2f4scnW96h9ilayJkc4j6ck=; b=DnABESaFCC5QEY5fa/ckx5oLHvNANU2LTguhtG0I7CS4e31BlCyabS6dYcPLcj1hGz jbOhr7iwXsDTZHZUVmpj2xrwtLAZZHhS0GeZPw7YgnxTpuYjLEPoYD/AMBiorwhbq79r Co0Q2WnoIj8KICntJ9SEL0eQe4v+OgSHkvYU0MC2g2lK8GZWRpakjThRVrQlz4FnAuLs bQi8FlBQVV/xPyWyHAKXPS7Tq0T2knpy47Vs7Oz5oRJXD/moPFwIOCQ7g7+s1b4Yrh2e NHso7kQA+Yz/iQFtR6VeKKQoFaJJ2AJhu94ZK7U7M90qWY+wy3rEHlm6KsOQgUoMxCeb OGBQ== X-Gm-Message-State: AOAM5317VYB8CKFLGwYDP2ERLgGWntHcGt8BditHL3+ZkgcebRaf/JRw YTSC2NH+UWsVT834xrCtb++ioDuCuq4oNyUVvy8RWM2RavRgMYVjSqK2b9d1/TVc+LKEKaWf7e8 QuJD4GvAnWZGdKpN4DSMvvpoKZG6bqlCtXW+VjtX1voB4EWzHS6ZptVLVJdh4nnwPGaHvWQ== X-Received: by 2002:aa7:de8f:: with SMTP id j15mr17998605edv.347.1635083697946; Sun, 24 Oct 2021 06:54:57 -0700 (PDT) X-Received: by 2002:aa7:de8f:: with SMTP id j15mr17998572edv.347.1635083697702; Sun, 24 Oct 2021 06:54:57 -0700 (PDT) Received: from redhat.com ([2.55.151.113]) by smtp.gmail.com with ESMTPSA id bx2sm1887573edb.44.2021.10.24.06.54.55 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sun, 24 Oct 2021 06:54:57 -0700 (PDT) Date: Sun, 24 Oct 2021 09:54:54 -0400 From: "Michael S. Tsirkin" To: linux-kernel@vger.kernel.org Cc: Max Gurtovoy , Jason Wang , Paolo Bonzini , Stefan Hajnoczi , Jens Axboe , virtualization@lists.linux-foundation.org, linux-block@vger.kernel.org Subject: [PATCH] virtio_blk: allow 0 as num_request_queues Message-ID: <20211024135412.1516393-1-mst@redhat.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline X-Mailer: git-send-email 2.27.0.106.g8ac3dc51b1 X-Mutt-Fcc: =sent Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org The default value is 0 meaning "no limit". However if 0 is specified on the command line it is instead silently converted to 1. Further, the value is already validated at point of use, there's no point in duplicating code validating the value when it is set. Simplify the code while making the behaviour more consistent by using plain module_param. Fixes: 1a662cf6cb9a ("virtio-blk: add num_request_queues module parameter") Cc: Max Gurtovoy Signed-off-by: Michael S. Tsirkin --- drivers/block/virtio_blk.c | 14 +------------- 1 file changed, 1 insertion(+), 13 deletions(-) diff --git a/drivers/block/virtio_blk.c b/drivers/block/virtio_blk.c index 6318134aab76..c336d9bb9105 100644 --- a/drivers/block/virtio_blk.c +++ b/drivers/block/virtio_blk.c @@ -30,20 +30,8 @@ #define VIRTIO_BLK_INLINE_SG_CNT 2 #endif -static int virtblk_queue_count_set(const char *val, - const struct kernel_param *kp) -{ - return param_set_uint_minmax(val, kp, 1, nr_cpu_ids); -} - -static const struct kernel_param_ops queue_count_ops = { - .set = virtblk_queue_count_set, - .get = param_get_uint, -}; - static unsigned int num_request_queues; -module_param_cb(num_request_queues, &queue_count_ops, &num_request_queues, - 0644); +module_param(num_request_queues, uint, 0644); MODULE_PARM_DESC(num_request_queues, "Limit the number of request queues to use for blk device. " "0 for no limit. " -- MST