[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-Id: <20211013051042.1065752-7-hch@lst.de>
Date: Wed, 13 Oct 2021 07:10:19 +0200
From: Christoph Hellwig <hch@....de>
To: Jens Axboe <axboe@...nel.dk>
Cc: Coly Li <colyli@...e.de>, Mike Snitzer <snitzer@...hat.com>,
Song Liu <song@...nel.org>, David Sterba <dsterba@...e.com>,
Josef Bacik <josef@...icpanda.com>,
"Theodore Ts'o" <tytso@....edu>,
OGAWA Hirofumi <hirofumi@...l.parknet.co.jp>,
Dave Kleikamp <shaggy@...nel.org>,
Ryusuke Konishi <konishi.ryusuke@...il.com>,
Anton Altaparmakov <anton@...era.com>,
Konstantin Komarov <almaz.alexandrovich@...agon-software.com>,
Kees Cook <keescook@...omium.org>,
Phillip Lougher <phillip@...ashfs.org.uk>,
Jan Kara <jack@...e.com>, linux-block@...r.kernel.org,
dm-devel@...hat.com, drbd-dev@...ts.linbit.com,
linux-bcache@...r.kernel.org, linux-raid@...r.kernel.org,
linux-mtd@...ts.infradead.org, linux-nvme@...ts.infradead.org,
linux-scsi@...r.kernel.org, target-devel@...r.kernel.org,
linux-fsdevel@...r.kernel.org, linux-btrfs@...r.kernel.org,
linux-ext4@...r.kernel.org, jfs-discussion@...ts.sourceforge.net,
linux-nfs@...r.kernel.org, linux-nilfs@...r.kernel.org,
linux-ntfs-dev@...ts.sourceforge.net, ntfs3@...ts.linux.dev,
reiserfs-devel@...r.kernel.org
Subject: [PATCH 06/29] nvmet: use bdev_nr_sectors instead of open coding it
Use the proper helper to read the block device size.
Signed-off-by: Christoph Hellwig <hch@....de>
---
drivers/nvme/target/io-cmd-bdev.c | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)
diff --git a/drivers/nvme/target/io-cmd-bdev.c b/drivers/nvme/target/io-cmd-bdev.c
index 6139e1de50a66..683246303f62e 100644
--- a/drivers/nvme/target/io-cmd-bdev.c
+++ b/drivers/nvme/target/io-cmd-bdev.c
@@ -87,7 +87,7 @@ int nvmet_bdev_ns_enable(struct nvmet_ns *ns)
ns->bdev = NULL;
return ret;
}
- ns->size = i_size_read(ns->bdev->bd_inode);
+ ns->size = bdev_nr_sectors(ns->bdev) << SECTOR_SHIFT;
ns->blksize_shift = blksize_bits(bdev_logical_block_size(ns->bdev));
ns->pi_type = 0;
@@ -108,7 +108,7 @@ int nvmet_bdev_ns_enable(struct nvmet_ns *ns)
void nvmet_bdev_ns_revalidate(struct nvmet_ns *ns)
{
- ns->size = i_size_read(ns->bdev->bd_inode);
+ ns->size = bdev_nr_sectors(ns->bdev) << SECTOR_SHIFT;
}
u16 blk_to_nvme_status(struct nvmet_req *req, blk_status_t blk_sts)
--
2.30.2
Powered by blists - more mailing lists