All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH v2 0/2] Introduce bytes_to_sectors helper in blkdev.h
@ 2019-05-02  1:57 Marcos Paulo de Souza
  2019-05-02  1:57 ` [PATCH v2 1/2] blkdev.h: Introduce bytes_to_sectors helper function Marcos Paulo de Souza
                   ` (2 more replies)
  0 siblings, 3 replies; 4+ messages in thread
From: Marcos Paulo de Souza @ 2019-05-02  1:57 UTC (permalink / raw)
  To: linux-block; +Cc: Marcos Paulo de Souza

Changes from v2:
Rename size_to_sectors o bytes_to_sectors. (suggested by Martin K. Petersen)

Changes from v1:
Reworked the documentation of size_to_sectors by removing a sentence that was
explaining the size -> sectors math, which wasn't necessary given the
description prior to the example. (suggested by Chaitanya Kulkarni)

Let me know if you have more suggestions to this code.

Here is the cover letter of the RFC sent prior to this patchset:

While reading code of drivers/block, I was curious about the set_capacity
argument, always shifting the value by 9, and so I took me a while to realize
this is done on purpose: the capacity is the number of sectors of 512 bytes
related to the storage space.

Rather the shifting by 9, there are other places where the value if shifted by
SECTOR_SHIFT, which is more readable.
This patch aims to reduce these differences by adding a new function called
bytes_to_sectors, adding a proper comment explaining why this is needed.

null_blk was changed to use this new function.

Thanks,
Marco

Marcos Paulo de Souza (2):
  blkdev.h: Introduce bytes_to_sectors helper function
  null_blk: Make use of bytes_to_sectors helper

 drivers/block/null_blk_main.c | 18 +++++++++---------
 include/linux/blkdev.h        | 17 +++++++++++++++++
 2 files changed, 26 insertions(+), 9 deletions(-)

-- 
2.16.4


^ permalink raw reply	[flat|nested] 4+ messages in thread

end of thread, other threads:[~2019-05-02 20:40 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2019-05-02  1:57 [PATCH v2 0/2] Introduce bytes_to_sectors helper in blkdev.h Marcos Paulo de Souza
2019-05-02  1:57 ` [PATCH v2 1/2] blkdev.h: Introduce bytes_to_sectors helper function Marcos Paulo de Souza
2019-05-02  1:57 ` [PATCH v2 2/2] null_blk: Make use of bytes_to_sectors helper Marcos Paulo de Souza
2019-05-02 20:40 ` [PATCH v2 0/2] Introduce bytes_to_sectors helper in blkdev.h Jens Axboe

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.