Message ID | 20230628093500.68779-1-frank.li@vivo.com |
---|---|
State | New |
Headers |
Return-Path: <linux-kernel-owner@vger.kernel.org> Delivered-To: ouuuleilei@gmail.com Received: by 2002:a59:994d:0:b0:3d9:f83d:47d9 with SMTP id k13csp8796528vqr; Wed, 28 Jun 2023 02:51:30 -0700 (PDT) X-Google-Smtp-Source: ACHHUZ7CuinaP6Hm4uid6nm7bUGKlkslcrzaRvh1YlDhfPWB115ABr9TwUGQN+0bafZ02uxkWZff X-Received: by 2002:a92:d243:0:b0:345:79eb:e005 with SMTP id v3-20020a92d243000000b0034579ebe005mr11428593ilg.16.1687945890060; Wed, 28 Jun 2023 02:51:30 -0700 (PDT) ARC-Seal: i=2; a=rsa-sha256; t=1687945890; cv=pass; d=google.com; s=arc-20160816; b=IAi+JaIGsAdT9QOxEAYQ/UoSrDkRPiWm9/Esg7Df5j7T0uMKKNLufiLb9NePodurwm t/xv45qANUgsKVsQJRL6vask1WI6MUfAgTlkOh7AK9RYzqmuYOv4u44od5QOmUuskr+u peXihgU41uPA65pKqADGl5r5FhqW4ReIeeSnNUVV9S+0vA2wtbIx8MDgpE9HdP0zCGEB ASzZ2XBRA2XyyzpfwePD2ieK8ot4dRg7LV7lmiYHHWzaeJpAqFwZyN9xttVO0XFX2wMZ 6hiegPtkm18PF1yPaDbASt92CTI48BffP41lUEmfisbAXjd2EjBO70lfHIAyb1AXkGRV aPRA== ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:mime-version:content-transfer-encoding :message-id:date:subject:cc:to:from:dkim-signature; bh=pSkxOAJdOVpvqaie33NOoEzGy7YAHeasGwTqp/veHZw=; fh=xqK608XVEI/qdjr/e80ya8yupN75wOPt0gzvnrTRgaA=; b=u4JDsTFj4R+400kf533XVl8Xfpu95dIjEXY/IE4eggKHwUDnbE6znAfLa807ZhliUl cyqZaQf1pdVKB8wAyBoSEn8CStY+lMk+Kh1m6yJZqNoERe38rCK5zj2V3Xo3a88tZsAr iWhsBujGNnoB4H2wyr7erPp1oLRSniFGgBgijv1fIIBcgCNccihoW2L4wK/DpnGhKTtT N42XyGfSPzcnP2/v/UDbjbuWyXXmAi+amHQcgcJUSmsLBkumNtjfCUpNGfXGkvyW5p3j R/vbul8XP4TqeYVMMe51s0vWnJuCe8kG4DEhdd32bx3oXDCaPDpKLLJi5NBKYxgAv0YF IDrg== ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@vivo.com header.s=selector2 header.b=L6AZ07aa; arc=pass (i=1 spf=pass spfdomain=vivo.com dkim=pass dkdomain=vivo.com dmarc=pass fromdomain=vivo.com); spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=QUARANTINE sp=QUARANTINE dis=NONE) header.from=vivo.com Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id r12-20020a63514c000000b0054fdb063301si8844515pgl.252.2023.06.28.02.51.17; Wed, 28 Jun 2023 02:51:30 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; dkim=pass header.i=@vivo.com header.s=selector2 header.b=L6AZ07aa; arc=pass (i=1 spf=pass spfdomain=vivo.com dkim=pass dkdomain=vivo.com dmarc=pass fromdomain=vivo.com); spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=QUARANTINE sp=QUARANTINE dis=NONE) header.from=vivo.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S232107AbjF1JtM (ORCPT <rfc822;adanhawthorn@gmail.com> + 99 others); Wed, 28 Jun 2023 05:49:12 -0400 Received: from mail-sgaapc01on2132.outbound.protection.outlook.com ([40.107.215.132]:35171 "EHLO APC01-SG2-obe.outbound.protection.outlook.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S235611AbjF1JfX (ORCPT <rfc822;linux-kernel@vger.kernel.org>); Wed, 28 Jun 2023 05:35:23 -0400 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=FihmbyJ447UudSt4IqGYfK3PAjBxiPCAzZtt/PHxzhrFnQUC/zbwWNspaX4UhrCfWJOVGGh31J/gMuwuu98fle4dMmdqJTZIQCggqeXXUOXmd7zRLFYdg8l4fmItAogvO9kidHDvEGMk7WcADjAH4MXqLT+D5Ufcoz9lGVoRmszb6LGqZ6Tn9mkvNJy5YBHf8PssHfOJxqMYu0CS9gK3/VkkWVFweORctJpGQAQ6Ldji9RxIU45UnDbhPDGa0JJcF1kvH7+RzlhqKda/efCL5aHx+tmzHnCsKgEVuGgOvmiEYwhKVTPzYcjzAu5tMj3YiJm75sdOsfZJq1H0VNW7nQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=microsoft.com; s=arcselector9901; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-AntiSpam-MessageData-ChunkCount:X-MS-Exchange-AntiSpam-MessageData-0:X-MS-Exchange-AntiSpam-MessageData-1; bh=pSkxOAJdOVpvqaie33NOoEzGy7YAHeasGwTqp/veHZw=; b=X3tsk6u9INgaIgcjdOO8RENYQ0BpyDTF0PTFxjXsIj3mGrfMohsn/tYF0Mx8K0Rmc4Y6RncKfX2K0uKAqZzZgbah2Z2GZOCmfk/eiomGgQ85MsjiSRHYOQ1WtlOzXfZ0AABP7qQQZD1oml/7IQvUdCWQb8ZVIpxOm5QuKty6GVcP7H2RPJxHwCxH2mt/krxgHv4sLfbW8QGTNgAbavOMuM9jwQG4gSG/mc/BgDecqMMAGG6PixzOG7LASIdyR91+rr4RIBOWHCYDSYJbs0cQxTWuHpR7Tr6JhVz+cLWx2zJJyIYtXaGjJuLLlASzWOnXH8tVH0VCO9hykJFeyrbVOg== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass smtp.mailfrom=vivo.com; dmarc=pass action=none header.from=vivo.com; dkim=pass header.d=vivo.com; arc=none DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=vivo.com; s=selector2; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=pSkxOAJdOVpvqaie33NOoEzGy7YAHeasGwTqp/veHZw=; b=L6AZ07aa93uJqLyI/1wKgAubeBSqpn2wo1ZrU6y5gMc7QI5+ytkqCt0CbQK5OSKXZtoCUE9J1M90IfMWRwYQth9GyZlX4LLIw3VuuW2KeGhuyjhq8BCwLA1s4Az5gJykUsLdYMJ+XLVLbCi2HLVUDzM65X3F1N0GX3syR4gXEbp7OssqMsXQAhDkrC0xukP6QS5HrNAsi3EaYiMyKLtqnQEcAjFqdTbN4v8EPK5jWnEKillxaiCrOpBOKZOZ0sGR0N16TZajeGGgV9fdPoBva+rvrVJ1BAe2jZ3GNomfb0XRR6gfhytRRyQqBKdhH/++Pot3thru+fdBlPTTRi7Nqw== Authentication-Results: dkim=none (message not signed) header.d=none;dmarc=none action=none header.from=vivo.com; Received: from SEZPR06MB5269.apcprd06.prod.outlook.com (2603:1096:101:78::6) by TYZPR06MB6144.apcprd06.prod.outlook.com (2603:1096:400:341::8) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.6521.24; Wed, 28 Jun 2023 09:35:16 +0000 Received: from SEZPR06MB5269.apcprd06.prod.outlook.com ([fe80::fa0e:6c06:7474:285c]) by SEZPR06MB5269.apcprd06.prod.outlook.com ([fe80::fa0e:6c06:7474:285c%5]) with mapi id 15.20.6521.023; Wed, 28 Jun 2023 09:35:16 +0000 From: Yangtao Li <frank.li@vivo.com> To: axboe@kernel.dk, song@kernel.org, viro@zeniv.linux.org.uk, brauner@kernel.org, xiang@kernel.org, chao@kernel.org, huyue2@coolpad.com, jefflexu@linux.alibaba.com, hch@infradead.org, djwong@kernel.org Cc: linux-block@vger.kernel.org, linux-kernel@vger.kernel.org, linux-raid@vger.kernel.org, linux-fsdevel@vger.kernel.org, linux-erofs@lists.ozlabs.org, linux-xfs@vger.kernel.org, Yangtao Li <frank.li@vivo.com> Subject: [PATCH 1/7] block: add queue_logical_block_mask() and bdev_logical_block_mask() Date: Wed, 28 Jun 2023 17:34:54 +0800 Message-Id: <20230628093500.68779-1-frank.li@vivo.com> X-Mailer: git-send-email 2.39.0 Content-Transfer-Encoding: 8bit Content-Type: text/plain X-ClientProxiedBy: SI2PR04CA0004.apcprd04.prod.outlook.com (2603:1096:4:197::22) To SEZPR06MB5269.apcprd06.prod.outlook.com (2603:1096:101:78::6) MIME-Version: 1.0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: SEZPR06MB5269:EE_|TYZPR06MB6144:EE_ X-MS-Office365-Filtering-Correlation-Id: 46d1fe1b-14d9-47e4-8732-08db77bafa0c X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: 6WJnUJhgtFz1cQAx6KimKdsVgQAul6MWPn8FMkG7/atdPgSj/vvac4W5rxg+iQngOUhvzmY1KtmVcaFefX76kcnDBpw1N3sJ2bW1nShRDVG6+gYlldytiWOvWggEESmQo77Yg87nZW9g6TJaxldwgGLxJTN1Fcqkj/iga/iNl4xaYvNVWfSeuuiqOPglv9zzCz/ad/S2029igzgi+BIZFfm8ASJOeFTTb//SmLJkivcrV5kuznaN9UMhlXfUQk9v9CkXoFGTEVZAwnwDMthmMjF830Xpos0oDtvsLc8RmhnqJzmj4c0onz46hMSsZv2lYqDE2Jo6uhEairF2PodZAWOTgVCN2yDFbeeGPtvl/WLvMwZyzoxoSbHilXvTVIfvvct8F6Cgr2xkYSi0s/fkDg8M9LQY6NiZzC2hnXDZ4pOY2qyDns1SpuEBmrVQoHMGRztbIo6CfBWiLhjDqv3sz55HOvkH82noICcIpEonSkWyyI33Lvgr0mEOiUgRHz1pcbiSkFPjCqTdAQDibqccmd5Hcahcm/2f6MeengiQP1xfxPFbANp6jZUPsd3W2dKUyhMawlWcllckd4qQLuxrMgV8TbbONkFeyyjhkl4HMuGE6YTVW2RlH7sf024t9NL2jg/SWR9hAOq7YFgzhuwFvA== X-Forefront-Antispam-Report: CIP:255.255.255.255;CTRY:;LANG:en;SCL:1;SRV:;IPV:NLI;SFV:NSPM;H:SEZPR06MB5269.apcprd06.prod.outlook.com;PTR:;CAT:NONE;SFS:(13230028)(4636009)(396003)(346002)(39850400004)(376002)(366004)(136003)(451199021)(1076003)(6506007)(7416002)(5660300002)(66556008)(316002)(66946007)(36756003)(478600001)(4326008)(66476007)(8676002)(8936002)(86362001)(2906002)(6512007)(26005)(41300700001)(6666004)(6486002)(52116002)(186003)(107886003)(38350700002)(38100700002)(921005)(2616005)(83380400001);DIR:OUT;SFP:1102; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: Fop9vj2S4TkPyc51TwtDcXQqV58t1rxqS3TJgL3iujulKptyoKVRreF3KejSyMPI2fp50p4DZnQo27J5wWp+4X7GsWepfvVisDSt0ZzoiHWFXFwHdOZ9Aw8tMf44a0qJHsPfah6UXL+w5OZxEDwtNDnudF2RK0oTcjhuKKI84X7S2gCf1sFtmZ5vO/f1cajB/YEQGvr6SAlne720fzfelme61MUBTTYwYSrI+dqybyGFypkJWvnpXcH3JBgHX5FJZslcpHf9MWP0/KkY4bK1hA9/dqpWJwQCayy0BEbIjgVdct/akptC0ZTzrMR3J1ilRQR2H3ygdERQiVs3+GI5NhbUIhjZY/sGa9KNURU8KwgcUBy7jIVgF9tyZVhdnUYzGzKaIswSvM36LbNgsx0eeKRTuJLwAy+cvOzvpoF0scJ/SC2FTVm3x2xrj32h2iVtPYLjXjpCz4y2Rnpo2Q7VU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Ep7NrJ97eeeAk+01R79wbI3WGe2NryFdHnta7FooZ0o4pJ+1GqCA7e X-OriginatorOrg: vivo.com X-MS-Exchange-CrossTenant-Network-Message-Id: 46d1fe1b-14d9-47e4-8732-08db77bafa0c X-MS-Exchange-CrossTenant-AuthSource: SEZPR06MB5269.apcprd06.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 28 Jun 2023 09:35:15.6511 (UTC) X-MS-Exchange-CrossTenant-FromEntityHeader: Hosted X-MS-Exchange-CrossTenant-Id: 923e42dc-48d5-4cbe-b582-1a797a6412ed X-MS-Exchange-CrossTenant-MailboxType: HOSTED X-MS-Exchange-CrossTenant-UserPrincipalName: 0gvVjgag0e6ZHoovRVcPOUPSffQpa07qYtUQkKaP95a/P6axewaW4czLSmACfPE2Ac4W2pH9K05EfWwTVtsrsQ== X-MS-Exchange-Transport-CrossTenantHeadersStamped: TYZPR06MB6144 Precedence: bulk List-ID: <linux-kernel.vger.kernel.org> X-Mailing-List: linux-kernel@vger.kernel.org X-getmail-retrieved-from-mailbox: =?utf-8?q?INBOX?= X-GMAIL-THRID: =?utf-8?q?1769939549528586196?= X-GMAIL-MSGID: =?utf-8?q?1769939549528586196?= |
Series |
[1/7] block: add queue_logical_block_mask() and bdev_logical_block_mask()
|
|
Commit Message
李扬韬
June 28, 2023, 9:34 a.m. UTC
Introduce queue_logical_block_mask() and bdev_logical_block_mask()
to simplify code, which replace (queue_logical_block_size(q) - 1)
and (bdev_logical_block_size(bdev) - 1).
Signed-off-by: Yangtao Li <frank.li@vivo.com>
---
include/linux/blkdev.h | 10 ++++++++++
1 file changed, 10 insertions(+)
Comments
On Wed, Jun 28, 2023 at 05:34:54PM +0800, Yangtao Li wrote: > Introduce queue_logical_block_mask() and bdev_logical_block_mask() > to simplify code, which replace (queue_logical_block_size(q) - 1) > and (bdev_logical_block_size(bdev) - 1). > > Signed-off-by: Yangtao Li <frank.li@vivo.com> Looks fine. Reviewed-by: Bill O'Donnell <bodonnel@redhat.com> > --- > include/linux/blkdev.h | 10 ++++++++++ > 1 file changed, 10 insertions(+) > > diff --git a/include/linux/blkdev.h b/include/linux/blkdev.h > index ed44a997f629..0cc0d1694ef6 100644 > --- a/include/linux/blkdev.h > +++ b/include/linux/blkdev.h > @@ -1150,11 +1150,21 @@ static inline unsigned queue_logical_block_size(const struct request_queue *q) > return retval; > } > > +static inline unsigned int queue_logical_block_mask(const struct request_queue *q) > +{ > + return queue_logical_block_size(q) - 1; > +} > + > static inline unsigned int bdev_logical_block_size(struct block_device *bdev) > { > return queue_logical_block_size(bdev_get_queue(bdev)); > } > > +static inline unsigned int bdev_logical_block_mask(struct block_device *bdev) > +{ > + return bdev_logical_block_size(bdev) - 1; > +} > + > static inline unsigned int queue_physical_block_size(const struct request_queue *q) > { > return q->limits.physical_block_size; > -- > 2.39.0 >
On Wed, Jun 28, 2023 at 05:34:54PM +0800, Yangtao Li wrote: > Introduce queue_logical_block_mask() and bdev_logical_block_mask() > to simplify code, which replace (queue_logical_block_size(q) - 1) > and (bdev_logical_block_size(bdev) - 1). The thing is that I know what queue_logical_block_size - 1 does. That's the low bits. _Which_ bits are queue_logical_block_mask? The high bits or the low bits? And before you say "It's obviously", we have both ways round in the kernel today. I am not in favour of this change. I might be in favour of bool queue_logical_block_aligned(q, x), but even then it doesn't seem worth the bits.
On 2023/6/29 0:46, Matthew Wilcox wrote: > On Wed, Jun 28, 2023 at 05:34:54PM +0800, Yangtao Li wrote: >> Introduce queue_logical_block_mask() and bdev_logical_block_mask() >> to simplify code, which replace (queue_logical_block_size(q) - 1) >> and (bdev_logical_block_size(bdev) - 1). > The thing is that I know what queue_logical_block_size - 1 does. > That's the low bits. _Which_ bits are queue_logical_block_mask? > The high bits or the low bits? And before you say "It's obviously", > we have both ways round in the kernel today. I guess for this you mentioned, can we name it bdev_logical_block_lmask and queue_logical_block_lmask? Thx, > > I am not in favour of this change. I might be in favour of bool > queue_logical_block_aligned(q, x), but even then it doesn't seem worth > the bits.
On Thu, Jun 29, 2023 at 11:44:35AM +0800, Yangtao Li wrote: > On 2023/6/29 0:46, Matthew Wilcox wrote: > > > On Wed, Jun 28, 2023 at 05:34:54PM +0800, Yangtao Li wrote: > > > Introduce queue_logical_block_mask() and bdev_logical_block_mask() > > > to simplify code, which replace (queue_logical_block_size(q) - 1) > > > and (bdev_logical_block_size(bdev) - 1). > > The thing is that I know what queue_logical_block_size - 1 does. > > That's the low bits. _Which_ bits are queue_logical_block_mask? > > The high bits or the low bits? And before you say "It's obviously", > > we have both ways round in the kernel today. > > > I guess for this you mentioned, can we name it bdev_logical_block_lmask and > queue_logical_block_lmask? {bdev,queue}_offset_in_lba() ? --D > > Thx, > > > > > I am not in favour of this change. I might be in favour of bool > > queue_logical_block_aligned(q, x), but even then it doesn't seem worth > > the bits.
What is the value add of this series?
diff --git a/include/linux/blkdev.h b/include/linux/blkdev.h index ed44a997f629..0cc0d1694ef6 100644 --- a/include/linux/blkdev.h +++ b/include/linux/blkdev.h @@ -1150,11 +1150,21 @@ static inline unsigned queue_logical_block_size(const struct request_queue *q) return retval; } +static inline unsigned int queue_logical_block_mask(const struct request_queue *q) +{ + return queue_logical_block_size(q) - 1; +} + static inline unsigned int bdev_logical_block_size(struct block_device *bdev) { return queue_logical_block_size(bdev_get_queue(bdev)); } +static inline unsigned int bdev_logical_block_mask(struct block_device *bdev) +{ + return bdev_logical_block_size(bdev) - 1; +} + static inline unsigned int queue_physical_block_size(const struct request_queue *q) { return q->limits.physical_block_size;