scsi: sr: Reinstate rotational media flag
Reinstate the rotational media flag for the CD-ROM driver. The flag has been cleared since commitbd4a633b6f
("block: move the nonrot flag to queue_limits") and this breaks some applications. Move queue limit configuration from get_sectorsize() to sr_revalidate_disk() and set the rotational flag. Cc: Christoph Hellwig <hch@lst.de> Fixes:bd4a633b6f
("block: move the nonrot flag to queue_limits") Signed-off-by: Ming Lei <ming.lei@redhat.com> Link: https://lore.kernel.org/r/20250827113550.2614535-1-ming.lei@redhat.com Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>
This commit is contained in:
parent
9dba9a45c3
commit
708e2371f7
|
@ -475,13 +475,21 @@ static blk_status_t sr_init_command(struct scsi_cmnd *SCpnt)
|
||||||
|
|
||||||
static int sr_revalidate_disk(struct scsi_cd *cd)
|
static int sr_revalidate_disk(struct scsi_cd *cd)
|
||||||
{
|
{
|
||||||
|
struct request_queue *q = cd->device->request_queue;
|
||||||
struct scsi_sense_hdr sshdr;
|
struct scsi_sense_hdr sshdr;
|
||||||
|
struct queue_limits lim;
|
||||||
|
int sector_size;
|
||||||
|
|
||||||
/* if the unit is not ready, nothing more to do */
|
/* if the unit is not ready, nothing more to do */
|
||||||
if (scsi_test_unit_ready(cd->device, SR_TIMEOUT, MAX_RETRIES, &sshdr))
|
if (scsi_test_unit_ready(cd->device, SR_TIMEOUT, MAX_RETRIES, &sshdr))
|
||||||
return 0;
|
return 0;
|
||||||
sr_cd_check(&cd->cdi);
|
sr_cd_check(&cd->cdi);
|
||||||
return get_sectorsize(cd);
|
sector_size = get_sectorsize(cd);
|
||||||
|
|
||||||
|
lim = queue_limits_start_update(q);
|
||||||
|
lim.logical_block_size = sector_size;
|
||||||
|
lim.features |= BLK_FEAT_ROTATIONAL;
|
||||||
|
return queue_limits_commit_update_frozen(q, &lim);
|
||||||
}
|
}
|
||||||
|
|
||||||
static int sr_block_open(struct gendisk *disk, blk_mode_t mode)
|
static int sr_block_open(struct gendisk *disk, blk_mode_t mode)
|
||||||
|
@ -721,10 +729,8 @@ fail:
|
||||||
|
|
||||||
static int get_sectorsize(struct scsi_cd *cd)
|
static int get_sectorsize(struct scsi_cd *cd)
|
||||||
{
|
{
|
||||||
struct request_queue *q = cd->device->request_queue;
|
|
||||||
static const u8 cmd[10] = { READ_CAPACITY };
|
static const u8 cmd[10] = { READ_CAPACITY };
|
||||||
unsigned char buffer[8] = { };
|
unsigned char buffer[8] = { };
|
||||||
struct queue_limits lim;
|
|
||||||
int err;
|
int err;
|
||||||
int sector_size;
|
int sector_size;
|
||||||
struct scsi_failure failure_defs[] = {
|
struct scsi_failure failure_defs[] = {
|
||||||
|
@ -795,9 +801,7 @@ static int get_sectorsize(struct scsi_cd *cd)
|
||||||
set_capacity(cd->disk, cd->capacity);
|
set_capacity(cd->disk, cd->capacity);
|
||||||
}
|
}
|
||||||
|
|
||||||
lim = queue_limits_start_update(q);
|
return sector_size;
|
||||||
lim.logical_block_size = sector_size;
|
|
||||||
return queue_limits_commit_update_frozen(q, &lim);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
static int get_capabilities(struct scsi_cd *cd)
|
static int get_capabilities(struct scsi_cd *cd)
|
||||||
|
|
Loading…
Reference in New Issue