Skip to content

Commit eabf5df

Browse files
Christoph Hellwigaxboe
authored andcommitted
pktcdvd: don't set max_hw_sectors on the underlying device
pktcdvd sets max_hw_sectors on the queue of the underlying device that it doesn't own (and doesn't reset it ever) since the driver was merged. This can create all kinds of problems as the underlying driver doesn't even know about it changing the limit. As the state purpose is to not create I/Os larger than a single frame, and pktcdvd never builds bios larger than that, just set REQ_NOMERGE on the bios it submits so that largers I/Os never get built. Note: I don't have packet writing hardware, so this is compile tested only. Signed-off-by: Christoph Hellwig <[email protected]> Link: https://lore.kernel.org/r/[email protected] Signed-off-by: Jens Axboe <[email protected]>
1 parent 8e0ef41 commit eabf5df

File tree

1 file changed

+6
-5
lines changed

1 file changed

+6
-5
lines changed

drivers/block/pktcdvd.c

Lines changed: 6 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -828,6 +828,12 @@ static noinline_for_stack int pkt_set_speed(struct pktcdvd_device *pd,
828828
*/
829829
static void pkt_queue_bio(struct pktcdvd_device *pd, struct bio *bio)
830830
{
831+
/*
832+
* Some CDRW drives can not handle writes larger than one packet,
833+
* even if the size is a multiple of the packet size.
834+
*/
835+
bio->bi_opf |= REQ_NOMERGE;
836+
831837
spin_lock(&pd->iosched.lock);
832838
if (bio_data_dir(bio) == READ)
833839
bio_list_add(&pd->iosched.read_queue, bio);
@@ -2191,11 +2197,6 @@ static int pkt_open_dev(struct pktcdvd_device *pd, bool write)
21912197
ret = pkt_open_write(pd);
21922198
if (ret)
21932199
goto out_putdev;
2194-
/*
2195-
* Some CDRW drives can not handle writes larger than one packet,
2196-
* even if the size is a multiple of the packet size.
2197-
*/
2198-
blk_queue_max_hw_sectors(q, pd->settings.size);
21992200
set_bit(PACKET_WRITABLE, &pd->flags);
22002201
} else {
22012202
pkt_set_speed(pd, MAX_SPEED, MAX_SPEED);

0 commit comments

Comments
 (0)