Received: by 2002:a25:d80d:0:0:0:0:0 with SMTP id p13csp114859ybg; Sat, 23 May 2020 08:54:19 -0700 (PDT) X-Google-Smtp-Source: ABdhPJxNkzVTYIdlZ883u6//kUVdlD5X4j+qXFVQ82XWUMPJ7Oeuz5swls5w2FE3SLNdj6Cy2ElN X-Received: by 2002:a50:c90c:: with SMTP id o12mr7597824edh.294.1590249259205; Sat, 23 May 2020 08:54:19 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1590249259; cv=none; d=google.com; s=arc-20160816; b=eMvmHWuXjX4q7oZe1iddNFOc2AFxRjM2BMuH/iFBb6ze2m6LViG7LklY3/8VoWziQ3 AyyZJxzlJPk3GumhHIMidUWxMRhiqTN1JAYvuko1LltZ96yNLeJXm2sZF0bhpo2XsmEW y/4nZZN1UflgdwvweuPYFJicGlO0UGYcQZlQ860IpkM7hP9Im9c7+WeW+F8XZwWOySHO 36XChpIc003Ww7GtcHkGY3EyuPvQgL58+BdUsulE6B5V0F4AsrFBSPEt7QeJlk3UjW01 IBZv6W1YcyWvwuN8Vrluqq8NJh8MoiShzBba6TafNItKuyqIyTYUrG9xLam7rQYFomPL RGdg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:content-transfer-encoding:mime-version :message-id:date:subject:cc:to:from:dkim-signature; bh=7zKzu+Bb4gMdTdtJjSG+Yx9639VPFJZPb465isIw9HI=; b=OXG4yJ8WfktgCaeA/khPCpqt+LcKQtGj5Fj1MMyhNRZU7qJ+rT3EZkyW60+/0QxCMF 5ZKvnCOdfj4lNqEPQG45+HRz2fW+DPjtSSM8GF0U8izObplpkRqTMDau+HwPAhoGkqhr PxJyRLKT5PzBJfMviC2oMMoyIOU/qlJOlOyTKfGWiXmyEFco0CXjJQ1+eE7nnggT8Gsq BT5ADh59JsiebkG8VaAiSGPE2wsga2FYuaMEPDwe26NkC6aw9LSqB+YYBYsuGbfzkqhD b/XpD8P9HyRAkWM+BoVk96BGuk8YeciJ3IHUVGLkjcj/8qCOO6Kr7lg4rrICv79gdW8v tPKg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@gmail.com header.s=20161025 header.b=TdHRlrTj; 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=QUARANTINE dis=NONE) header.from=gmail.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id cm10si5944985edb.82.2020.05.23.08.53.56; Sat, 23 May 2020 08:54:19 -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=@gmail.com header.s=20161025 header.b=TdHRlrTj; 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=QUARANTINE dis=NONE) header.from=gmail.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1727884AbgEWPvV (ORCPT + 99 others); Sat, 23 May 2020 11:51:21 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:35480 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726650AbgEWPvU (ORCPT ); Sat, 23 May 2020 11:51:20 -0400 Received: from mail-pl1-x642.google.com (mail-pl1-x642.google.com [IPv6:2607:f8b0:4864:20::642]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id E4EBDC061A0E for ; Sat, 23 May 2020 08:51:20 -0700 (PDT) Received: by mail-pl1-x642.google.com with SMTP id t16so5624795plo.7 for ; Sat, 23 May 2020 08:51:20 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=from:to:cc:subject:date:message-id:mime-version :content-transfer-encoding; bh=7zKzu+Bb4gMdTdtJjSG+Yx9639VPFJZPb465isIw9HI=; b=TdHRlrTj0WDx2T14AhFodKEPUGkyAChranEYIkea66F2ZU1N9bCFADsqaS5h6JQn8C /iUrM2G6dx++rGWbKOWZg8gC6GixOP7qsLKnoJwc1aWgaon5eAMM8YP0Q+u4jdEUx4vi H8ugSYQjHL/mq+uJyHDcFmrM8ouI7E4PwigBtnnTBGGZoStsbBnAmfqQWV+uIdVLjGLg RO8SsJtHMLTs/SudVL4t8L4Ww20I/gOIMi4cHO8cfALPzqp+bFtt/arQOb/T3Sinsq8I ohuLWyVQjuNNchL0Z4ejQs0hW6tifBDFfvTTphFUA7pECUEMo5aKQWmEhbwAY2mk5crO 1XSw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:mime-version :content-transfer-encoding; bh=7zKzu+Bb4gMdTdtJjSG+Yx9639VPFJZPb465isIw9HI=; b=OqKrYVIi5X3g/hh9+aGjLg9rSGyt30qkoWwerMa/qd3QWzKgPKIvsdM/gQ9lXDUBit iT7JcFQHJy08IyQX4XgMsMACYEaMYN7zj8X7eQk7v1u75BabCCeaFqglcSTaaJ+8nEL3 0o630qM/RMKxKR9mmLMIrv9HX7t6bF4tukzoeYYFzfaFdhKmjh4ZJAhNknSA0jY3a9A9 zVMBBjOmDSA4aY6QXY+jakxdPNt1uAEwkuWBBmy3wsz2Hs+kvT7nFPJVf9cn9JPOob/N ff3ARCoO506tN3sDzxNoKVgpDKs0pnbQHYFtPLhfCu/ThY+eb4ryza0/aaihqWXrc5/8 xoRg== X-Gm-Message-State: AOAM5329hpJy2okGGvCPRZmmVSkxSL8b3Sa5qgTNHVbJyvyc2BmHwfhF OyRoetjg6wqKmruYi8d8DU8= X-Received: by 2002:a17:90b:358e:: with SMTP id mm14mr11139555pjb.175.1590249080516; Sat, 23 May 2020 08:51:20 -0700 (PDT) Received: from Smcdef-MBP.lan ([103.136.220.68]) by smtp.gmail.com with ESMTPSA id d9sm4653760pfn.72.2020.05.23.08.51.15 (version=TLS1_2 cipher=ECDHE-ECDSA-AES128-GCM-SHA256 bits=128/128); Sat, 23 May 2020 08:51:20 -0700 (PDT) From: Kaitao Cheng To: axboe@kernel.dk Cc: damien.lemoal@wdc.com, bvanassche@acm.org, ming.lei@redhat.com, martin.petersen@oracle.com, satyat@google.com, chaitanya.kulkarni@wdc.com, houtao1@huawei.com, asml.silence@gmail.com, ajay.joshi@wdc.com, linux-kernel@vger.kernel.org, songmuchun@bytedance.com, Kaitao Cheng Subject: [PATCH] linux/blkdev.h: Use ilog2() directly in blksize_bits() Date: Sat, 23 May 2020 23:50:48 +0800 Message-Id: <20200523155048.29369-1-pilgrimtao@gmail.com> X-Mailer: git-send-email 2.21.0 (Apple Git-122) MIME-Version: 1.0 Content-Transfer-Encoding: 8bit Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org blksize_bits() can be achieved through ilog2(), and ilog2() is more efficient. Signed-off-by: Kaitao Cheng --- include/linux/blkdev.h | 7 +------ 1 file changed, 1 insertion(+), 6 deletions(-) diff --git a/include/linux/blkdev.h b/include/linux/blkdev.h index 2b33166b9daf..cce96abac4d4 100644 --- a/include/linux/blkdev.h +++ b/include/linux/blkdev.h @@ -1505,12 +1505,7 @@ static inline int blk_rq_aligned(struct request_queue *q, unsigned long addr, /* assumes size > 256 */ static inline unsigned int blksize_bits(unsigned int size) { - unsigned int bits = 8; - do { - bits++; - size >>= 1; - } while (size > 256); - return bits; + return ilog2(size); } static inline unsigned int block_size(struct block_device *bdev) -- 2.20.1