Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > linux.kernel > #1432154 > unrolled thread

Re: [PATCH v2 1/3] block: provide helpers for reading block count

Started byDavidlohr Bueso <dave@stgolabs.net>
First post2016-06-27 18:40 +0200
Last post2016-06-27 18:40 +0200
Articles 1 — 1 participant

Back to article view | Back to linux.kernel

This discussion starts older than the indexed window; earlier articles aren't shown. The article labeled Started by below is the oldest one visible, not the original post.


Contents

  Re: [PATCH v2 1/3] block: provide helpers for reading block count Davidlohr Bueso <dave@stgolabs.net> - 2016-06-27 18:40 +0200

#1432154 — Re: [PATCH v2 1/3] block: provide helpers for reading block count

FromDavidlohr Bueso <dave@stgolabs.net>
Date2016-06-27 18:40 +0200
SubjectRe: [PATCH v2 1/3] block: provide helpers for reading block count
Message-ID<rOHJM-2Ik-25@gated-at.bofh.it>
On Thu, 23 Jun 2016, Arnd Bergmann wrote:

>Several drivers use an expensive do_div() to compute the number
>of logical or physical blocks in a blockdev, which can be done
>more efficiently using a shift, since the blocksize is always
>a power of two number.
>
>Let's introduce bdev_logical_block_count() and bdev_physical_block_count()
>helper functions mirroring the bdev_logical_block_size() and
>bdev_physical_block_size() interfaces for the block size.

>@@ -1226,6 +1226,13 @@ static inline unsigned short bdev_logical_block_size(struct block_device *bdev)
> 	return queue_logical_block_size(bdev_get_queue(bdev));
> }
>
>+static inline sector_t bdev_logical_block_count(struct block_device *bdev)

Curious, why not just return u64 instead for all these instead of sector_t (ie
dealing with lba, it reads weird)?

Thanks,
Davidlohr

[toc] | [standalone]


Back to top | Article view | linux.kernel


csiph-web