diff options
| author | Bartlomiej Zolnierkiewicz <b.zolnierkiewicz@elka.pw.edu.pl> | 2004-06-23 20:02:51 -0700 |
|---|---|---|
| committer | Linus Torvalds <torvalds@ppc970.osdl.org> | 2004-06-23 20:02:51 -0700 |
| commit | e0db58edac3f394d910ec43fc1bcc3cc530ddc45 (patch) | |
| tree | 92394ea3ef31b3391d6f895ce7af1af212fcb686 | |
| parent | a223911077e3d57164c4b78bb810667d87115df1 (diff) | |
[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: Bartlomiej Zolnierkiewicz <bzolnier@elka.pw.edu.pl>
Signed-off-by: Linus Torvalds <torvalds@osdl.org>
| -rw-r--r-- | drivers/ide/ide-taskfile.c | 45 | ||||
| -rw-r--r-- | drivers/ide/legacy/pdc4030.c | 4 | ||||
| -rw-r--r-- | include/linux/ide.h | 36 |
3 files changed, 57 insertions, 28 deletions
diff --git a/drivers/ide/ide-taskfile.c b/drivers/ide/ide-taskfile.c index 93c62856244c..bc085c017cee 100644 --- a/drivers/ide/ide-taskfile.c +++ b/drivers/ide/ide-taskfile.c @@ -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); diff --git a/drivers/ide/legacy/pdc4030.c b/drivers/ide/legacy/pdc4030.c index 73e833d0f9b0..c07d341d1c74 100644 --- a/drivers/ide/legacy/pdc4030.c +++ b/drivers/ide/legacy/pdc4030.c @@ -355,7 +355,7 @@ read_next: #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; diff --git a/include/linux/ide.h b/include/linux/ide.h index 5ae165606a7c..cddbcdd99479 100644 --- a/include/linux/ide.h +++ b/include/linux/ide.h @@ -1415,42 +1415,32 @@ 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) - rq_unmap_buffer(buf, &flags); + process_that_request_first(rq, nsect); + __task_sectors(drive, buf, nsect, rw); + rq_unmap_buffer(buf, &flags); } #endif /* CONFIG_IDE_TASKFILE_IO */ |
