All of lore.kernel.org
 help / color / mirror / Atom feed
From: Davidlohr Bueso <dave@stgolabs.net>
To: Arnd Bergmann <arnd@arndb.de>
Cc: Jens Axboe <axboe@fb.com>,
	"Nicholas A . Bellinger" <nab@linux-iscsi.org>,
	Mike Christie <mchristi@redhat.com>,
	Andy Grover <agrover@redhat.com>, Hannes Reinecke <hare@suse.com>,
	linux-scsi@vger.kernel.org, target-devel@vger.kernel.org,
	linux-kernel@vger.kernel.org,
	Christoph Hellwig <hch@infradead.org>,
	linux-efi@vger.kernel.org, linux-block@vger.kernel.org
Subject: Re: [PATCH v2 1/3] block: provide helpers for reading block count
Date: Mon, 27 Jun 2016 09:30:12 -0700	[thread overview]
Message-ID: <20160627163012.GA11116@linux-80c1.suse> (raw)
In-Reply-To: <20160623133016.3781907-1-arnd@arndb.de>

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

WARNING: multiple messages have this Message-ID (diff)
From: Davidlohr Bueso <dave-h16yJtLeMjHk1uMJSBkQmQ@public.gmane.org>
To: Arnd Bergmann <arnd-r2nGTMty4D4@public.gmane.org>
Cc: Jens Axboe <axboe-b10kYP2dOMg@public.gmane.org>,
	"Nicholas A . Bellinger"
	<nab-IzHhD5pYlfBP7FQvKIMDCQ@public.gmane.org>,
	Mike Christie <mchristi-H+wXaHxf7aLQT0dZR+AlfA@public.gmane.org>,
	Andy Grover <agrover-H+wXaHxf7aLQT0dZR+AlfA@public.gmane.org>,
	Hannes Reinecke <hare-IBi9RG/b67k@public.gmane.org>,
	linux-scsi-u79uwXL29TY76Z2rM5mHXA@public.gmane.org,
	target-devel-u79uwXL29TY76Z2rM5mHXA@public.gmane.org,
	linux-kernel-u79uwXL29TY76Z2rM5mHXA@public.gmane.org,
	Christoph Hellwig <hch-wEGCiKHe2LqWVfeAwA7xHQ@public.gmane.org>,
	linux-efi-u79uwXL29TY76Z2rM5mHXA@public.gmane.org,
	linux-block-u79uwXL29TY76Z2rM5mHXA@public.gmane.org
Subject: Re: [PATCH v2 1/3] block: provide helpers for reading block count
Date: Mon, 27 Jun 2016 09:30:12 -0700	[thread overview]
Message-ID: <20160627163012.GA11116@linux-80c1.suse> (raw)
In-Reply-To: <20160623133016.3781907-1-arnd-r2nGTMty4D4@public.gmane.org>

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

  parent reply	other threads:[~2016-06-27 16:30 UTC|newest]

Thread overview: 9+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2016-06-23 13:30 [PATCH v2 1/3] block: provide helpers for reading block count Arnd Bergmann
2016-06-23 13:30 ` Arnd Bergmann
2016-06-23 13:30 ` [PATCH v2 2/3] partition/efi: use bdev_logical_block_count() Arnd Bergmann
2016-06-23 13:30 ` [PATCH v2 3/3] target/iblock: " Arnd Bergmann
2016-06-23 14:22 ` [PATCH v2 1/3] block: provide helpers for reading block count Christoph Hellwig
2016-06-23 14:22   ` Christoph Hellwig
2016-06-23 15:52 ` Sagi Grimberg
2016-06-27 16:30 ` Davidlohr Bueso [this message]
2016-06-27 16:30   ` Davidlohr Bueso

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=20160627163012.GA11116@linux-80c1.suse \
    --to=dave@stgolabs.net \
    --cc=agrover@redhat.com \
    --cc=arnd@arndb.de \
    --cc=axboe@fb.com \
    --cc=hare@suse.com \
    --cc=hch@infradead.org \
    --cc=linux-block@vger.kernel.org \
    --cc=linux-efi@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-scsi@vger.kernel.org \
    --cc=mchristi@redhat.com \
    --cc=nab@linux-iscsi.org \
    --cc=target-devel@vger.kernel.org \
    /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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.