Received: by 2002:a25:b794:0:0:0:0:0 with SMTP id n20csp1964012ybh; Sun, 4 Aug 2019 14:13:35 -0700 (PDT) X-Google-Smtp-Source: APXvYqzrfq3NUG+1tsIJWVp0ZNzaawxGG7qx87bgOxfFBYgdHCJZh69PCx2owFzl3UfIMFulqrL8 X-Received: by 2002:a62:1ac8:: with SMTP id a191mr70010957pfa.164.1564953215148; Sun, 04 Aug 2019 14:13:35 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1564953215; cv=none; d=google.com; s=arc-20160816; b=rkyrAXZkKTefT0JOCCazVQjmb+kErc9P/RSNi1VWA7ou1wR3oEvdpPCR54I8Ecx4rz gGPqPVcwsdpI1jwZfFsbfR8NSzahvJVy5nItsmk25H6IQ4Tv0SOenCGciKcI/gxKNNLL Et3q/RWpC+z4rYKMufrc1DYnNX0JpT8ddJk0viYBTr9DTaZxmiCzxKKNy1Wh3VjQRzab 49dWqp1J3IzXbT4wQ3sBmQBf8kleLYMHakt3S25SAbZKJCG7PZFTiakqHyqo5w5HhvL2 cyEj8Tjr24PEGj6B0+cf1gZkoEd6HEpK8rBoHx5hQTM9cDoM9TfocYF+fA4YJ3Ovai0g fmWQ== 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 :content-language:in-reply-to:mime-version:user-agent:date :message-id:from:references:cc:to:subject:dkim-signature; bh=RsLNfmS1riphbJPtUn1FZXodxBgf3MWew0rC4SrjLhc=; b=PEazQ5AME0Rfc+YPzdCAeSYK4+gF8IpDrVW0oBWhT17B9DxnHXNd7iw4xTdSfQ/dQZ NLeXzu10ndZwatiqtfbCRUHCVvHk31fUiOkVL5Cb99vPqb+hPZPHBjttqplhABLMCLpO lmcH3JuEquLTty+AYI1CAMC2Ds++tQbNquZcibMWaHnJj/u2Pl3Pb9F25ph9rjqPTd5L sNvvzr+lleO8U8eEWPgWRyC6RjZNQ8LEGO67ktHegB3FnKQDZnYWZI5R36pBtjkQVgc/ KK2XOZ6WhEovoR5zzBhVuMIHTRzVddDRG8/X/gNAhH5GFV1QqH732spmmYTnFSdJeoKI F7eA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel-dk.20150623.gappssmtp.com header.s=20150623 header.b=IDUEuEW2; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id a2si11151378pjs.16.2019.08.04.14.12.46; Sun, 04 Aug 2019 14:13:35 -0700 (PDT) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; dkim=pass header.i=@kernel-dk.20150623.gappssmtp.com header.s=20150623 header.b=IDUEuEW2; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1726709AbfHDVKJ (ORCPT + 99 others); Sun, 4 Aug 2019 17:10:09 -0400 Received: from mail-pf1-f194.google.com ([209.85.210.194]:43268 "EHLO mail-pf1-f194.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726524AbfHDVKJ (ORCPT ); Sun, 4 Aug 2019 17:10:09 -0400 Received: by mail-pf1-f194.google.com with SMTP id i189so38530063pfg.10 for ; Sun, 04 Aug 2019 14:10:09 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=kernel-dk.20150623.gappssmtp.com; s=20150623; h=subject:to:cc:references:from:message-id:date:user-agent :mime-version:in-reply-to:content-language:content-transfer-encoding; bh=RsLNfmS1riphbJPtUn1FZXodxBgf3MWew0rC4SrjLhc=; b=IDUEuEW2thNdX//5/H2F7sIWdBZpzwE1O6fgv1+otLBbbuHoThgnTawqzNW8aPnw3d B6X+vHCkvE4JedFZgs0aTsnsewOxCuxkiDOQVxXTXEL4lonTiNdZTUy4hrV8X8Hb4507 XIFsHdU9Bu9kcs+7+8diRJZsWqLf0QEuPuRQa99t+GY+iArR8lz3oJkum15ZXc5LkQdn p3Teh5pCNBl/IKhlUeulDUMuWKUshluSEPZDMs7DkQf/ZpO81nnzrbc1hw61SxY6MXPf B8n7qugBxHfBrBZXdPZfczxx7hI/Cun7fcS8KH8rRMlBLT0UHWUNWWaXszAwpVQ99mNU M8CA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:subject:to:cc:references:from:message-id:date :user-agent:mime-version:in-reply-to:content-language :content-transfer-encoding; bh=RsLNfmS1riphbJPtUn1FZXodxBgf3MWew0rC4SrjLhc=; b=QAebsh/XEUovasS6R+NIWq7zaBmEnj/kYBSH4PuEs9Y+jfo6DvuXYZWQPwjory/LSJ ubR3tZ4ql6tO+YySFlZ6llOK5dazSWSI3lPAPgUnLxI/yMTQb9+roE3F634A1XL7cidY +oKP+vJfQbMKUHi9W3PlyqGutRkBZKEZMHVu3nwBh8QpLNPHg7ts7yZS/RTyYhTg23sX cEPLMMjDAYsu5LLUqGa1EylizbXTdusUOAvG0+wkh8WfecEy+oWn8LYwodNvm1HqMzSj nh4IDB8kDEc1qdj1zqF6w910+7Jq0YJL5bXApPpzSDLzmee4CLxtGHDYR1W7oV+kP9DB C0pQ== X-Gm-Message-State: APjAAAWAIvsbglSgd2iGFukpr/t64eirqyNm6h2SZ0dj0yhSBr50c4NR uN0t0hNLSZL3+X3GQKG04+Y= X-Received: by 2002:a63:d741:: with SMTP id w1mr57597909pgi.155.1564953008652; Sun, 04 Aug 2019 14:10:08 -0700 (PDT) Received: from ?IPv6:2605:e000:100e:83a1:9dbb:3084:352a:9279? ([2605:e000:100e:83a1:9dbb:3084:352a:9279]) by smtp.gmail.com with ESMTPSA id r7sm96307993pfl.134.2019.08.04.14.10.06 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Sun, 04 Aug 2019 14:10:07 -0700 (PDT) Subject: Re: [PATCH 1/1] block: Use bits.h macros to improve readability To: Joe Perches , Leonardo Bras , linux-kernel@vger.kernel.org Cc: Dennis Zhou , Hannes Reinecke , Damien Le Moal , Tejun Heo , "Dennis Zhou (Facebook)" , Johannes Thumshirn , Sagi Grimberg References: <20190802000041.24513-1-leonardo@linux.ibm.com> <15450f6ba169de8862e11bc2d20b3645958f4efd.camel@perches.com> From: Jens Axboe Message-ID: Date: Sun, 4 Aug 2019 14:10:05 -0700 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:60.0) Gecko/20100101 Thunderbird/60.8.0 MIME-Version: 1.0 In-Reply-To: <15450f6ba169de8862e11bc2d20b3645958f4efd.camel@perches.com> Content-Type: text/plain; charset=utf-8 Content-Language: en-US Content-Transfer-Encoding: 7bit Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On 8/4/19 1:17 PM, Joe Perches wrote: > On Fri, 2019-08-02 at 21:18 -0700, Jens Axboe wrote: >> On 8/1/19 6:00 PM, Leonardo Bras wrote: >>> Applies some bits.h macros in order to improve readability of >>> linux/blk_types.h. > [] >> I know precisely what that does, whereas I have to think about the other >> one, maybe even look it up to be sure. For instance, without looking >> now, I have no idea what the second argument is. Looking at the git log, >> I see numerous instances of: > > While I'm not at all a proponent of GENMASK/GENMASK_ULL, > and so not a proponent of this patch, latent defects are > possible in both cases. > > You'd likely have to look at SOME_SHIFT to see if it's 0 > to verify the actual mask is what's really desired. > > $ git grep -P '_SHIFT\s+\(?\s*0\s*\)?\b' | wc -l > 11907 Usually SOME_SHIFT is either a numeric value, and you already know, or it's part of a series of enums/defines (like in the case that's being done here) where you already have prior knowledge about the values. For those cases, GENMASK/GENMASK_ULL adds nothing imho, it only makes it less readable and more error prone. -- Jens Axboe