[Q] is queue->hardsect_size respected?

From: Bartlomiej Zolnierkiewicz
Date: Wed Nov 23 2005 - 11:23:54 EST


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
-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/