Skip to content

Commit f6cb9a2

Browse files
bvanasscheaxboe
authored andcommitted
nbd: Remove a local variable from nbd_send_cmd()
blk_rq_bytes() returns an unsigned int while 'size' has type unsigned long. This is confusing. Improve code readability by removing the local variable 'size'. Cc: Christoph Hellwig <[email protected]> Cc: Josef Bacik <[email protected]> Cc: Yu Kuai <[email protected]> Cc: Markus Pargmann <[email protected]> Signed-off-by: Bart Van Assche <[email protected]> Link: https://lore.kernel.org/r/[email protected] Signed-off-by: Jens Axboe <[email protected]>
1 parent 2a6751e commit f6cb9a2

File tree

1 file changed

+1
-2
lines changed

1 file changed

+1
-2
lines changed

drivers/block/nbd.c

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -597,7 +597,6 @@ static int nbd_send_cmd(struct nbd_device *nbd, struct nbd_cmd *cmd, int index)
597597
struct nbd_request request = {.magic = htonl(NBD_REQUEST_MAGIC)};
598598
struct kvec iov = {.iov_base = &request, .iov_len = sizeof(request)};
599599
struct iov_iter from;
600-
unsigned long size = blk_rq_bytes(req);
601600
struct bio *bio;
602601
u64 handle;
603602
u32 type;
@@ -646,7 +645,7 @@ static int nbd_send_cmd(struct nbd_device *nbd, struct nbd_cmd *cmd, int index)
646645
request.type = htonl(type | nbd_cmd_flags);
647646
if (type != NBD_CMD_FLUSH) {
648647
request.from = cpu_to_be64((u64)blk_rq_pos(req) << 9);
649-
request.len = htonl(size);
648+
request.len = htonl(blk_rq_bytes(req));
650649
}
651650
handle = nbd_cmd_handle(cmd);
652651
request.cookie = cpu_to_be64(handle);

0 commit comments

Comments
 (0)