Reenable block_shift calculation for tapes

The calculation of block_shift was disabled for tape devices.
Enabling it again, as it is now being used in scst_tape_generic_parse.

Fixes: 0043f510cb ("block shift cleanups and fixes")

git-svn-id: http://svn.code.sf.net/p/scst/svn/trunk@9578 d57e44dd-8a1f-0410-8b47-8ef2f437770f
This commit is contained in:
Bart Van Assche
2021-09-15 04:13:49 +00:00
parent 3d527cb0b5
commit 1e95312e49
2 changed files with 5 additions and 3 deletions

View File

@@ -145,7 +145,7 @@ static int tape_attach(struct scst_device *dev)
}
dev->block_size = TAPE_DEF_BLOCK_SIZE;
dev->block_shift = -1; /* not used */
dev->block_shift = scst_calc_block_shift(dev->block_size);
buffer = kmalloc(buffer_size, GFP_KERNEL);
if (!buffer) {
@@ -203,7 +203,7 @@ static int tape_attach(struct scst_device *dev)
res = -ENODEV;
goto out_free_buf;
}
dev->block_shift = -1; /* not used */
dev->block_shift = scst_calc_block_shift(dev->block_size);
obtain:
res = scst_obtain_device_parameters(dev, NULL);
@@ -250,7 +250,7 @@ static void tape_set_block_size(struct scst_cmd *cmd, int block_size)
* there are existing commands.
*/
dev->block_size = block_size;
dev->block_shift = -1; /* not used */
dev->block_shift = scst_calc_block_shift(dev->block_size);
return;
}

View File

@@ -12470,6 +12470,8 @@ int scst_tape_generic_parse(struct scst_cmd *cmd)
shift_left_overflows(cmd->data_len, block_shift) ||
shift_left_overflows(cmd->out_bufflen, block_shift);
EXTRACHECKS_BUG_ON(block_shift < 0);
BUILD_BUG_ON(sizeof(cmd->bufflen) != 4);
BUILD_BUG_ON(sizeof(cmd->out_bufflen) != 4);
if (unlikely(overflow)) {