Albert Lee wrote: > Tejun Heo wrote: >> Albert Lee wrote: >> >>> -static void ata_pio_sector(struct ata_queued_cmd *qc, int last) >>> +static void ata_pio_sector(struct ata_queued_cmd *qc, int last, int lock) >> >> I think the naming of @lock is a bit confusing here. @clr_hsm_wq or >> @last_sector, maybe? >> > > How about "irq_handover"? When set to "true", it means the workqueue is going to > handover the control of the port to the irq handler. > >>> + if (lock) { >>> + tail = 8; >>> + head = ATA_SECT_SIZE - tail; /* multiple of 8 bytes */ >>> + ap->ops->data_xfer(qc->dev, buf + offset, head, do_write); >>> + spin_lock_irqsave(ap->lock, irq_flags); >>> + } >>> + >>> + ap->ops->data_xfer(qc->dev, buf + offset + head, tail, do_write); >> >> Aieee, we have to transfer the whole last sector while holding the spin >> lock and IRQ disabled. That's sad but pushing locking into ->data_xfer >> doesn't sound attractive either. Any better ideas? >> > > Why need to transfer the last sector as a whole? > Spliting it into 504 (unlocked) + 8 (holding ap->lock) works on my machine... That would be the cleanest way to do it but I'm not sure whether all controllers can live with that. If I understand correctly, Some controllers just have to have the whole transfer done atomically. I think Alan knows much better about this. Alan? -- tejun - To unsubscribe from this list: send the line "unsubscribe linux-ide" in the body of a message to majordomo@xxxxxxxxxxxxxxx More majordomo info at http://vger.kernel.org/majordomo-info.html