Skip to contentSkip to conversation

is queue->hardsect_size respected?

Q Bartlomiej Zolnierkiewicz 2 participants 2 messages Nov 23, 2005 – Nov 24, 2005

lore
Share & tools
lore
#0 lore raw

Hi,

I'm hacking on ide-cd.c and I've noticed that some old code (PIO handing for read fs requests) still supports unaligned access:

static ide_startstop_t cdrom_start_read_continuation (ide_drive_t *drive)

{
	struct request *rq = HWGROUP(drive)->rq;
	unsigned short sectors_per_frame;
	int nskip;

	sectors_per_frame = queue_hardsect_size(drive->queue) >> SECTOR_BITS;

	/* If the requested sector doesn't start on a cdrom block boundary,
	   we must adjust the start of the transfer so that it does,
	   and remember to skip the first few sectors.
	   If the CURRENT_NR_SECTORS field is larger than the size
	   of the buffer, it will mean that we're to skip a number
	   of sectors equal to the amount by which CURRENT_NR_SECTORS
	   is larger than the buffer size. */
	nskip = rq->sector & (sectors_per_frame - 1);
	if (nskip > 0) {
		/* Sanity check... */
		if (rq->current_nr_sectors != bio_cur_sectors(rq->bio) &&
			(rq->sector & (sectors_per_frame - 1))) {
			printk(KERN_ERR "%s: cdrom_start_read_continuation: buffer botch (%u)\n",
				drive->name, rq->current_nr_sectors);
			cdrom_end_request(drive, 0);
			return ide_stopped;
		}
		rq->current_nr_sectors += nskip;
	}

...

static ide_startstop_t cdrom_read_intr (ide_drive_t *drive)
...

	/* First, figure out if we need to bit-bucket
	   any of the leading sectors. */
	nskip = min_t(int, rq->current_nr_sectors - bio_cur_sectors(rq->bio),

sectors_to_transfer);

	while (nskip > 0) {
		/* We need to throw away a sector. */
		static char dum[SECTOR_SIZE];
		HWIF(drive)->atapi_input_bytes(drive, dum, sizeof (dum));

		--rq->current_nr_sectors;
		--nskip;
		--sectors_to_transfer;
	}

...

is this still a case in 2.6 or can I safely remove it?

Cheers,
Bartlomiej

#1 lore raw
Quoted 4 lines · Bartlomiej Zolnierkiewicz

Hi,

I'm hacking on ide-cd.c and I've noticed that some old code (PIO handing for read fs requests) still supports unaligned access:

I think that can safely die, that code even predates me maintaining it. It's a bug to receive a request that's not hardsector aligned. It used to be a problem with eg hfs cds, since they use 512b sectors. But the caching should take care of it for us, it's definitely not driver business.

So rip it!

Signature · 1 line
Jens Axboe