Commit e0db58ed authored by Bartlomiej Zolnierkiewicz's avatar Bartlomiej Zolnierkiewicz Committed by Linus Torvalds

[PATCH] ide: split task_sectors() and task_multi_sectors()

- split __task_sectors() out of task_sectors()
- add bio and buffer versions of task[_multi]_sectors()
- use task_bio_sectors() instead of task_sectors() in pdc4030.c
- move task[_buffer]_sectors() to ide-taskfile.c
- uninline task[_multi]_sectors()
Signed-off-by: default avatarBartlomiej Zolnierkiewicz <bzolnier@elka.pw.edu.pl>
Signed-off-by: default avatarLinus Torvalds <torvalds@osdl.org>
parent a2239110
......@@ -288,6 +288,27 @@ ide_startstop_t task_no_data_intr (ide_drive_t *drive)
EXPORT_SYMBOL(task_no_data_intr);
static inline void task_buffer_sectors(ide_drive_t *drive, struct request *rq,
unsigned nsect, unsigned rw)
{
char *buf = rq->buffer + blk_rq_offset(rq);
process_that_request_first(rq, nsect);
__task_sectors(drive, buf, nsect, rw);
}
static inline void task_buffer_multi_sectors(ide_drive_t *drive,
struct request *rq, unsigned rw)
{
unsigned int msect = drive->mult_count, nsect;
nsect = rq->current_nr_sectors;
if (nsect > msect)
nsect = msect;
task_buffer_sectors(drive, rq, nsect, rw);
}
/*
* old taskfile PIO handlers, to be killed as soon as possible.
*/
......@@ -512,8 +533,17 @@ EXPORT_SYMBOL(task_mulout_intr);
#else /* !CONFIG_IDE_TASKFILE_IO */
static inline void task_multi_sectors(ide_drive_t *drive,
struct request *rq, int rw)
static void task_sectors(ide_drive_t *drive, struct request *rq,
unsigned nsect, unsigned rw)
{
if (rq->cbio) /* fs request */
task_bio_sectors(drive, rq, nsect, rw);
else /* task request */
task_buffer_sectors(drive, rq, nsect, rw);
}
static inline void task_bio_multi_sectors(ide_drive_t *drive,
struct request *rq, unsigned rw)
{
unsigned int nsect, msect = drive->mult_count;
......@@ -523,7 +553,7 @@ static inline void task_multi_sectors(ide_drive_t *drive,
if (nsect > msect)
nsect = msect;
task_sectors(drive, rq, nsect, rw);
task_bio_sectors(drive, rq, nsect, rw);
if (!rq->nr_sectors)
msect = 0;
......@@ -532,6 +562,15 @@ static inline void task_multi_sectors(ide_drive_t *drive,
} while (msect);
}
static void task_multi_sectors(ide_drive_t *drive,
struct request *rq, unsigned rw)
{
if (rq->cbio) /* fs request */
task_bio_multi_sectors(drive, rq, rw);
else /* task request */
task_buffer_multi_sectors(drive, rq, rw);
}
static u8 wait_drive_not_busy(ide_drive_t *drive)
{
ide_hwif_t *hwif = HWIF(drive);
......
......@@ -355,7 +355,7 @@ static ide_startstop_t promise_read_intr (ide_drive_t *drive)
#endif /* DEBUG_READ */
#ifdef CONFIG_IDE_TASKFILE_IO
task_sectors(drive, rq, nsect, IDE_PIO_IN);
task_bio_sectors(drive, rq, nsect, IDE_PIO_IN);
/* FIXME: can we check status after transfer on pdc4030? */
/* Complete previously submitted bios. */
......@@ -478,7 +478,7 @@ static void promise_multwrite (ide_drive_t *drive, unsigned int msect)
if (nsect > msect)
nsect = msect;
task_sectors(drive, rq, nsect, IDE_PIO_OUT);
task_bio_sectors(drive, rq, nsect, IDE_PIO_OUT);
if (!rq->nr_sectors)
msect = 0;
......
......@@ -1415,41 +1415,31 @@ extern void atapi_output_bytes(ide_drive_t *, void *, u32);
extern void taskfile_input_data(ide_drive_t *, void *, u32);
extern void taskfile_output_data(ide_drive_t *, void *, u32);
#ifdef CONFIG_IDE_TASKFILE_IO
#define IDE_PIO_IN 0
#define IDE_PIO_OUT 1
static inline void task_sectors(ide_drive_t *drive, struct request *rq,
unsigned nsect, int rw)
static inline void __task_sectors(ide_drive_t *drive, char *buf,
unsigned nsect, unsigned rw)
{
unsigned long flags;
unsigned int bio_rq;
char *buf;
/*
* bio_rq flag is needed because we can call
* rq_unmap_buffer() with rq->cbio == NULL
*/
bio_rq = rq->cbio ? 1 : 0;
if (bio_rq)
buf = rq_map_buffer(rq, &flags); /* fs request */
else
buf = rq->buffer + blk_rq_offset(rq); /* task request */
/*
* IRQ can happen instantly after reading/writing
* last sector of the datablock.
*/
process_that_request_first(rq, nsect);
if (rw == IDE_PIO_OUT)
taskfile_output_data(drive, buf, nsect * SECTOR_WORDS);
else
taskfile_input_data(drive, buf, nsect * SECTOR_WORDS);
}
#ifdef CONFIG_IDE_TASKFILE_IO
static inline void task_bio_sectors(ide_drive_t *drive, struct request *rq,
unsigned nsect, unsigned rw)
{
unsigned long flags;
char *buf = rq_map_buffer(rq, &flags);
if (bio_rq)
process_that_request_first(rq, nsect);
__task_sectors(drive, buf, nsect, rw);
rq_unmap_buffer(buf, &flags);
}
#endif /* CONFIG_IDE_TASKFILE_IO */
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment