linux-block.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Marcos Paulo de Souza <marcos.souza.org@gmail.com>
To: linux-kernel@vger.kernel.org
Cc: Marcos Paulo de Souza <marcos.souza.org@gmail.com>,
	Marcos Paulo de Souza <mpdesouza@suse.com>,
	Josef Bacik <josef@toxicpanda.com>, Jens Axboe <axboe@kernel.dk>,
	linux-block@vger.kernel.org (open list:NETWORK BLOCK DEVICE
	(NBD)),
	nbd@other.debian.org (open list:NETWORK BLOCK DEVICE (NBD))
Subject: [PATCH] driver: block: nbd: Replace magic number 9 with SECTOR_SHIFT
Date: Mon, 24 Jun 2019 13:09:33 -0300	[thread overview]
Message-ID: <20190624160933.23148-1-marcos.souza.org@gmail.com> (raw)

set_capacity expects the disk size in sectors of 512 bytes, and changing
the magic number 9 to SECTOR_SHIFT clarifies this intent.

Signed-off-by: Marcos Paulo de Souza <mpdesouza@suse.com>
---
 drivers/block/nbd.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/block/nbd.c b/drivers/block/nbd.c
index 3a9bca3aa093..fd3bc061c600 100644
--- a/drivers/block/nbd.c
+++ b/drivers/block/nbd.c
@@ -288,7 +288,7 @@ static void nbd_size_update(struct nbd_device *nbd)
 	}
 	blk_queue_logical_block_size(nbd->disk->queue, config->blksize);
 	blk_queue_physical_block_size(nbd->disk->queue, config->blksize);
-	set_capacity(nbd->disk, config->bytesize >> 9);
+	set_capacity(nbd->disk, config->bytesize >> SECTOR_SHIFT);
 	if (bdev) {
 		if (bdev->bd_disk) {
 			bd_set_size(bdev, config->bytesize);
-- 
2.21.0


             reply	other threads:[~2019-06-24 16:09 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2019-06-24 16:09 Marcos Paulo de Souza [this message]
2019-07-02 22:55 ` [PATCH] driver: block: nbd: Replace magic number 9 with SECTOR_SHIFT Marcos Paulo de Souza
2019-07-14  4:09   ` Marcos Paulo de Souza

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=20190624160933.23148-1-marcos.souza.org@gmail.com \
    --to=marcos.souza.org@gmail.com \
    --cc=axboe@kernel.dk \
    --cc=josef@toxicpanda.com \
    --cc=linux-block@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=mpdesouza@suse.com \
    --cc=nbd@other.debian.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 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).