From: Marcos Paulo de Souza <marcos.souza.org@gmail.com>
To: linux-kernel@vger.kernel.org
Cc: Ming Lei <ming.lei@redhat.com>, Greg Edwards <gedwards@ddn.com>,
Hannes Reinecke <hare@suse.com>,
linux-block@vger.kernel.org,
"Martin K. Petersen" <martin.petersen@oracle.com>,
Jens Axboe <axboe@kernel.dk>,
Bart Van Assche <bvanassche@acm.org>,
Marcos Paulo de Souza <marcos.souza.org@gmail.com>,
Omar Sandoval <osandov@fb.com>,
Damien Le Moal <damien.lemoal@wdc.com>
Subject: [RFC PATCH 0/2] Introduce size_to_sectors helper in blkdev.h
Date: Sun, 21 Apr 2019 00:53:26 -0300 [thread overview]
Message-ID: <20190421035328.19322-1-marcos.souza.org@gmail.com> (raw)
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
size_to_sectors, adding a proper comment explaining why this is needed.
null_blk was changed to use this new function.
This is an RFC, please let me know if you have other suggestions.
Thanks,
Marcos
Marcos Paulo de Souza (2):
blkdev.h: Introduce size_to_sectors hlper function
null_blk: Make use of size_to_sectors helper
drivers/block/null_blk_main.c | 18 +++++++++---------
include/linux/blkdev.h | 18 ++++++++++++++++++
2 files changed, 27 insertions(+), 9 deletions(-)
--
2.16.4
next reply other threads:[~2019-04-21 3:53 UTC|newest]
Thread overview: 5+ messages / expand[flat|nested] mbox.gz Atom feed top
2019-04-21 3:53 Marcos Paulo de Souza [this message]
2019-04-21 3:53 ` [RFC PATCH 1/2] blkdev.h: Introduce size_to_sectors hlper function Marcos Paulo de Souza
2019-04-21 17:39 ` Chaitanya Kulkarni
2019-04-21 3:53 ` [RFC PATCH 2/2] null_blk: Make use of size_to_sectors helper Marcos Paulo de Souza
2019-04-21 17:42 ` Chaitanya Kulkarni
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=20190421035328.19322-1-marcos.souza.org@gmail.com \
--to=marcos.souza.org@gmail.com \
--cc=axboe@kernel.dk \
--cc=bvanassche@acm.org \
--cc=damien.lemoal@wdc.com \
--cc=gedwards@ddn.com \
--cc=hare@suse.com \
--cc=linux-block@vger.kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=martin.petersen@oracle.com \
--cc=ming.lei@redhat.com \
--cc=osandov@fb.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
all inboxes | Powered by JetHome®