From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id A067EC4332F for ; Fri, 15 Oct 2021 14:38:23 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id 7E76761027 for ; Fri, 15 Oct 2021 14:38:23 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S236262AbhJOOk2 convert rfc822-to-8bit (ORCPT ); Fri, 15 Oct 2021 10:40:28 -0400 Received: from mgw-01.mpynet.fi ([82.197.21.90]:38610 "EHLO mgw-01.mpynet.fi" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S233109AbhJOOk1 (ORCPT ); Fri, 15 Oct 2021 10:40:27 -0400 Received: from pps.filterd (mgw-01.mpynet.fi [127.0.0.1]) by mgw-01.mpynet.fi (8.16.0.43/8.16.0.43) with SMTP id 19FEWINI065735; Fri, 15 Oct 2021 17:37:43 +0300 Received: from ex13.tuxera.com (ex13.tuxera.com [178.16.184.72]) by mgw-01.mpynet.fi with ESMTP id 3bqa6fr1nj-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-SHA384 bits=256 verify=NOT); Fri, 15 Oct 2021 17:37:42 +0300 Received: from tuxera-exch.ad.tuxera.com (10.20.48.11) by tuxera-exch.ad.tuxera.com (10.20.48.11) with Microsoft SMTP Server (TLS) id 15.0.1497.23; Fri, 15 Oct 2021 17:37:42 +0300 Received: from tuxera-exch.ad.tuxera.com ([fe80::552a:f9f0:68c3:d789]) by tuxera-exch.ad.tuxera.com ([fe80::552a:f9f0:68c3:d789%12]) with mapi id 15.00.1497.023; Fri, 15 Oct 2021 17:37:42 +0300 From: Anton Altaparmakov To: Christoph Hellwig CC: Jens Axboe , Coly Li , Mike Snitzer , Song Liu , David Sterba , Josef Bacik , Theodore Ts'o , OGAWA Hirofumi , Dave Kleikamp , Ryusuke Konishi , "Konstantin Komarov" , Kees Cook , Phillip Lougher , Jan Kara , "linux-block@vger.kernel.org" , "dm-devel@redhat.com" , "drbd-dev@lists.linbit.com" , "linux-bcache@vger.kernel.org" , "linux-raid@vger.kernel.org" , "linux-nvme@lists.infradead.org" , "linux-scsi@vger.kernel.org" , "target-devel@vger.kernel.org" , "linux-fsdevel@vger.kernel.org" , "linux-btrfs@vger.kernel.org" , "linux-ext4@vger.kernel.org" , "jfs-discussion@lists.sourceforge.net" , "linux-nfs@vger.kernel.org" , "linux-nilfs@vger.kernel.org" , "linux-ntfs-dev@lists.sourceforge.net" , "ntfs3@lists.linux.dev" , "reiserfs-devel@vger.kernel.org" Subject: Re: [PATCH 02/30] block: add a bdev_nr_bytes helper Thread-Topic: [PATCH 02/30] block: add a bdev_nr_bytes helper Thread-Index: AQHXwchZP9onky8YCUWD+iMtrLLvTavT7o+A Date: Fri, 15 Oct 2021 14:37:41 +0000 Message-ID: <7C4AC4BD-B62D-41B3-AAF7-46125D1A1146@tuxera.com> References: <20211015132643.1621913-1-hch@lst.de> <20211015132643.1621913-3-hch@lst.de> In-Reply-To: <20211015132643.1621913-3-hch@lst.de> Accept-Language: en-GB, en-US Content-Language: en-US X-MS-Has-Attach: X-MS-TNEF-Correlator: x-ms-exchange-messagesentrepresentingtype: 1 x-ms-exchange-transport-fromentityheader: Hosted x-originating-ip: [109.154.241.177] Content-Type: text/plain; charset="us-ascii" Content-ID: Content-Transfer-Encoding: 8BIT MIME-Version: 1.0 X-Proofpoint-ORIG-GUID: H-3YelUF38QeF4AeejuL002U0EzCkK0i X-Proofpoint-GUID: H-3YelUF38QeF4AeejuL002U0EzCkK0i X-Proofpoint-Virus-Version: vendor=fsecure engine=2.50.10434:6.0.425,18.0.790 definitions=2021-10-15_04:2021-10-14,2021-10-15 signatures=0 X-Proofpoint-Spam-Details: rule=mpy_notspam policy=mpy score=0 phishscore=0 mlxlogscore=984 bulkscore=0 malwarescore=0 mlxscore=0 spamscore=0 adultscore=0 suspectscore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.12.0-2109230001 definitions=main-2110150089 Precedence: bulk List-ID: X-Mailing-List: linux-bcache@vger.kernel.org Hi Christoph, > On 15 Oct 2021, at 14:26, Christoph Hellwig wrote: > > Add a helpe to query the size of a block device in bytes. This > will be used to remove open coded access to ->bd_inode. Matthew already pointed out the return type for bdev_nr_bytes() but also your commit message has a typo: "Add a helpe" -> "Add a helper". Best regards, Anton > Signed-off-by: Christoph Hellwig > --- > include/linux/genhd.h | 7 ++++++- > 1 file changed, 6 insertions(+), 1 deletion(-) > > diff --git a/include/linux/genhd.h b/include/linux/genhd.h > index 082a3e5fd8fa1..f67db3c5a04b3 100644 > --- a/include/linux/genhd.h > +++ b/include/linux/genhd.h > @@ -235,9 +235,14 @@ static inline sector_t get_start_sect(struct block_device *bdev) > return bdev->bd_start_sect; > } > > +static inline sector_t bdev_nr_bytes(struct block_device *bdev) > +{ > + return i_size_read(bdev->bd_inode); > +} > + > static inline sector_t bdev_nr_sectors(struct block_device *bdev) > { > - return i_size_read(bdev->bd_inode) >> 9; > + return bdev_nr_bytes(bdev) >> SECTOR_SHIFT; > } > > static inline sector_t get_capacity(struct gendisk *disk) > -- > 2.30.2 >