linux-efi.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Christoph Hellwig <hch@lst.de>
To: Jens Axboe <axboe@kernel.dk>
Cc: Davidlohr Bueso <dave@stgolabs.net>,
	Stefan Haberland <sth@linux.ibm.com>,
	Jan Hoeppner <hoeppner@linux.ibm.com>,
	linux-block@vger.kernel.org, linux-efi@vger.kernel.org,
	linux-s390@vger.kernel.org
Subject: [PATCH 2/3] partitions/efi: use bdev_nr_bytes instead of open coding it
Date: Tue, 19 Oct 2021 08:20:23 +0200	[thread overview]
Message-ID: <20211019062024.2171074-3-hch@lst.de> (raw)
In-Reply-To: <20211019062024.2171074-1-hch@lst.de>

Use the proper helper to read the block device size.

Signed-off-by: Christoph Hellwig <hch@lst.de>
---
 block/partitions/efi.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/block/partitions/efi.c b/block/partitions/efi.c
index 7ca5c4c374d4d..5e9be13a56a82 100644
--- a/block/partitions/efi.c
+++ b/block/partitions/efi.c
@@ -133,7 +133,7 @@ efi_crc32(const void *buf, unsigned long len)
  */
 static u64 last_lba(struct gendisk *disk)
 {
-	return div_u64(disk->part0->bd_inode->i_size,
+	return div_u64(bdev_nr_bytes(disk->part0),
 		       queue_logical_block_size(disk->queue)) - 1ULL;
 }
 
-- 
2.30.2


  parent reply	other threads:[~2021-10-19  6:20 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-10-19  6:20 more bdev_nr_sectors / bdev_nr_bytes conversions Christoph Hellwig
2021-10-19  6:20 ` [PATCH 1/3] block/ioctl: use bdev_nr_sectors and bdev_nr_bytes Christoph Hellwig
2021-10-19  6:20 ` Christoph Hellwig [this message]
2021-10-19  6:20 ` [PATCH 3/3] partitions/ibm: use bdev_nr_sectors instead of open coding it Christoph Hellwig
2021-10-19  7:01   ` Ard Biesheuvel
2021-10-19 12:18 ` more bdev_nr_sectors / bdev_nr_bytes conversions Jens Axboe

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20211019062024.2171074-3-hch@lst.de \
    --to=hch@lst.de \
    --cc=axboe@kernel.dk \
    --cc=dave@stgolabs.net \
    --cc=hoeppner@linux.ibm.com \
    --cc=linux-block@vger.kernel.org \
    --cc=linux-efi@vger.kernel.org \
    --cc=linux-s390@vger.kernel.org \
    --cc=sth@linux.ibm.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).