All of lore.kernel.org
 help / color / mirror / Atom feed
* [Q] is queue->hardsect_size respected?
@ 2005-11-23 16:24 Bartlomiej Zolnierkiewicz
  2005-11-24 10:00 ` Jens Axboe
  0 siblings, 1 reply; 2+ messages in thread
From: Bartlomiej Zolnierkiewicz @ 2005-11-23 16:24 UTC (permalink / raw)
  To: Jens Axboe; +Cc: LKML Mailinglist

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

^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2005-11-24  9:59 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2005-11-23 16:24 [Q] is queue->hardsect_size respected? Bartlomiej Zolnierkiewicz
2005-11-24 10:00 ` Jens Axboe

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.