summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorBartlomiej Zolnierkiewicz <b.zolnierkiewicz@elka.pw.edu.pl>2003-09-05 22:28:13 -0700
committerLinus Torvalds <torvalds@home.osdl.org>2003-09-05 22:28:13 -0700
commitfaff7e92c34815dbd7e90f86f9259ad18b01f181 (patch)
tree69072a587d5c7bd6f4d6f0ce0a52d7852b0acbbf
parent6dbb44ac76478255907baf7697a2403591d1efb2 (diff)
[PATCH] ide: fix imbalance preempt count with taskfile PIO
Noticed by Tejun Huh <tejun@aratech.co.kr>.
-rw-r--r--include/linux/ide.h39
1 files changed, 13 insertions, 26 deletions
diff --git a/include/linux/ide.h b/include/linux/ide.h
index e7c50528e10e..bda3346af22f 100644
--- a/include/linux/ide.h
+++ b/include/linux/ide.h
@@ -850,29 +850,6 @@ static inline void ide_unmap_buffer(struct request *rq, char *buffer, unsigned l
if (rq->bio)
bio_kunmap_irq(buffer, flags);
}
-
-#else /* !CONFIG_IDE_TASKFILE_IO */
-
-static inline void *task_map_rq(struct request *rq, unsigned long *flags)
-{
- /*
- * fs request
- */
- if (rq->cbio)
- return rq_map_buffer(rq, flags);
-
- /*
- * task request
- */
- return rq->buffer + blk_rq_offset(rq);
-}
-
-static inline void task_unmap_rq(struct request *rq, char *buffer, unsigned long *flags)
-{
- if (rq->cbio)
- rq_unmap_buffer(buffer, flags);
-}
-
#endif /* !CONFIG_IDE_TASKFILE_IO */
#define IDE_CHIPSET_PCI_MASK \
@@ -1472,9 +1449,19 @@ static inline void task_sectors(ide_drive_t *drive, struct request *rq,
unsigned nsect, int rw)
{
unsigned long flags;
+ unsigned int bio_rq;
char *buf;
- buf = task_map_rq(rq, &flags);
+ /*
+ * 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
@@ -1487,9 +1474,9 @@ static inline void task_sectors(ide_drive_t *drive, struct request *rq,
else
taskfile_input_data(drive, buf, nsect * SECTOR_WORDS);
- task_unmap_rq(rq, buf, &flags);
+ if (bio_rq)
+ rq_unmap_buffer(buf, &flags);
}
-
#endif /* CONFIG_IDE_TASKFILE_IO */
extern int drive_is_ready(ide_drive_t *);