Skip to content

Commit

Permalink
scst_vdisk: Simplify request_queue retrieval in vdisk_exec_read_capac…
Browse files Browse the repository at this point in the history
…ity16

This patch simplifies the retrieval of the request_queue within the
vdisk_exec_read_capacity16 function.
  • Loading branch information
lnocturno committed Feb 25, 2024
1 parent bb78492 commit 7bec059
Showing 1 changed file with 2 additions and 4 deletions.
6 changes: 2 additions & 4 deletions scst/src/dev_handlers/scst_vdisk.c
Original file line number Diff line number Diff line change
Expand Up @@ -4952,17 +4952,13 @@ static enum compl_status_e vdisk_exec_read_capacity16(struct vdisk_cmd_params *p
int32_t length;
uint8_t *address;
struct scst_vdisk_dev *virt_dev;
struct block_device *bdev;
struct request_queue *q;
uint32_t blocksize;
uint64_t nblocks;
uint8_t buffer[32];

TRACE_ENTRY();

virt_dev = cmd->dev->dh_priv;
bdev = virt_dev->bdev_handle ? virt_dev->bdev_handle->bdev : NULL;
q = bdev ? bdev_get_queue(bdev) : NULL;
blocksize = cmd->dev->block_size;
nblocks = virt_dev->nblocks - 1;

Expand Down Expand Up @@ -5000,6 +4996,8 @@ static enum compl_status_e vdisk_exec_read_capacity16(struct vdisk_cmd_params *p

/* LOGICAL BLOCKS PER PHYSICAL BLOCK EXPONENT */
if (virt_dev->lb_per_pb_exp) {
struct request_queue *q = virt_dev->bdev_handle ?
bdev_get_queue(virt_dev->bdev_handle->bdev) : NULL;
uint32_t physical_blocksize = q ? queue_physical_block_size(q) : 4096;
buffer[13] = max(ilog2(physical_blocksize) - ilog2(blocksize), 0);
}
Expand Down

0 comments on commit 7bec059

Please sign in to comment.