From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from mgw-01.mpynet.fi (mgw-01.mpynet.fi [82.197.21.90]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id A37D12C81 for ; Fri, 15 Oct 2021 14:36:08 +0000 (UTC) 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 19FEWINE065735; Fri, 15 Oct 2021 17:35:41 +0300 Received: from ex13.tuxera.com (ex13.tuxera.com [178.16.184.72]) by mgw-01.mpynet.fi with ESMTP id 3bqa6fr1mk-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-SHA384 bits=256 verify=NOT); Fri, 15 Oct 2021 17:35:41 +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:35:40 +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:35:40 +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 28/30] ntfs: use sb_bdev_nr_blocks Thread-Topic: [PATCH 28/30] ntfs: use sb_bdev_nr_blocks Thread-Index: AQHXwch+sOYTA5n1EU2k5d07nGAE/6vT7f2A Date: Fri, 15 Oct 2021 14:35:40 +0000 Message-ID: <7644804B-2081-4A1E-A40D-9A5C7BF72E2E@tuxera.com> References: <20211015132643.1621913-1-hch@lst.de> <20211015132643.1621913-29-hch@lst.de> In-Reply-To: <20211015132643.1621913-29-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: <3668CC17B52D274985AE4DAF6C11620E@ex13.tuxera.com> Content-Transfer-Encoding: quoted-printable Precedence: bulk X-Mailing-List: ntfs3@lists.linux.dev List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 X-Proofpoint-ORIG-GUID: 4ZKrI-UQqOuYdNTfa7YqNKQX-GuzVYXg X-Proofpoint-GUID: 4ZKrI-UQqOuYdNTfa7YqNKQX-GuzVYXg 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=999 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 Hi Christoph, Looks good, thank you. Best regards, Anton > On 15 Oct 2021, at 14:26, Christoph Hellwig wrote: >=20 > Use the sb_bdev_nr_blocks helper instead of open coding it and clean up > ntfs_fill_super a bit by moving an assignment a little earlier that has > no negative side effects. >=20 > Signed-off-by: Christoph Hellwig > Reviewed-by: Kees Cook Acked-by: Anton Altaparmakov > --- > fs/ntfs/super.c | 8 +++----- > 1 file changed, 3 insertions(+), 5 deletions(-) >=20 > diff --git a/fs/ntfs/super.c b/fs/ntfs/super.c > index 0d7e948cb29c9..5ae8de09b271b 100644 > --- a/fs/ntfs/super.c > +++ b/fs/ntfs/super.c > @@ -2772,13 +2772,12 @@ static int ntfs_fill_super(struct super_block *sb= , void *opt, const int silent) > ntfs_debug("Set device block size to %i bytes (block size bits %i).", > blocksize, sb->s_blocksize_bits); > /* Determine the size of the device in units of block_size bytes. */ > - if (!i_size_read(sb->s_bdev->bd_inode)) { > + vol->nr_blocks =3D sb_bdev_nr_blocks(sb); > + if (!vol->nr_blocks) { > if (!silent) > ntfs_error(sb, "Unable to determine device size."); > goto err_out_now; > } > - vol->nr_blocks =3D i_size_read(sb->s_bdev->bd_inode) >> > - sb->s_blocksize_bits; > /* Read the boot sector and return unlocked buffer head to it. */ > if (!(bh =3D read_ntfs_boot_sector(sb, silent))) { > if (!silent) > @@ -2816,8 +2815,7 @@ static int ntfs_fill_super(struct super_block *sb, = void *opt, const int silent) > goto err_out_now; > } > BUG_ON(blocksize !=3D sb->s_blocksize); > - vol->nr_blocks =3D i_size_read(sb->s_bdev->bd_inode) >> > - sb->s_blocksize_bits; > + vol->nr_blocks =3D sb_bdev_nr_blocks(sb); > ntfs_debug("Changed device block size to %i bytes (block size " > "bits %i) to match volume sector size.", > blocksize, sb->s_blocksize_bits); > --=20 > 2.30.2 >=20 --=20 Anton Altaparmakov (replace at with @) Lead in File System Development, Tuxera Inc., http://www.tuxera.com/ Linux NTFS maintainer 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 C446AC433FE for ; Mon, 18 Oct 2021 07:34:52 +0000 (UTC) Received: from us-smtp-delivery-124.mimecast.com (us-smtp-delivery-124.mimecast.com [216.205.24.124]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPS id 9AE6F6124F for ; Mon, 18 Oct 2021 07:34:51 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.4.1 mail.kernel.org 9AE6F6124F Authentication-Results: mail.kernel.org; dmarc=none (p=none dis=none) header.from=tuxera.com Authentication-Results: mail.kernel.org; spf=pass smtp.mailfrom=redhat.com Received: from mimecast-mx01.redhat.com (mimecast-mx01.redhat.com [209.132.183.4]) (Using TLS) by relay.mimecast.com with ESMTP id us-mta-425-5GATHqALMKmwVZonYIvGaA-1; Mon, 18 Oct 2021 03:34:47 -0400 X-MC-Unique: 5GATHqALMKmwVZonYIvGaA-1 Received: from smtp.corp.redhat.com (int-mx01.intmail.prod.int.phx2.redhat.com [10.5.11.11]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx01.redhat.com (Postfix) with ESMTPS id 0A85015875A3; Mon, 18 Oct 2021 07:34:43 +0000 (UTC) Received: from colo-mx.corp.redhat.com (colo-mx02.intmail.prod.int.phx2.redhat.com [10.5.11.21]) by smtp.corp.redhat.com (Postfix) with ESMTPS id 9E9DD60657; Mon, 18 Oct 2021 07:34:42 +0000 (UTC) Received: from lists01.pubmisc.prod.ext.phx2.redhat.com (lists01.pubmisc.prod.ext.phx2.redhat.com [10.5.19.33]) by colo-mx.corp.redhat.com (Postfix) with ESMTP id 1DC084A703; Mon, 18 Oct 2021 07:34:41 +0000 (UTC) Received: from smtp.corp.redhat.com (int-mx02.intmail.prod.int.rdu2.redhat.com [10.11.54.2]) by lists01.pubmisc.prod.ext.phx2.redhat.com (8.13.8/8.13.8) with ESMTP id 19FEaeRq030733 for ; Fri, 15 Oct 2021 10:36:40 -0400 Received: by smtp.corp.redhat.com (Postfix) id 38ECE404727A; Fri, 15 Oct 2021 14:36:40 +0000 (UTC) Received: from mimecast-mx02.redhat.com (mimecast04.extmail.prod.ext.rdu2.redhat.com [10.11.55.20]) by smtp.corp.redhat.com (Postfix) with ESMTPS id 348E04047272 for ; Fri, 15 Oct 2021 14:36:40 +0000 (UTC) Received: from us-smtp-1.mimecast.com (us-smtp-1.mimecast.com [205.139.110.61]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mimecast-mx02.redhat.com (Postfix) with ESMTPS id 1D8F5106655B for ; Fri, 15 Oct 2021 14:36:40 +0000 (UTC) Received: from mgw-01.mpynet.fi (mgw-01.mpynet.fi [82.197.21.90]) (Using TLS) by relay.mimecast.com with ESMTP id us-mta-444-pcuAC0GNPyOgQF4lPiKxGg-1; Fri, 15 Oct 2021 10:36:37 -0400 X-MC-Unique: pcuAC0GNPyOgQF4lPiKxGg-1 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 19FEWINE065735; Fri, 15 Oct 2021 17:35:41 +0300 Received: from ex13.tuxera.com (ex13.tuxera.com [178.16.184.72]) by mgw-01.mpynet.fi with ESMTP id 3bqa6fr1mk-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-SHA384 bits=256 verify=NOT); Fri, 15 Oct 2021 17:35:41 +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:35:40 +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:35:40 +0300 From: Anton Altaparmakov To: Christoph Hellwig Thread-Topic: [PATCH 28/30] ntfs: use sb_bdev_nr_blocks Thread-Index: AQHXwch+sOYTA5n1EU2k5d07nGAE/6vT7f2A Date: Fri, 15 Oct 2021 14:35:40 +0000 Message-ID: <7644804B-2081-4A1E-A40D-9A5C7BF72E2E@tuxera.com> References: <20211015132643.1621913-1-hch@lst.de> <20211015132643.1621913-29-hch@lst.de> In-Reply-To: <20211015132643.1621913-29-hch@lst.de> Accept-Language: en-GB, 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] MIME-Version: 1.0 X-Proofpoint-ORIG-GUID: 4ZKrI-UQqOuYdNTfa7YqNKQX-GuzVYXg X-Proofpoint-GUID: 4ZKrI-UQqOuYdNTfa7YqNKQX-GuzVYXg 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=999 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 X-Mimecast-Impersonation-Protect: Policy=CLT - Impersonation Protection Definition; Similar Internal Domain=false; Similar Monitored External Domain=false; Custom External Domain=false; Mimecast External Domain=false; Newly Observed Domain=false; Internal User Name=false; Custom Display Name List=false; Reply-to Address Mismatch=false; Targeted Threat Dictionary=false; Mimecast Threat Dictionary=false; Custom Threat Dictionary=false X-Scanned-By: MIMEDefang 2.84 on 10.11.54.2 X-MIME-Autoconverted: from quoted-printable to 8bit by lists01.pubmisc.prod.ext.phx2.redhat.com id 19FEaeRq030733 X-loop: dm-devel@redhat.com X-Mailman-Approved-At: Mon, 18 Oct 2021 03:34:40 -0400 Cc: Dave Kleikamp , "jfs-discussion@lists.sourceforge.net" , Mike Snitzer , "linux-nvme@lists.infradead.org" , Konstantin Komarov , Song Liu , "dm-devel@redhat.com" , "target-devel@vger.kernel.org" , "reiserfs-devel@vger.kernel.org" , "drbd-dev@lists.linbit.com" , "linux-nilfs@vger.kernel.org" , "linux-scsi@vger.kernel.org" , "linux-ext4@vger.kernel.org" , Kees Cook , Josef Bacik , Coly Li , "linux-raid@vger.kernel.org" , "linux-bcache@vger.kernel.org" , David Sterba , Ryusuke Konishi , OGAWA Hirofumi , Jens Axboe , "linux-block@vger.kernel.org" , "linux-nfs@vger.kernel.org" , Theodore Ts'o , "linux-ntfs-dev@lists.sourceforge.net" , Jan Kara , "linux-fsdevel@vger.kernel.org" , Phillip Lougher , "ntfs3@lists.linux.dev" , "linux-btrfs@vger.kernel.org" Subject: Re: [dm-devel] [PATCH 28/30] ntfs: use sb_bdev_nr_blocks X-BeenThere: dm-devel@redhat.com X-Mailman-Version: 2.1.12 Precedence: junk List-Id: device-mapper development List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: dm-devel-bounces@redhat.com Errors-To: dm-devel-bounces@redhat.com X-Scanned-By: MIMEDefang 2.79 on 10.5.11.11 Authentication-Results: relay.mimecast.com; auth=pass smtp.auth=CUSA124A263 smtp.mailfrom=dm-devel-bounces@redhat.com X-Mimecast-Spam-Score: 0 X-Mimecast-Originator: redhat.com Content-Language: en-US Content-ID: <3668CC17B52D274985AE4DAF6C11620E@ex13.tuxera.com> Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit Hi Christoph, Looks good, thank you. Best regards, Anton > On 15 Oct 2021, at 14:26, Christoph Hellwig wrote: > > Use the sb_bdev_nr_blocks helper instead of open coding it and clean up > ntfs_fill_super a bit by moving an assignment a little earlier that has > no negative side effects. > > Signed-off-by: Christoph Hellwig > Reviewed-by: Kees Cook Acked-by: Anton Altaparmakov > --- > fs/ntfs/super.c | 8 +++----- > 1 file changed, 3 insertions(+), 5 deletions(-) > > diff --git a/fs/ntfs/super.c b/fs/ntfs/super.c > index 0d7e948cb29c9..5ae8de09b271b 100644 > --- a/fs/ntfs/super.c > +++ b/fs/ntfs/super.c > @@ -2772,13 +2772,12 @@ static int ntfs_fill_super(struct super_block *sb, void *opt, const int silent) > ntfs_debug("Set device block size to %i bytes (block size bits %i).", > blocksize, sb->s_blocksize_bits); > /* Determine the size of the device in units of block_size bytes. */ > - if (!i_size_read(sb->s_bdev->bd_inode)) { > + vol->nr_blocks = sb_bdev_nr_blocks(sb); > + if (!vol->nr_blocks) { > if (!silent) > ntfs_error(sb, "Unable to determine device size."); > goto err_out_now; > } > - vol->nr_blocks = i_size_read(sb->s_bdev->bd_inode) >> > - sb->s_blocksize_bits; > /* Read the boot sector and return unlocked buffer head to it. */ > if (!(bh = read_ntfs_boot_sector(sb, silent))) { > if (!silent) > @@ -2816,8 +2815,7 @@ static int ntfs_fill_super(struct super_block *sb, void *opt, const int silent) > goto err_out_now; > } > BUG_ON(blocksize != sb->s_blocksize); > - vol->nr_blocks = i_size_read(sb->s_bdev->bd_inode) >> > - sb->s_blocksize_bits; > + vol->nr_blocks = sb_bdev_nr_blocks(sb); > ntfs_debug("Changed device block size to %i bytes (block size " > "bits %i) to match volume sector size.", > blocksize, sb->s_blocksize_bits); > -- > 2.30.2 > -- Anton Altaparmakov (replace at with @) Lead in File System Development, Tuxera Inc., http://www.tuxera.com/ Linux NTFS maintainer -- dm-devel mailing list dm-devel@redhat.com https://listman.redhat.com/mailman/listinfo/dm-devel From mboxrd@z Thu Jan 1 00:00:00 1970 From: Anton Altaparmakov Subject: Re: [PATCH 28/30] ntfs: use sb_bdev_nr_blocks Date: Fri, 15 Oct 2021 14:35:40 +0000 Message-ID: <7644804B-2081-4A1E-A40D-9A5C7BF72E2E@tuxera.com> References: <20211015132643.1621913-1-hch@lst.de> <20211015132643.1621913-29-hch@lst.de> Mime-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 8BIT Return-path: In-Reply-To: <20211015132643.1621913-29-hch@lst.de> Content-Language: en-US Content-ID: <3668CC17B52D274985AE4DAF6C11620E@ex13.tuxera.com> List-ID: 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 Hi Christoph, Looks good, thank you. Best regards, Anton > On 15 Oct 2021, at 14:26, Christoph Hellwig wrote: > > Use the sb_bdev_nr_blocks helper instead of open coding it and clean up > ntfs_fill_super a bit by moving an assignment a little earlier that has > no negative side effects. > > Signed-off-by: Christoph Hellwig > Reviewed-by: Kees Cook Acked-by: Anton Altaparmakov > --- > fs/ntfs/super.c | 8 +++----- > 1 file changed, 3 insertions(+), 5 deletions(-) > > diff --git a/fs/ntfs/super.c b/fs/ntfs/super.c > index 0d7e948cb29c9..5ae8de09b271b 100644 > --- a/fs/ntfs/super.c > +++ b/fs/ntfs/super.c > @@ -2772,13 +2772,12 @@ static int ntfs_fill_super(struct super_block *sb, void *opt, const int silent) > ntfs_debug("Set device block size to %i bytes (block size bits %i).", > blocksize, sb->s_blocksize_bits); > /* Determine the size of the device in units of block_size bytes. */ > - if (!i_size_read(sb->s_bdev->bd_inode)) { > + vol->nr_blocks = sb_bdev_nr_blocks(sb); > + if (!vol->nr_blocks) { > if (!silent) > ntfs_error(sb, "Unable to determine device size."); > goto err_out_now; > } > - vol->nr_blocks = i_size_read(sb->s_bdev->bd_inode) >> > - sb->s_blocksize_bits; > /* Read the boot sector and return unlocked buffer head to it. */ > if (!(bh = read_ntfs_boot_sector(sb, silent))) { > if (!silent) > @@ -2816,8 +2815,7 @@ static int ntfs_fill_super(struct super_block *sb, void *opt, const int silent) > goto err_out_now; > } > BUG_ON(blocksize != sb->s_blocksize); > - vol->nr_blocks = i_size_read(sb->s_bdev->bd_inode) >> > - sb->s_blocksize_bits; > + vol->nr_blocks = sb_bdev_nr_blocks(sb); > ntfs_debug("Changed device block size to %i bytes (block size " > "bits %i) to match volume sector size.", > blocksize, sb->s_blocksize_bits); > -- > 2.30.2 > -- Anton Altaparmakov (replace at with @) Lead in File System Development, Tuxera Inc., http://www.tuxera.com/ Linux NTFS maintainer