* [PATCH 00/20] ide-cd: use scatterlists also for PIO transfers
@ 2009-02-16 0:13 Bartlomiej Zolnierkiewicz
2009-02-16 0:13 ` [PATCH 01/20] ide: add support for arbitrary transfer lengths to ide_pio_bytes() Bartlomiej Zolnierkiewicz
` (19 more replies)
0 siblings, 20 replies; 23+ messages in thread
From: Bartlomiej Zolnierkiewicz @ 2009-02-16 0:13 UTC (permalink / raw)
To: linux-ide; +Cc: Borislav Petkov, Bartlomiej Zolnierkiewicz, linux-kernel
The recent struct ide_cmd work allows us to finally convert ide-cd to use
scatterlists for PIO transfers which fixes a long-standing bug with potential
data integrity issue on write errors for PIO transfers and fs/pc requests
(DMA transfers were never affected so it is not as serious issue as it might
sound, still great that it is gone), greatly simiplifies the code and prepares
it for a lot more improvements once struct ide_{atapi_pc,cmd} merge is done.
The patchset also contains fixes for some smaller issues uncovered by the
main change and (as an added bonus) few unrelated minor cleanups.
[ Borislav, I hope that these changes don't interfere too much with your
current work and sorry for the rush (OTOH it should make things so much
easier for us that the rush may be well justified)... ]
I tested that CD/DVD reading, CD writing and CD audio extraction still work
after these changes (in both PIO and DMA modes). I also verified the behavior
on the simulated media errors.
[ on top of pata-2.6 tree ]
diffstat:
drivers/ide/ide-cd.c | 638 +++++++++++++++------------------------------
drivers/ide/ide-taskfile.c | 92 +++---
include/linux/ide.h | 9
3 files changed, 273 insertions(+), 466 deletions(-)
^ permalink raw reply [flat|nested] 23+ messages in thread
* [PATCH 01/20] ide: add support for arbitrary transfer lengths to ide_pio_bytes()
2009-02-16 0:13 [PATCH 00/20] ide-cd: use scatterlists also for PIO transfers Bartlomiej Zolnierkiewicz
@ 2009-02-16 0:13 ` Bartlomiej Zolnierkiewicz
2009-02-16 0:13 ` [PATCH 02/20] ide: use PageHighMem() instead of ifdefs in ide_pio_bytes() Bartlomiej Zolnierkiewicz
` (18 subsequent siblings)
19 siblings, 0 replies; 23+ messages in thread
From: Bartlomiej Zolnierkiewicz @ 2009-02-16 0:13 UTC (permalink / raw)
To: linux-ide; +Cc: Borislav Petkov, Bartlomiej Zolnierkiewicz, linux-kernel
From: Bartlomiej Zolnierkiewicz <bzolnier@gmail.com>
Subject: [PATCH] ide: add support for arbitrary transfer lengths to ide_pio_bytes()
Add support for arbitrary transfer lengths to ide_pio_bytes()
and then inline ide_pio_multi() into ide_pio_datablock().
There should be no functional changes caused by this patch.
Cc: Borislav Petkov <petkovbb@gmail.com>
Signed-off-by: Bartlomiej Zolnierkiewicz <bzolnier@gmail.com>
---
drivers/ide/ide-taskfile.c | 73 ++++++++++++++++++++++-----------------------
1 file changed, 37 insertions(+), 36 deletions(-)
Index: b/drivers/ide/ide-taskfile.c
===================================================================
--- a/drivers/ide/ide-taskfile.c
+++ b/drivers/ide/ide-taskfile.c
@@ -189,7 +189,7 @@ static u8 wait_drive_not_busy(ide_drive_
}
static void ide_pio_bytes(ide_drive_t *drive, struct ide_cmd *cmd,
- unsigned int write, unsigned int nr_bytes)
+ unsigned int write, unsigned int len)
{
ide_hwif_t *hwif = drive->hwif;
struct scatterlist *sg = hwif->sg_table;
@@ -202,56 +202,55 @@ static void ide_pio_bytes(ide_drive_t *d
u8 *buf;
cursg = cmd->cursg;
- if (!cursg) {
- cursg = sg;
- cmd->cursg = sg;
- }
+ if (cursg == NULL)
+ cursg = cmd->cursg = sg;
+
+ while (len) {
+ unsigned nr_bytes = min(len, cursg->length - cmd->cursg_ofs);
+
+ if (nr_bytes > PAGE_SIZE)
+ nr_bytes = PAGE_SIZE;
- page = sg_page(cursg);
- offset = cursg->offset + cmd->cursg_ofs;
+ page = sg_page(cursg);
+ offset = cursg->offset + cmd->cursg_ofs;
- /* get the current page and offset */
- page = nth_page(page, (offset >> PAGE_SHIFT));
- offset %= PAGE_SIZE;
+ /* get the current page and offset */
+ page = nth_page(page, (offset >> PAGE_SHIFT));
+ offset %= PAGE_SIZE;
#ifdef CONFIG_HIGHMEM
- local_irq_save(flags);
+ local_irq_save(flags);
#endif
- buf = kmap_atomic(page, KM_BIO_SRC_IRQ) + offset;
+ buf = kmap_atomic(page, KM_BIO_SRC_IRQ) + offset;
- cmd->nleft -= nr_bytes;
- cmd->cursg_ofs += nr_bytes;
+ cmd->nleft -= nr_bytes;
+ cmd->cursg_ofs += nr_bytes;
- if (cmd->cursg_ofs == cursg->length) {
- cmd->cursg = sg_next(cmd->cursg);
- cmd->cursg_ofs = 0;
- }
+ if (cmd->cursg_ofs == cursg->length) {
+ cursg = cmd->cursg = sg_next(cmd->cursg);
+ cmd->cursg_ofs = 0;
+ }
- /* do the actual data transfer */
- if (write)
- hwif->tp_ops->output_data(drive, cmd, buf, nr_bytes);
- else
- hwif->tp_ops->input_data(drive, cmd, buf, nr_bytes);
+ /* do the actual data transfer */
+ if (write)
+ hwif->tp_ops->output_data(drive, cmd, buf, nr_bytes);
+ else
+ hwif->tp_ops->input_data(drive, cmd, buf, nr_bytes);
- kunmap_atomic(buf, KM_BIO_SRC_IRQ);
+ kunmap_atomic(buf, KM_BIO_SRC_IRQ);
#ifdef CONFIG_HIGHMEM
- local_irq_restore(flags);
+ local_irq_restore(flags);
#endif
-}
-
-static void ide_pio_multi(ide_drive_t *drive, struct ide_cmd *cmd,
- unsigned int write)
-{
- unsigned int nsect;
- nsect = min_t(unsigned int, cmd->nleft >> 9, drive->mult_count);
- while (nsect--)
- ide_pio_bytes(drive, cmd, write, SECTOR_SIZE);
+ len -= nr_bytes;
+ }
}
static void ide_pio_datablock(ide_drive_t *drive, struct ide_cmd *cmd,
unsigned int write)
{
+ unsigned int nr_bytes;
+
u8 saved_io_32bit = drive->io_32bit;
if (cmd->tf_flags & IDE_TFLAG_FS)
@@ -263,9 +262,11 @@ static void ide_pio_datablock(ide_drive_
touch_softlockup_watchdog();
if (cmd->tf_flags & IDE_TFLAG_MULTI_PIO)
- ide_pio_multi(drive, cmd, write);
+ nr_bytes = min_t(unsigned, cmd->nleft, drive->mult_count << 9);
else
- ide_pio_bytes(drive, cmd, write, SECTOR_SIZE);
+ nr_bytes = SECTOR_SIZE;
+
+ ide_pio_bytes(drive, cmd, write, nr_bytes);
drive->io_32bit = saved_io_32bit;
}
^ permalink raw reply [flat|nested] 23+ messages in thread
* [PATCH 02/20] ide: use PageHighMem() instead of ifdefs in ide_pio_bytes()
2009-02-16 0:13 [PATCH 00/20] ide-cd: use scatterlists also for PIO transfers Bartlomiej Zolnierkiewicz
2009-02-16 0:13 ` [PATCH 01/20] ide: add support for arbitrary transfer lengths to ide_pio_bytes() Bartlomiej Zolnierkiewicz
@ 2009-02-16 0:13 ` Bartlomiej Zolnierkiewicz
2009-02-16 0:13 ` [PATCH 03/20] ide-cd: remove dead URLs Bartlomiej Zolnierkiewicz
` (17 subsequent siblings)
19 siblings, 0 replies; 23+ messages in thread
From: Bartlomiej Zolnierkiewicz @ 2009-02-16 0:13 UTC (permalink / raw)
To: linux-ide; +Cc: Borislav Petkov, Bartlomiej Zolnierkiewicz, linux-kernel
From: Bartlomiej Zolnierkiewicz <bzolnier@gmail.com>
Subject: [PATCH] ide: use PageHighMem() instead of ifdefs in ide_pio_bytes()
Use PageHighMem() instead of ifdefs in ide_pio_bytes()
(=> local IRQs won't be disabled when not necessary).
Cc: Borislav Petkov <petkovbb@gmail.com>
Signed-off-by: Bartlomiej Zolnierkiewicz <bzolnier@gmail.com>
---
drivers/ide/ide-taskfile.c | 14 ++++++--------
1 file changed, 6 insertions(+), 8 deletions(-)
Index: b/drivers/ide/ide-taskfile.c
===================================================================
--- a/drivers/ide/ide-taskfile.c
+++ b/drivers/ide/ide-taskfile.c
@@ -195,9 +195,7 @@ static void ide_pio_bytes(ide_drive_t *d
struct scatterlist *sg = hwif->sg_table;
struct scatterlist *cursg = cmd->cursg;
struct page *page;
-#ifdef CONFIG_HIGHMEM
unsigned long flags;
-#endif
unsigned int offset;
u8 *buf;
@@ -215,9 +213,9 @@ static void ide_pio_bytes(ide_drive_t *d
page = nth_page(page, (offset >> PAGE_SHIFT));
offset %= PAGE_SIZE;
-#ifdef CONFIG_HIGHMEM
- local_irq_save(flags);
-#endif
+ if (PageHighMem(page))
+ local_irq_save(flags);
+
buf = kmap_atomic(page, KM_BIO_SRC_IRQ) + offset;
cmd->nleft -= nr_bytes;
@@ -235,9 +233,9 @@ static void ide_pio_bytes(ide_drive_t *d
hwif->tp_ops->input_data(drive, cmd, buf, nr_bytes);
kunmap_atomic(buf, KM_BIO_SRC_IRQ);
-#ifdef CONFIG_HIGHMEM
- local_irq_restore(flags);
-#endif
+
+ if (PageHighMem(page))
+ local_irq_restore(flags);
len -= nr_bytes;
}
^ permalink raw reply [flat|nested] 23+ messages in thread
* [PATCH 03/20] ide-cd: remove dead URLs
2009-02-16 0:13 [PATCH 00/20] ide-cd: use scatterlists also for PIO transfers Bartlomiej Zolnierkiewicz
2009-02-16 0:13 ` [PATCH 01/20] ide: add support for arbitrary transfer lengths to ide_pio_bytes() Bartlomiej Zolnierkiewicz
2009-02-16 0:13 ` [PATCH 02/20] ide: use PageHighMem() instead of ifdefs in ide_pio_bytes() Bartlomiej Zolnierkiewicz
@ 2009-02-16 0:13 ` Bartlomiej Zolnierkiewicz
2009-02-16 0:13 ` [PATCH 04/20] ide-cd: use ide_end_rq() also for failed non-fs requests Bartlomiej Zolnierkiewicz
` (16 subsequent siblings)
19 siblings, 0 replies; 23+ messages in thread
From: Bartlomiej Zolnierkiewicz @ 2009-02-16 0:13 UTC (permalink / raw)
To: linux-ide; +Cc: Borislav Petkov, Bartlomiej Zolnierkiewicz, linux-kernel
From: Bartlomiej Zolnierkiewicz <bzolnier@gmail.com>
Subject: [PATCH] ide-cd: remove dead URLs
Cc: Borislav Petkov <petkovbb@gmail.com>
Signed-off-by: Bartlomiej Zolnierkiewicz <bzolnier@gmail.com>
---
drivers/ide/ide-cd.c | 9 +++------
1 file changed, 3 insertions(+), 6 deletions(-)
Index: b/drivers/ide/ide-cd.c
===================================================================
--- a/drivers/ide/ide-cd.c
+++ b/drivers/ide/ide-cd.c
@@ -12,12 +12,9 @@
* See Documentation/cdrom/ide-cd for usage information.
*
* Suggestions are welcome. Patches that work are more welcome though. ;-)
- * For those wishing to work on this driver, please be sure you download
- * and comply with the latest Mt. Fuji (SFF8090 version 4) and ATAPI
- * (SFF-8020i rev 2.6) standards. These documents can be obtained by
- * anonymous ftp from:
- * ftp://fission.dt.wdc.com/pub/standards/SFF_atapi/spec/SFF8020-r2.6/PS/8020r26.ps
- * ftp://ftp.avc-pioneer.com/Mtfuji4/Spec/Fuji4r10.pdf
+ *
+ * Documentation:
+ * Mt. Fuji (SFF8090 version 4) and ATAPI (SFF-8020i rev 2.6) standards.
*
* For historical changelog please see:
* Documentation/ide/ChangeLog.ide-cd.1994-2004
^ permalink raw reply [flat|nested] 23+ messages in thread
* [PATCH 04/20] ide-cd: use ide_end_rq() also for failed non-fs requests
2009-02-16 0:13 [PATCH 00/20] ide-cd: use scatterlists also for PIO transfers Bartlomiej Zolnierkiewicz
` (2 preceding siblings ...)
2009-02-16 0:13 ` [PATCH 03/20] ide-cd: remove dead URLs Bartlomiej Zolnierkiewicz
@ 2009-02-16 0:13 ` Bartlomiej Zolnierkiewicz
2009-02-16 0:13 ` [PATCH 05/20] ide-cd: remove dead code from cdrom_decode_status() Bartlomiej Zolnierkiewicz
` (15 subsequent siblings)
19 siblings, 0 replies; 23+ messages in thread
From: Bartlomiej Zolnierkiewicz @ 2009-02-16 0:13 UTC (permalink / raw)
To: linux-ide; +Cc: Borislav Petkov, Bartlomiej Zolnierkiewicz, linux-kernel
From: Bartlomiej Zolnierkiewicz <bzolnier@gmail.com>
Subject: [PATCH] ide-cd: use ide_end_rq() also for failed non-fs requests
Use ide_end_rq() also for failed non-fs requests on completion
of REQUEST SENSE requests + use blk_rq_bytes() while at it.
Cc: Borislav Petkov <petkovbb@gmail.com>
Signed-off-by: Bartlomiej Zolnierkiewicz <bzolnier@gmail.com>
---
drivers/ide/ide-cd.c | 16 ++++------------
1 file changed, 4 insertions(+), 12 deletions(-)
Index: b/drivers/ide/ide-cd.c
===================================================================
--- a/drivers/ide/ide-cd.c
+++ b/drivers/ide/ide-cd.c
@@ -260,18 +260,10 @@ static void cdrom_end_request(ide_drive_
failed->sense_len = rq->sense_len;
}
cdrom_analyze_sense_data(drive, failed, sense);
- /*
- * now end the failed request
- */
- if (blk_fs_request(failed)) {
- if (ide_end_rq(drive, failed, -EIO,
- failed->hard_nr_sectors << 9))
- BUG();
- } else {
- if (blk_end_request(failed, -EIO,
- failed->data_len))
- BUG();
- }
+
+ if (ide_end_rq(drive, failed, -EIO,
+ blk_rq_bytes(failed)))
+ BUG();
} else
cdrom_analyze_sense_data(drive, NULL, sense);
}
^ permalink raw reply [flat|nested] 23+ messages in thread
* [PATCH 05/20] ide-cd: remove dead code from cdrom_decode_status()
2009-02-16 0:13 [PATCH 00/20] ide-cd: use scatterlists also for PIO transfers Bartlomiej Zolnierkiewicz
` (3 preceding siblings ...)
2009-02-16 0:13 ` [PATCH 04/20] ide-cd: use ide_end_rq() also for failed non-fs requests Bartlomiej Zolnierkiewicz
@ 2009-02-16 0:13 ` Bartlomiej Zolnierkiewicz
2009-02-16 0:13 ` [PATCH 06/20] ide: remove needless ide_dump_status_no_sense() wrapper Bartlomiej Zolnierkiewicz
` (14 subsequent siblings)
19 siblings, 0 replies; 23+ messages in thread
From: Bartlomiej Zolnierkiewicz @ 2009-02-16 0:13 UTC (permalink / raw)
To: linux-ide; +Cc: Borislav Petkov, Bartlomiej Zolnierkiewicz, linux-kernel
From: Bartlomiej Zolnierkiewicz <bzolnier@gmail.com>
Subject: [PATCH] ide-cd: remove dead code from cdrom_decode_status()
There should be no functional changes caused by this patch.
Cc: Borislav Petkov <petkovbb@gmail.com>
Signed-off-by: Bartlomiej Zolnierkiewicz <bzolnier@gmail.com>
---
drivers/ide/ide-cd.c | 6 ------
1 file changed, 6 deletions(-)
Index: b/drivers/ide/ide-cd.c
===================================================================
--- a/drivers/ide/ide-cd.c
+++ b/drivers/ide/ide-cd.c
@@ -316,12 +316,6 @@ static int cdrom_decode_status(ide_drive
err = ide_read_error(drive);
sense_key = err >> 4;
- if (rq == NULL) {
- printk(KERN_ERR PFX "%s: missing rq in %s\n",
- drive->name, __func__);
- return 1;
- }
-
ide_debug_log(IDE_DBG_RQ, "stat: 0x%x, good_stat: 0x%x, cmd[0]: 0x%x, "
"rq->cmd_type: 0x%x, err: 0x%x",
stat, good_stat, rq->cmd[0], rq->cmd_type,
^ permalink raw reply [flat|nested] 23+ messages in thread
* [PATCH 06/20] ide: remove needless ide_dump_status_no_sense() wrapper
2009-02-16 0:13 [PATCH 00/20] ide-cd: use scatterlists also for PIO transfers Bartlomiej Zolnierkiewicz
` (4 preceding siblings ...)
2009-02-16 0:13 ` [PATCH 05/20] ide-cd: remove dead code from cdrom_decode_status() Bartlomiej Zolnierkiewicz
@ 2009-02-16 0:13 ` Bartlomiej Zolnierkiewicz
2009-02-16 0:13 ` [PATCH 07/20] ide-cd: remove no longer needed 'ignore' module parameter Bartlomiej Zolnierkiewicz
` (13 subsequent siblings)
19 siblings, 0 replies; 23+ messages in thread
From: Bartlomiej Zolnierkiewicz @ 2009-02-16 0:13 UTC (permalink / raw)
To: linux-ide; +Cc: Borislav Petkov, Bartlomiej Zolnierkiewicz, linux-kernel
From: Bartlomiej Zolnierkiewicz <bzolnier@gmail.com>
Subject: [PATCH] ide-cd: remove needless ide_dump_status_no_sense() wrapper
It makes no sense to check for BSY bit being set as earlier OK_STAT()
check in cdrom_end_request() makes sure that BSY bit is cleared.
There should be no functional changes caused by this patch.
Cc: Borislav Petkov <petkovbb@gmail.com>
Signed-off-by: Bartlomiej Zolnierkiewicz <bzolnier@gmail.com>
---
drivers/ide/ide-cd.c | 17 ++++-------------
1 file changed, 4 insertions(+), 13 deletions(-)
Index: b/drivers/ide/ide-cd.c
===================================================================
--- a/drivers/ide/ide-cd.c
+++ b/drivers/ide/ide-cd.c
@@ -285,13 +285,6 @@ static void cdrom_end_request(ide_drive_
ide_complete_rq(drive, uptodate ? 0 : -EIO, nsectors << 9);
}
-static void ide_dump_status_no_sense(ide_drive_t *drive, const char *msg, u8 st)
-{
- if (st & 0x80)
- return;
- ide_dump_status(drive, msg, st);
-}
-
/*
* Returns:
* 0: if the request should be continued.
@@ -434,21 +427,19 @@ static int cdrom_decode_status(ide_drive
* No point in retrying after an illegal request or data
* protect error.
*/
- ide_dump_status_no_sense(drive, "command error", stat);
+ ide_dump_status(drive, "command error", stat);
do_end_request = 1;
} else if (sense_key == MEDIUM_ERROR) {
/*
* No point in re-trying a zillion times on a bad
* sector. If we got here the error is not correctable.
*/
- ide_dump_status_no_sense(drive,
- "media error (bad sector)",
- stat);
+ ide_dump_status(drive, "media error (bad sector)",
+ stat);
do_end_request = 1;
} else if (sense_key == BLANK_CHECK) {
/* disk appears blank ?? */
- ide_dump_status_no_sense(drive, "media error (blank)",
- stat);
+ ide_dump_status(drive, "media error (blank)", stat);
do_end_request = 1;
} else if ((err & ~ATA_ABORTED) != 0) {
/* go to the default handler for other errors */
^ permalink raw reply [flat|nested] 23+ messages in thread
* [PATCH 07/20] ide-cd: remove no longer needed 'ignore' module parameter
2009-02-16 0:13 [PATCH 00/20] ide-cd: use scatterlists also for PIO transfers Bartlomiej Zolnierkiewicz
` (5 preceding siblings ...)
2009-02-16 0:13 ` [PATCH 06/20] ide: remove needless ide_dump_status_no_sense() wrapper Bartlomiej Zolnierkiewicz
@ 2009-02-16 0:13 ` Bartlomiej Zolnierkiewicz
2009-02-16 0:14 ` [PATCH 08/20] ide-cd: factor out failed request completion from cdrom_end_request() Bartlomiej Zolnierkiewicz
` (12 subsequent siblings)
19 siblings, 0 replies; 23+ messages in thread
From: Bartlomiej Zolnierkiewicz @ 2009-02-16 0:13 UTC (permalink / raw)
To: linux-ide; +Cc: Borislav Petkov, Bartlomiej Zolnierkiewicz, linux-kernel
From: Bartlomiej Zolnierkiewicz <bzolnier@gmail.com>
Subject: [PATCH] ide-cd: remove no longer needed 'ignore' module parameter
ide-scsi is gone...
Cc: Borislav Petkov <petkovbb@gmail.com>
Signed-off-by: Bartlomiej Zolnierkiewicz <bzolnier@gmail.com>
---
drivers/ide/ide-cd.c | 12 ------------
1 file changed, 12 deletions(-)
Index: b/drivers/ide/ide-cd.c
===================================================================
--- a/drivers/ide/ide-cd.c
+++ b/drivers/ide/ide-cd.c
@@ -1932,9 +1932,6 @@ static struct block_device_operations id
};
/* module options */
-static char *ignore;
-module_param(ignore, charp, 0400);
-
static unsigned long debug_mask;
module_param(debug_mask, ulong, 0644);
@@ -1955,15 +1952,6 @@ static int ide_cd_probe(ide_drive_t *dri
if (drive->media != ide_cdrom && drive->media != ide_optical)
goto failed;
- /* skip drives that we were told to ignore */
- if (ignore != NULL) {
- if (strstr(ignore, drive->name)) {
- printk(KERN_INFO PFX "ignoring drive %s\n",
- drive->name);
- goto failed;
- }
- }
-
drive->debug_mask = debug_mask;
drive->irq_handler = cdrom_newpc_intr;
^ permalink raw reply [flat|nested] 23+ messages in thread
* [PATCH 08/20] ide-cd: factor out failed request completion from cdrom_end_request()
2009-02-16 0:13 [PATCH 00/20] ide-cd: use scatterlists also for PIO transfers Bartlomiej Zolnierkiewicz
` (6 preceding siblings ...)
2009-02-16 0:13 ` [PATCH 07/20] ide-cd: remove no longer needed 'ignore' module parameter Bartlomiej Zolnierkiewicz
@ 2009-02-16 0:14 ` Bartlomiej Zolnierkiewicz
2009-02-16 0:14 ` [PATCH 09/20] ide-cd: unify ide_cd_do_request() exit paths Bartlomiej Zolnierkiewicz
` (11 subsequent siblings)
19 siblings, 0 replies; 23+ messages in thread
From: Bartlomiej Zolnierkiewicz @ 2009-02-16 0:14 UTC (permalink / raw)
To: linux-ide; +Cc: Borislav Petkov, Bartlomiej Zolnierkiewicz, linux-kernel
From: Bartlomiej Zolnierkiewicz <bzolnier@gmail.com>
Subject: [PATCH] ide-cd: factor out failed request completion from cdrom_end_request()
There should be no functional changes caused by this patch.
Cc: Borislav Petkov <petkovbb@gmail.com>
Signed-off-by: Bartlomiej Zolnierkiewicz <bzolnier@gmail.com>
---
drivers/ide/ide-cd.c | 47 +++++++++++++++++++++++++----------------------
1 file changed, 25 insertions(+), 22 deletions(-)
Index: b/drivers/ide/ide-cd.c
===================================================================
--- a/drivers/ide/ide-cd.c
+++ b/drivers/ide/ide-cd.c
@@ -237,6 +237,29 @@ static void cdrom_queue_request_sense(id
elv_add_request(drive->queue, rq, ELEVATOR_INSERT_FRONT, 0);
}
+static void ide_cd_complete_failed_rq(ide_drive_t *drive, struct request *rq)
+{
+ /*
+ * For REQ_TYPE_SENSE, "rq->buffer" points to the original
+ * failed request
+ */
+ struct request *failed = (struct request *)rq->buffer;
+ struct cdrom_info *info = drive->driver_data;
+ void *sense = &info->sense_data;
+
+ if (failed) {
+ if (failed->sense) {
+ sense = failed->sense;
+ failed->sense_len = rq->sense_len;
+ }
+ cdrom_analyze_sense_data(drive, failed, sense);
+
+ if (ide_end_rq(drive, failed, -EIO, blk_rq_bytes(failed)))
+ BUG();
+ } else
+ cdrom_analyze_sense_data(drive, NULL, sense);
+}
+
static void cdrom_end_request(ide_drive_t *drive, int uptodate)
{
struct request *rq = drive->hwif->rq;
@@ -245,28 +268,8 @@ static void cdrom_end_request(ide_drive_
ide_debug_log(IDE_DBG_FUNC, "cmd: 0x%x, uptodate: 0x%x, nsectors: %d",
rq->cmd[0], uptodate, nsectors);
- if (blk_sense_request(rq) && uptodate) {
- /*
- * For REQ_TYPE_SENSE, "rq->buffer" points to the original
- * failed request
- */
- struct request *failed = (struct request *) rq->buffer;
- struct cdrom_info *info = drive->driver_data;
- void *sense = &info->sense_data;
-
- if (failed) {
- if (failed->sense) {
- sense = failed->sense;
- failed->sense_len = rq->sense_len;
- }
- cdrom_analyze_sense_data(drive, failed, sense);
-
- if (ide_end_rq(drive, failed, -EIO,
- blk_rq_bytes(failed)))
- BUG();
- } else
- cdrom_analyze_sense_data(drive, NULL, sense);
- }
+ if (blk_sense_request(rq) && uptodate)
+ ide_cd_complete_failed_rq(drive, rq);
if (!rq->current_nr_sectors && blk_fs_request(rq))
uptodate = 1;
^ permalink raw reply [flat|nested] 23+ messages in thread
* [PATCH 09/20] ide-cd: unify ide_cd_do_request() exit paths
2009-02-16 0:13 [PATCH 00/20] ide-cd: use scatterlists also for PIO transfers Bartlomiej Zolnierkiewicz
` (7 preceding siblings ...)
2009-02-16 0:14 ` [PATCH 08/20] ide-cd: factor out failed request completion from cdrom_end_request() Bartlomiej Zolnierkiewicz
@ 2009-02-16 0:14 ` Bartlomiej Zolnierkiewicz
2009-02-16 0:14 ` [PATCH 10/20] ide-cd: move setting REQ_FAILED flag out from 'end_request' exit path Bartlomiej Zolnierkiewicz
` (10 subsequent siblings)
19 siblings, 0 replies; 23+ messages in thread
From: Bartlomiej Zolnierkiewicz @ 2009-02-16 0:14 UTC (permalink / raw)
To: linux-ide; +Cc: Borislav Petkov, Bartlomiej Zolnierkiewicz, linux-kernel
From: Bartlomiej Zolnierkiewicz <bzolnier@gmail.com>
Subject: [PATCH] ide-cd: unify ide_cd_do_request() exit paths
* Move cdrom_end_request() calls from cdrom_start_rw()
and ide_cd_prepare_rw_request() to ide_cd_do_request().
* Unify ide_cd_do_request() exit paths.
There should be no functional changes caused by this patch.
Cc: Borislav Petkov <petkovbb@gmail.com>
Signed-off-by: Bartlomiej Zolnierkiewicz <bzolnier@gmail.com>
---
drivers/ide/ide-cd.c | 28 ++++++++++++----------------
1 file changed, 12 insertions(+), 16 deletions(-)
Index: b/drivers/ide/ide-cd.c
===================================================================
--- a/drivers/ide/ide-cd.c
+++ b/drivers/ide/ide-cd.c
@@ -590,7 +590,6 @@ static ide_startstop_t ide_cd_prepare_rw
printk(KERN_ERR PFX "%s: %s: buffer botch (%u)\n",
drive->name, __func__,
rq->current_nr_sectors);
- cdrom_end_request(drive, 0);
return ide_stopped;
}
rq->current_nr_sectors += nskip;
@@ -967,10 +966,8 @@ static ide_startstop_t cdrom_start_rw(id
if (write) {
/* disk has become write protected */
- if (get_disk_ro(cd->disk)) {
- cdrom_end_request(drive, 0);
+ if (get_disk_ro(cd->disk))
return ide_stopped;
- }
} else {
/*
* We may be retrying this request after an error. Fix up any
@@ -982,10 +979,8 @@ static ide_startstop_t cdrom_start_rw(id
/* use DMA, if possible / writes *must* be hardware frame aligned */
if ((rq->nr_sectors & (sectors_per_frame - 1)) ||
(rq->sector & (sectors_per_frame - 1))) {
- if (write) {
- cdrom_end_request(drive, 0);
+ if (write)
return ide_stopped;
- }
drive->dma = 0;
} else
drive->dma = !!(drive->dev_flags & IDE_DFLAG_USING_DMA);
@@ -1040,6 +1035,7 @@ static ide_startstop_t ide_cd_do_request
sector_t block)
{
struct ide_cmd cmd;
+ int uptodate = 0;
ide_debug_log(IDE_DBG_RQ, "cmd: 0x%x, block: %llu",
rq->cmd[0], (unsigned long long)block);
@@ -1048,11 +1044,9 @@ static ide_startstop_t ide_cd_do_request
blk_dump_rq_flags(rq, "ide_cd_do_request");
if (blk_fs_request(rq)) {
- if (cdrom_start_rw(drive, rq) == ide_stopped)
- return ide_stopped;
-
- if (ide_cd_prepare_rw_request(drive, rq) == ide_stopped)
- return ide_stopped;
+ if (cdrom_start_rw(drive, rq) == ide_stopped ||
+ ide_cd_prepare_rw_request(drive, rq) == ide_stopped)
+ goto out_end;
} else if (blk_sense_request(rq) || blk_pc_request(rq) ||
rq->cmd_type == REQ_TYPE_ATA_PC) {
if (!rq->timeout)
@@ -1061,12 +1055,11 @@ static ide_startstop_t ide_cd_do_request
cdrom_do_block_pc(drive, rq);
} else if (blk_special_request(rq)) {
/* right now this can only be a reset... */
- cdrom_end_request(drive, 1);
- return ide_stopped;
+ uptodate = 1;
+ goto out_end;
} else {
blk_dump_rq_flags(rq, DRV_NAME " bad flags");
- cdrom_end_request(drive, 0);
- return ide_stopped;
+ goto out_end;
}
memset(&cmd, 0, sizeof(cmd));
@@ -1077,6 +1070,9 @@ static ide_startstop_t ide_cd_do_request
cmd.rq = rq;
return ide_issue_pc(drive, &cmd);
+out_end:
+ cdrom_end_request(drive, uptodate);
+ return ide_stopped;
}
/*
^ permalink raw reply [flat|nested] 23+ messages in thread
* [PATCH 10/20] ide-cd: move setting REQ_FAILED flag out from 'end_request' exit path
2009-02-16 0:13 [PATCH 00/20] ide-cd: use scatterlists also for PIO transfers Bartlomiej Zolnierkiewicz
` (8 preceding siblings ...)
2009-02-16 0:14 ` [PATCH 09/20] ide-cd: unify ide_cd_do_request() exit paths Bartlomiej Zolnierkiewicz
@ 2009-02-16 0:14 ` Bartlomiej Zolnierkiewicz
2009-02-16 0:14 ` [PATCH 11/20] ide-cd: unify cdrom_newpc_intr() exit paths Bartlomiej Zolnierkiewicz
` (9 subsequent siblings)
19 siblings, 0 replies; 23+ messages in thread
From: Bartlomiej Zolnierkiewicz @ 2009-02-16 0:14 UTC (permalink / raw)
To: linux-ide; +Cc: Borislav Petkov, Bartlomiej Zolnierkiewicz, linux-kernel
From: Bartlomiej Zolnierkiewicz <bzolnier@gmail.com>
Subject: [PATCH] ide-cd: move setting REQ_FAILED flag out from 'end_request' exit path
Move setting REQ_FAILED flag out from 'end_request' exit path in
cdrom_newpc_intr() and also rename 'end_request' to 'out_end'.
There should be no functional changes caused by this patch.
Cc: Borislav Petkov <petkovbb@gmail.com>
Signed-off-by: Bartlomiej Zolnierkiewicz <bzolnier@gmail.com>
---
drivers/ide/ide-cd.c | 12 +++++++-----
1 file changed, 7 insertions(+), 5 deletions(-)
Index: b/drivers/ide/ide-cd.c
===================================================================
--- a/drivers/ide/ide-cd.c
+++ b/drivers/ide/ide-cd.c
@@ -771,7 +771,9 @@ static ide_startstop_t cdrom_newpc_intr(
ide_complete_rq(drive, 0, 512);
return ide_stopped;
}
- goto end_request;
+ if (blk_pc_request(rq) == 0 && uptodate == 0)
+ rq->cmd_flags |= REQ_FAILED;
+ goto out_end;
}
ide_read_bcount_and_ireason(drive, &len, &ireason);
@@ -806,8 +808,10 @@ static ide_startstop_t cdrom_newpc_intr(
ide_cd_request_sense_fixup(drive, rq);
/* complain if we still have data left to transfer */
uptodate = rq->data_len ? 0 : 1;
+ if (uptodate == 0)
+ rq->cmd_flags |= REQ_FAILED;
}
- goto end_request;
+ goto out_end;
}
/* check which way to transfer data */
@@ -934,7 +938,7 @@ static ide_startstop_t cdrom_newpc_intr(
ide_set_handler(drive, cdrom_newpc_intr, timeout);
return ide_started;
-end_request:
+out_end:
if (blk_pc_request(rq)) {
unsigned int dlen = rq->data_len;
@@ -946,8 +950,6 @@ end_request:
hwif->rq = NULL;
} else {
- if (!uptodate)
- rq->cmd_flags |= REQ_FAILED;
cdrom_end_request(drive, uptodate);
}
return ide_stopped;
^ permalink raw reply [flat|nested] 23+ messages in thread
* [PATCH 11/20] ide-cd: unify cdrom_newpc_intr() exit paths
2009-02-16 0:13 [PATCH 00/20] ide-cd: use scatterlists also for PIO transfers Bartlomiej Zolnierkiewicz
` (9 preceding siblings ...)
2009-02-16 0:14 ` [PATCH 10/20] ide-cd: move setting REQ_FAILED flag out from 'end_request' exit path Bartlomiej Zolnierkiewicz
@ 2009-02-16 0:14 ` Bartlomiej Zolnierkiewicz
2009-02-16 9:25 ` Borislav Petkov
2009-02-16 0:14 ` [PATCH 12/20] ide-cd: remove cdrom_end_request() Bartlomiej Zolnierkiewicz
` (8 subsequent siblings)
19 siblings, 1 reply; 23+ messages in thread
From: Bartlomiej Zolnierkiewicz @ 2009-02-16 0:14 UTC (permalink / raw)
To: linux-ide; +Cc: Borislav Petkov, Bartlomiej Zolnierkiewicz, linux-kernel
From: Bartlomiej Zolnierkiewicz <bzolnier@gmail.com>
Subject: [PATCH] ide-cd: unify cdrom_newpc_intr() exit paths
* Move cdrom_end_request() calls from cdrom_decode_status()
and ide_cd_check_ireason() to cdrom_newpc_intr().
* Unify cdrom_newpc_intr() exit paths.
There should be no functional changes caused by this patch.
Cc: Borislav Petkov <petkovbb@gmail.com>
Signed-off-by: Bartlomiej Zolnierkiewicz <bzolnier@gmail.com>
---
drivers/ide/ide-cd.c | 48 +++++++++++++++++++++++-------------------------
1 file changed, 23 insertions(+), 25 deletions(-)
Index: b/drivers/ide/ide-cd.c
===================================================================
--- a/drivers/ide/ide-cd.c
+++ b/drivers/ide/ide-cd.c
@@ -291,7 +291,8 @@ static void cdrom_end_request(ide_drive_
/*
* Returns:
* 0: if the request should be continued.
- * 1: if the request was ended.
+ * 1: if the request will be going through error recovery.
+ * 2: if the request should be ended.
*/
static int cdrom_decode_status(ide_drive_t *drive, int good_stat, int *stat_ret)
{
@@ -324,10 +325,7 @@ static int cdrom_decode_status(ide_drive
* Just give up.
*/
rq->cmd_flags |= REQ_FAILED;
- cdrom_end_request(drive, 0);
- ide_error(drive, "request sense failure", stat);
- return 1;
-
+ return 2;
} else if (blk_pc_request(rq) || rq->cmd_type == REQ_TYPE_ATA_PC) {
/* All other functions, except for READ. */
@@ -467,14 +465,12 @@ static int cdrom_decode_status(ide_drive
*/
if (stat & ATA_ERR)
cdrom_queue_request_sense(drive, NULL, NULL);
+ return 1;
} else {
blk_dump_rq_flags(rq, PFX "bad rq");
- cdrom_end_request(drive, 0);
+ return 2;
}
- /* retry, or handle the next request */
- return 1;
-
end_request:
if (stat & ATA_ERR) {
struct request_queue *q = drive->queue;
@@ -487,10 +483,9 @@ end_request:
hwif->rq = NULL;
cdrom_queue_request_sense(drive, rq->sense, rq);
+ return 1;
} else
- cdrom_end_request(drive, 0);
-
- return 1;
+ return 2;
}
/*
@@ -534,7 +529,6 @@ static int ide_cd_check_ireason(ide_driv
if (rq->cmd_type == REQ_TYPE_ATA_PC)
rq->cmd_flags |= REQ_FAILED;
- cdrom_end_request(drive, 0);
return -1;
}
@@ -736,7 +730,8 @@ static ide_startstop_t cdrom_newpc_intr(
xfer_func_t *xferfunc;
ide_expiry_t *expiry = NULL;
int dma_error = 0, dma, stat, thislen, uptodate = 0;
- int write = (rq_data_dir(rq) == WRITE) ? 1 : 0;
+ int write = (rq_data_dir(rq) == WRITE) ? 1 : 0, rc;
+ int sense = blk_sense_request(rq);
unsigned int timeout;
u16 len;
u8 ireason;
@@ -756,8 +751,12 @@ static ide_startstop_t cdrom_newpc_intr(
}
}
- if (cdrom_decode_status(drive, 0, &stat))
+ rc = cdrom_decode_status(drive, 0, &stat);
+ if (rc) {
+ if (rc == 2)
+ goto out_end;
return ide_stopped;
+ }
/* using dma, transfer is complete now */
if (dma) {
@@ -802,8 +801,6 @@ static ide_startstop_t cdrom_newpc_intr(
rq->cmd_flags |= REQ_FAILED;
uptodate = 0;
}
- cdrom_end_request(drive, uptodate);
- return ide_stopped;
} else if (!blk_pc_request(rq)) {
ide_cd_request_sense_fixup(drive, rq);
/* complain if we still have data left to transfer */
@@ -815,17 +812,16 @@ static ide_startstop_t cdrom_newpc_intr(
}
/* check which way to transfer data */
- if (ide_cd_check_ireason(drive, rq, len, ireason, write))
- return ide_stopped;
+ rc = ide_cd_check_ireason(drive, rq, len, ireason, write);
+ if (rc)
+ goto out_end;
if (blk_fs_request(rq)) {
if (write == 0) {
int nskip;
- if (ide_cd_check_transfer_size(drive, len)) {
- cdrom_end_request(drive, 0);
- return ide_stopped;
- }
+ if (ide_cd_check_transfer_size(drive, len))
+ goto out_end;
/*
* First, figure out if we need to bit-bucket
@@ -918,7 +914,7 @@ static ide_startstop_t cdrom_newpc_intr(
else
rq->data += blen;
}
- if (!write && blk_sense_request(rq))
+ if (sense && write == 0)
rq->sense_len += blen;
}
@@ -939,7 +935,7 @@ static ide_startstop_t cdrom_newpc_intr(
return ide_started;
out_end:
- if (blk_pc_request(rq)) {
+ if (blk_pc_request(rq) && rc == 0) {
unsigned int dlen = rq->data_len;
if (dma)
@@ -951,6 +947,8 @@ out_end:
hwif->rq = NULL;
} else {
cdrom_end_request(drive, uptodate);
+ if (sense && rc == 2)
+ ide_error(drive, "request sense failure", stat);
}
return ide_stopped;
}
^ permalink raw reply [flat|nested] 23+ messages in thread
* [PATCH 12/20] ide-cd: remove cdrom_end_request()
2009-02-16 0:13 [PATCH 00/20] ide-cd: use scatterlists also for PIO transfers Bartlomiej Zolnierkiewicz
` (10 preceding siblings ...)
2009-02-16 0:14 ` [PATCH 11/20] ide-cd: unify cdrom_newpc_intr() exit paths Bartlomiej Zolnierkiewicz
@ 2009-02-16 0:14 ` Bartlomiej Zolnierkiewicz
2009-02-16 0:14 ` [PATCH 13/20] ide-cd: kill whole failed request in ide_cd_do_request() Bartlomiej Zolnierkiewicz
` (7 subsequent siblings)
19 siblings, 0 replies; 23+ messages in thread
From: Bartlomiej Zolnierkiewicz @ 2009-02-16 0:14 UTC (permalink / raw)
To: linux-ide; +Cc: Borislav Petkov, Bartlomiej Zolnierkiewicz, linux-kernel
From: Bartlomiej Zolnierkiewicz <bzolnier@gmail.com>
Subject: [PATCH] ide-cd: remove cdrom_end_request()
Inline cdrom_end_request() into cdrom_newpc_intr()
and ide_cd_do_request().
There should be no functional changes caused by this patch.
Cc: Borislav Petkov <petkovbb@gmail.com>
Signed-off-by: Bartlomiej Zolnierkiewicz <bzolnier@gmail.com>
---
drivers/ide/ide-cd.c | 81 +++++++++++++++++++++++++++++----------------------
1 file changed, 47 insertions(+), 34 deletions(-)
Index: b/drivers/ide/ide-cd.c
===================================================================
--- a/drivers/ide/ide-cd.c
+++ b/drivers/ide/ide-cd.c
@@ -260,34 +260,6 @@ static void ide_cd_complete_failed_rq(id
cdrom_analyze_sense_data(drive, NULL, sense);
}
-static void cdrom_end_request(ide_drive_t *drive, int uptodate)
-{
- struct request *rq = drive->hwif->rq;
- int nsectors = rq->hard_cur_sectors;
-
- ide_debug_log(IDE_DBG_FUNC, "cmd: 0x%x, uptodate: 0x%x, nsectors: %d",
- rq->cmd[0], uptodate, nsectors);
-
- if (blk_sense_request(rq) && uptodate)
- ide_cd_complete_failed_rq(drive, rq);
-
- if (!rq->current_nr_sectors && blk_fs_request(rq))
- uptodate = 1;
- /* make sure it's fully ended */
- if (blk_pc_request(rq))
- nsectors = (rq->data_len + 511) >> 9;
- if (!nsectors)
- nsectors = 1;
-
- ide_debug_log(IDE_DBG_FUNC, "uptodate: 0x%x, nsectors: %d",
- uptodate, nsectors);
-
- if (blk_fs_request(rq) == 0 && uptodate <= 0 && rq->errors == 0)
- rq->errors = -EIO;
-
- ide_complete_rq(drive, uptodate ? 0 : -EIO, nsectors << 9);
-}
-
/*
* Returns:
* 0: if the request should be continued.
@@ -730,7 +702,7 @@ static ide_startstop_t cdrom_newpc_intr(
xfer_func_t *xferfunc;
ide_expiry_t *expiry = NULL;
int dma_error = 0, dma, stat, thislen, uptodate = 0;
- int write = (rq_data_dir(rq) == WRITE) ? 1 : 0, rc;
+ int write = (rq_data_dir(rq) == WRITE) ? 1 : 0, rc, nsectors;
int sense = blk_sense_request(rq);
unsigned int timeout;
u16 len;
@@ -897,8 +869,14 @@ static ide_startstop_t cdrom_newpc_intr(
rq->current_nr_sectors -= (blen >> 9);
rq->sector += (blen >> 9);
- if (rq->current_nr_sectors == 0 && rq->nr_sectors)
- cdrom_end_request(drive, 1);
+ if (rq->current_nr_sectors == 0 && rq->nr_sectors) {
+ nsectors = rq->hard_cur_sectors;
+
+ if (nsectors == 0)
+ nsectors = 1;
+
+ ide_complete_rq(drive, 0, nsectors << 9);
+ }
} else {
rq->data_len -= blen;
@@ -946,7 +924,28 @@ out_end:
hwif->rq = NULL;
} else {
- cdrom_end_request(drive, uptodate);
+ if (sense && uptodate)
+ ide_cd_complete_failed_rq(drive, rq);
+
+ if (blk_fs_request(rq)) {
+ if (rq->current_nr_sectors == 0)
+ uptodate = 1;
+ } else {
+ if (uptodate <= 0 && rq->errors == 0)
+ rq->errors = -EIO;
+ }
+
+ /* make sure it's fully ended */
+ if (blk_pc_request(rq))
+ nsectors = (rq->data_len + 511) >> 9;
+ else
+ nsectors = rq->hard_cur_sectors;
+
+ if (nsectors == 0)
+ nsectors = 1;
+
+ ide_complete_rq(drive, uptodate ? 0 : -EIO, nsectors << 9);
+
if (sense && rc == 2)
ide_error(drive, "request sense failure", stat);
}
@@ -1035,7 +1034,7 @@ static ide_startstop_t ide_cd_do_request
sector_t block)
{
struct ide_cmd cmd;
- int uptodate = 0;
+ int uptodate = 0, nsectors;
ide_debug_log(IDE_DBG_RQ, "cmd: 0x%x, block: %llu",
rq->cmd[0], (unsigned long long)block);
@@ -1071,7 +1070,21 @@ static ide_startstop_t ide_cd_do_request
return ide_issue_pc(drive, &cmd);
out_end:
- cdrom_end_request(drive, uptodate);
+ if (blk_fs_request(rq)) {
+ if (rq->current_nr_sectors == 0)
+ uptodate = 1;
+ } else {
+ if (uptodate <= 0 && rq->errors == 0)
+ rq->errors = -EIO;
+ }
+
+ nsectors = rq->hard_cur_sectors;
+
+ if (nsectors == 0)
+ nsectors = 1;
+
+ ide_complete_rq(drive, uptodate ? 0 : -EIO, nsectors << 9);
+
return ide_stopped;
}
^ permalink raw reply [flat|nested] 23+ messages in thread
* [PATCH 13/20] ide-cd: kill whole failed request in ide_cd_do_request()
2009-02-16 0:13 [PATCH 00/20] ide-cd: use scatterlists also for PIO transfers Bartlomiej Zolnierkiewicz
` (11 preceding siblings ...)
2009-02-16 0:14 ` [PATCH 12/20] ide-cd: remove cdrom_end_request() Bartlomiej Zolnierkiewicz
@ 2009-02-16 0:14 ` Bartlomiej Zolnierkiewicz
2009-02-16 0:14 ` [PATCH 14/20] ide-cd: cleanup ide_cd_do_request() Bartlomiej Zolnierkiewicz
` (6 subsequent siblings)
19 siblings, 0 replies; 23+ messages in thread
From: Bartlomiej Zolnierkiewicz @ 2009-02-16 0:14 UTC (permalink / raw)
To: linux-ide; +Cc: Borislav Petkov, Bartlomiej Zolnierkiewicz, linux-kernel
From: Bartlomiej Zolnierkiewicz <bzolnier@gmail.com>
Subject: [PATCH] ide-cd: kill whole failed request in ide_cd_do_request()
Untangling cdrom_end_request() uncovered an error in completing
failed requests in ide_cd_do_request(). Fix it.
Cc: Borislav Petkov <petkovbb@gmail.com>
Signed-off-by: Bartlomiej Zolnierkiewicz <bzolnier@gmail.com>
---
drivers/ide/ide-cd.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
Index: b/drivers/ide/ide-cd.c
===================================================================
--- a/drivers/ide/ide-cd.c
+++ b/drivers/ide/ide-cd.c
@@ -1078,7 +1078,7 @@ out_end:
rq->errors = -EIO;
}
- nsectors = rq->hard_cur_sectors;
+ nsectors = rq->hard_nr_sectors;
if (nsectors == 0)
nsectors = 1;
^ permalink raw reply [flat|nested] 23+ messages in thread
* [PATCH 14/20] ide-cd: cleanup ide_cd_do_request()
2009-02-16 0:13 [PATCH 00/20] ide-cd: use scatterlists also for PIO transfers Bartlomiej Zolnierkiewicz
` (12 preceding siblings ...)
2009-02-16 0:14 ` [PATCH 13/20] ide-cd: kill whole failed request in ide_cd_do_request() Bartlomiej Zolnierkiewicz
@ 2009-02-16 0:14 ` Bartlomiej Zolnierkiewicz
2009-02-16 0:14 ` [PATCH 15/20] ide-cd: use scatterlists for PIO transfers (fs requests) Bartlomiej Zolnierkiewicz
` (5 subsequent siblings)
19 siblings, 0 replies; 23+ messages in thread
From: Bartlomiej Zolnierkiewicz @ 2009-02-16 0:14 UTC (permalink / raw)
To: linux-ide; +Cc: Borislav Petkov, Bartlomiej Zolnierkiewicz, linux-kernel
From: Bartlomiej Zolnierkiewicz <bzolnier@gmail.com>
Subject: [PATCH] ide-cd: cleanup ide_cd_do_request()
There should be no functional changes caused by this patch.
Cc: Borislav Petkov <petkovbb@gmail.com>
Signed-off-by: Bartlomiej Zolnierkiewicz <bzolnier@gmail.com>
---
drivers/ide/ide-cd.c | 15 ++++++---------
1 file changed, 6 insertions(+), 9 deletions(-)
Index: b/drivers/ide/ide-cd.c
===================================================================
--- a/drivers/ide/ide-cd.c
+++ b/drivers/ide/ide-cd.c
@@ -1044,8 +1044,11 @@ static ide_startstop_t ide_cd_do_request
if (blk_fs_request(rq)) {
if (cdrom_start_rw(drive, rq) == ide_stopped ||
- ide_cd_prepare_rw_request(drive, rq) == ide_stopped)
+ ide_cd_prepare_rw_request(drive, rq) == ide_stopped) {
+ if (rq->current_nr_sectors == 0)
+ uptodate = 1;
goto out_end;
+ }
} else if (blk_sense_request(rq) || blk_pc_request(rq) ||
rq->cmd_type == REQ_TYPE_ATA_PC) {
if (!rq->timeout)
@@ -1058,6 +1061,8 @@ static ide_startstop_t ide_cd_do_request
goto out_end;
} else {
blk_dump_rq_flags(rq, DRV_NAME " bad flags");
+ if (rq->errors == 0)
+ rq->errors = -EIO;
goto out_end;
}
@@ -1070,14 +1075,6 @@ static ide_startstop_t ide_cd_do_request
return ide_issue_pc(drive, &cmd);
out_end:
- if (blk_fs_request(rq)) {
- if (rq->current_nr_sectors == 0)
- uptodate = 1;
- } else {
- if (uptodate <= 0 && rq->errors == 0)
- rq->errors = -EIO;
- }
-
nsectors = rq->hard_nr_sectors;
if (nsectors == 0)
^ permalink raw reply [flat|nested] 23+ messages in thread
* [PATCH 15/20] ide-cd: use scatterlists for PIO transfers (fs requests)
2009-02-16 0:13 [PATCH 00/20] ide-cd: use scatterlists also for PIO transfers Bartlomiej Zolnierkiewicz
` (13 preceding siblings ...)
2009-02-16 0:14 ` [PATCH 14/20] ide-cd: cleanup ide_cd_do_request() Bartlomiej Zolnierkiewicz
@ 2009-02-16 0:14 ` Bartlomiej Zolnierkiewicz
2009-02-16 0:14 ` [PATCH 16/20] ide-cd: fix non-SECTOR_SIZE-multiples PIO transfers for fs requests Bartlomiej Zolnierkiewicz
` (4 subsequent siblings)
19 siblings, 0 replies; 23+ messages in thread
From: Bartlomiej Zolnierkiewicz @ 2009-02-16 0:14 UTC (permalink / raw)
To: linux-ide; +Cc: Borislav Petkov, Bartlomiej Zolnierkiewicz, linux-kernel
From: Bartlomiej Zolnierkiewicz <bzolnier@gmail.com>
Subject: [PATCH] ide-cd: use scatterlists for PIO transfers (fs requests)
* Export ide_pio_bytes().
* Add ->last_xfer_len field to struct ide_cmd.
* Add ide_cd_error_cmd() helper to ide-cd.
* Convert ide-cd to use scatterlists also for PIO transfers (fs requests
only for now) and get rid of partial completions (except when the error
happens -- which is still subject to change later because looking at
ATAPI spec it seems that the device is free to error the whole transfer
with setting the Error bit only on the last transfer chunk).
* Update ide_cd_{prepare_rw,restore_request,do_request}() accordingly.
* Inline ide_cd_restore_request() into cdrom_start_rw().
Cc: Borislav Petkov <petkovbb@gmail.com>
Signed-off-by: Bartlomiej Zolnierkiewicz <bzolnier@gmail.com>
---
drivers/ide/ide-cd.c | 146 +++++++++++++--------------------------------
drivers/ide/ide-taskfile.c | 5 -
include/linux/ide.h | 4 +
3 files changed, 50 insertions(+), 105 deletions(-)
Index: b/drivers/ide/ide-cd.c
===================================================================
--- a/drivers/ide/ide-cd.c
+++ b/drivers/ide/ide-cd.c
@@ -531,64 +531,12 @@ static ide_startstop_t ide_cd_prepare_rw
{
ide_debug_log(IDE_DBG_RQ, "rq->cmd_flags: 0x%x", rq->cmd_flags);
- if (rq_data_dir(rq) == READ) {
- unsigned short sectors_per_frame =
- queue_hardsect_size(drive->queue) >> SECTOR_BITS;
- int nskip = rq->sector & (sectors_per_frame - 1);
-
- /*
- * If the requested sector doesn't start on a frame boundary,
- * we must adjust the start of the transfer so that it does,
- * and remember to skip the first few sectors.
- *
- * If the rq->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 rq->current_nr_sectors
- * is larger than the buffer size.
- */
- if (nskip > 0) {
- /* sanity check... */
- if (rq->current_nr_sectors !=
- bio_cur_sectors(rq->bio)) {
- printk(KERN_ERR PFX "%s: %s: buffer botch (%u)\n",
- drive->name, __func__,
- rq->current_nr_sectors);
- return ide_stopped;
- }
- rq->current_nr_sectors += nskip;
- }
- }
-
/* set up the command */
rq->timeout = ATAPI_WAIT_PC;
return ide_started;
}
-/*
- * Fix up a possibly partially-processed request so that we can start it over
- * entirely, or even put it back on the request queue.
- */
-static void ide_cd_restore_request(ide_drive_t *drive, struct request *rq)
-{
-
- ide_debug_log(IDE_DBG_FUNC, "enter");
-
- if (rq->buffer != bio_data(rq->bio)) {
- sector_t n =
- (rq->buffer - (char *)bio_data(rq->bio)) / SECTOR_SIZE;
-
- rq->buffer = bio_data(rq->bio);
- rq->nr_sectors += n;
- rq->sector -= n;
- }
- rq->current_nr_sectors = bio_cur_sectors(rq->bio);
- rq->hard_cur_sectors = rq->current_nr_sectors;
- rq->hard_nr_sectors = rq->nr_sectors;
- rq->hard_sector = rq->sector;
- rq->q->prep_rq_fn(rq->q, rq);
-}
-
static void ide_cd_request_sense_fixup(ide_drive_t *drive, struct request *rq)
{
ide_debug_log(IDE_DBG_FUNC, "rq->cmd[0]: 0x%x", rq->cmd[0]);
@@ -682,6 +630,17 @@ int ide_cd_queue_pc(ide_drive_t *drive,
return (flags & REQ_FAILED) ? -EIO : 0;
}
+static void ide_cd_error_cmd(ide_drive_t *drive, struct ide_cmd *cmd)
+{
+ unsigned int nr_bytes = cmd->nbytes - cmd->nleft;
+
+ if (cmd->tf_flags & IDE_TFLAG_WRITE)
+ nr_bytes -= cmd->last_xfer_len;
+
+ if (nr_bytes > 0)
+ ide_complete_rq(drive, 0, nr_bytes);
+}
+
/*
* Called from blk_end_request_callback() after the data of the request is
* completed and before the request itself is completed. By returning value '1',
@@ -695,6 +654,7 @@ static int cdrom_newpc_intr_dummy_cb(str
static ide_startstop_t cdrom_newpc_intr(ide_drive_t *drive)
{
ide_hwif_t *hwif = drive->hwif;
+ struct ide_cmd *cmd = &hwif->cmd;
struct request *rq = hwif->rq;
xfer_func_t *xferfunc;
ide_expiry_t *expiry = NULL;
@@ -761,11 +721,10 @@ static ide_startstop_t cdrom_newpc_intr(
* Otherwise, complete the command normally.
*/
uptodate = 1;
- if (rq->current_nr_sectors > 0) {
+ if (cmd->nleft > 0) {
printk(KERN_ERR PFX "%s: %s: data underrun "
- "(%d blocks)\n",
- drive->name, __func__,
- rq->current_nr_sectors);
+ "(%u bytes)\n", drive->name, __func__,
+ cmd->nleft);
if (!write)
rq->cmd_flags |= REQ_FAILED;
uptodate = 0;
@@ -787,24 +746,10 @@ static ide_startstop_t cdrom_newpc_intr(
if (blk_fs_request(rq)) {
if (write == 0) {
- int nskip;
-
if (ide_cd_check_transfer_size(drive, len))
goto out_end;
-
- /*
- * 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),
- thislen >> 9);
- if (nskip > 0) {
- ide_pad_transfer(drive, write, nskip << 9);
- rq->current_nr_sectors -= nskip;
- thislen -= (nskip << 9);
- }
}
+ cmd->last_xfer_len = 0;
}
if (ireason == 0) {
@@ -827,15 +772,15 @@ static ide_startstop_t cdrom_newpc_intr(
/* bio backed? */
if (rq->bio) {
if (blk_fs_request(rq)) {
- ptr = rq->buffer;
- blen = rq->current_nr_sectors << 9;
+ blen = min_t(int, thislen, cmd->nleft);
} else {
ptr = bio_data(rq->bio);
blen = bio_iovec(rq->bio)->bv_len;
}
}
- if (!ptr) {
+ if ((blk_fs_request(rq) && cmd->nleft == 0) ||
+ (blk_fs_request(rq) == 0 && ptr == NULL)) {
if (blk_fs_request(rq) && !write)
/*
* If the buffers are full, pipe the rest into
@@ -855,26 +800,16 @@ static ide_startstop_t cdrom_newpc_intr(
if (blen > thislen)
blen = thislen;
- xferfunc(drive, NULL, ptr, blen);
+ if (blk_fs_request(rq)) {
+ ide_pio_bytes(drive, cmd, write, blen);
+ cmd->last_xfer_len += blen;
+ } else
+ xferfunc(drive, NULL, ptr, blen);
thislen -= blen;
len -= blen;
- if (blk_fs_request(rq)) {
- rq->buffer += blen;
- rq->nr_sectors -= (blen >> 9);
- rq->current_nr_sectors -= (blen >> 9);
- rq->sector += (blen >> 9);
-
- if (rq->current_nr_sectors == 0 && rq->nr_sectors) {
- nsectors = rq->hard_cur_sectors;
-
- if (nsectors == 0)
- nsectors = 1;
-
- ide_complete_rq(drive, 0, nsectors << 9);
- }
- } else {
+ if (blk_fs_request(rq) == 0) {
rq->data_len -= blen;
/*
@@ -925,8 +860,10 @@ out_end:
ide_cd_complete_failed_rq(drive, rq);
if (blk_fs_request(rq)) {
- if (rq->current_nr_sectors == 0)
+ if (cmd->nleft == 0)
uptodate = 1;
+ if (uptodate == 0)
+ ide_cd_error_cmd(drive, cmd);
} else {
if (uptodate <= 0 && rq->errors == 0)
rq->errors = -EIO;
@@ -936,7 +873,7 @@ out_end:
if (blk_pc_request(rq))
nsectors = (rq->data_len + 511) >> 9;
else
- nsectors = rq->hard_cur_sectors;
+ nsectors = rq->hard_nr_sectors;
if (nsectors == 0)
nsectors = 1;
@@ -952,9 +889,10 @@ out_end:
static ide_startstop_t cdrom_start_rw(ide_drive_t *drive, struct request *rq)
{
struct cdrom_info *cd = drive->driver_data;
+ struct request_queue *q = drive->queue;
int write = rq_data_dir(rq) == WRITE;
unsigned short sectors_per_frame =
- queue_hardsect_size(drive->queue) >> SECTOR_BITS;
+ queue_hardsect_size(q) >> SECTOR_BITS;
ide_debug_log(IDE_DBG_RQ, "rq->cmd[0]: 0x%x, write: 0x%x, "
"secs_per_frame: %u",
@@ -969,17 +907,16 @@ static ide_startstop_t cdrom_start_rw(id
* We may be retrying this request after an error. Fix up any
* weirdness which might be present in the request packet.
*/
- ide_cd_restore_request(drive, rq);
+ q->prep_rq_fn(q, rq);
}
- /* use DMA, if possible / writes *must* be hardware frame aligned */
+ /* fs requests *must* be hardware frame aligned */
if ((rq->nr_sectors & (sectors_per_frame - 1)) ||
- (rq->sector & (sectors_per_frame - 1))) {
- if (write)
- return ide_stopped;
- drive->dma = 0;
- } else
- drive->dma = !!(drive->dev_flags & IDE_DFLAG_USING_DMA);
+ (rq->sector & (sectors_per_frame - 1)))
+ return ide_stopped;
+
+ /* use DMA, if possible */
+ drive->dma = !!(drive->dev_flags & IDE_DFLAG_USING_DMA);
if (write)
cd->devinfo.media_written = 1;
@@ -1042,8 +979,6 @@ static ide_startstop_t ide_cd_do_request
if (blk_fs_request(rq)) {
if (cdrom_start_rw(drive, rq) == ide_stopped ||
ide_cd_prepare_rw_request(drive, rq) == ide_stopped) {
- if (rq->current_nr_sectors == 0)
- uptodate = 1;
goto out_end;
}
} else if (blk_sense_request(rq) || blk_pc_request(rq) ||
@@ -1070,6 +1005,11 @@ static ide_startstop_t ide_cd_do_request
cmd.rq = rq;
+ if (blk_fs_request(rq)) {
+ ide_init_sg_cmd(&cmd, rq->nr_sectors << 9);
+ ide_map_sg(drive, &cmd);
+ }
+
return ide_issue_pc(drive, &cmd);
out_end:
nsectors = rq->hard_nr_sectors;
Index: b/drivers/ide/ide-taskfile.c
===================================================================
--- a/drivers/ide/ide-taskfile.c
+++ b/drivers/ide/ide-taskfile.c
@@ -188,8 +188,8 @@ static u8 wait_drive_not_busy(ide_drive_
return stat;
}
-static void ide_pio_bytes(ide_drive_t *drive, struct ide_cmd *cmd,
- unsigned int write, unsigned int len)
+void ide_pio_bytes(ide_drive_t *drive, struct ide_cmd *cmd,
+ unsigned int write, unsigned int len)
{
ide_hwif_t *hwif = drive->hwif;
struct scatterlist *sg = hwif->sg_table;
@@ -240,6 +240,7 @@ static void ide_pio_bytes(ide_drive_t *d
len -= nr_bytes;
}
}
+EXPORT_SYMBOL_GPL(ide_pio_bytes);
static void ide_pio_datablock(ide_drive_t *drive, struct ide_cmd *cmd,
unsigned int write)
Index: b/include/linux/ide.h
===================================================================
--- a/include/linux/ide.h
+++ b/include/linux/ide.h
@@ -351,6 +351,8 @@ struct ide_cmd {
unsigned int nbytes;
unsigned int nleft;
+ unsigned int last_xfer_len;
+
struct scatterlist *cursg;
unsigned int cursg_ofs;
@@ -1223,6 +1225,8 @@ ide_startstop_t ide_issue_pc(ide_drive_t
ide_startstop_t do_rw_taskfile(ide_drive_t *, struct ide_cmd *);
+void ide_pio_bytes(ide_drive_t *, struct ide_cmd *, unsigned int, unsigned int);
+
void ide_finish_cmd(ide_drive_t *, struct ide_cmd *, u8);
int ide_raw_taskfile(ide_drive_t *, struct ide_cmd *, u8 *, u16);
^ permalink raw reply [flat|nested] 23+ messages in thread
* [PATCH 16/20] ide-cd: fix non-SECTOR_SIZE-multiples PIO transfers for fs requests
2009-02-16 0:13 [PATCH 00/20] ide-cd: use scatterlists also for PIO transfers Bartlomiej Zolnierkiewicz
` (14 preceding siblings ...)
2009-02-16 0:14 ` [PATCH 15/20] ide-cd: use scatterlists for PIO transfers (fs requests) Bartlomiej Zolnierkiewicz
@ 2009-02-16 0:14 ` Bartlomiej Zolnierkiewicz
2009-02-16 0:15 ` [PATCH 17/20] ide-cd: merge ide_cd_prepare_rw_request() into cdrom_start_rw() Bartlomiej Zolnierkiewicz
` (3 subsequent siblings)
19 siblings, 0 replies; 23+ messages in thread
From: Bartlomiej Zolnierkiewicz @ 2009-02-16 0:14 UTC (permalink / raw)
To: linux-ide; +Cc: Borislav Petkov, Bartlomiej Zolnierkiewicz, linux-kernel
From: Bartlomiej Zolnierkiewicz <bzolnier@gmail.com>
Subject: [PATCH] ide-cd: fix non-SECTOR_SIZE-multiples PIO transfers for fs requests
We now support arbitrary number of bytes per-IRQ also for fs requests
so remove ide_cd_check_transfer_size() and IDE_AFLAG_LIMIT_NFRAMES.
Cc: Borislav Petkov <petkovbb@gmail.com>
Signed-off-by: Bartlomiej Zolnierkiewicz <bzolnier@gmail.com>
---
drivers/ide/ide-cd.c | 36 +-----------------------------------
include/linux/ide.h | 5 -----
2 files changed, 1 insertion(+), 40 deletions(-)
Index: b/drivers/ide/ide-cd.c
===================================================================
--- a/drivers/ide/ide-cd.c
+++ b/drivers/ide/ide-cd.c
@@ -501,31 +501,6 @@ static int ide_cd_check_ireason(ide_driv
return -1;
}
-/*
- * Assume that the drive will always provide data in multiples of at least
- * SECTOR_SIZE, as it gets hairy to keep track of the transfers otherwise.
- */
-static int ide_cd_check_transfer_size(ide_drive_t *drive, int len)
-{
- ide_debug_log(IDE_DBG_FUNC, "len: %d", len);
-
- if ((len % SECTOR_SIZE) == 0)
- return 0;
-
- printk(KERN_ERR PFX "%s: %s: Bad transfer size %d\n", drive->name,
- __func__, len);
-
- if (drive->atapi_flags & IDE_AFLAG_LIMIT_NFRAMES)
- printk(KERN_ERR PFX "This drive is not supported by this "
- "version of the driver\n");
- else {
- printk(KERN_ERR PFX "Trying to limit transfer sizes\n");
- drive->atapi_flags |= IDE_AFLAG_LIMIT_NFRAMES;
- }
-
- return 1;
-}
-
static ide_startstop_t ide_cd_prepare_rw_request(ide_drive_t *drive,
struct request *rq)
{
@@ -744,13 +719,7 @@ static ide_startstop_t cdrom_newpc_intr(
if (rc)
goto out_end;
- if (blk_fs_request(rq)) {
- if (write == 0) {
- if (ide_cd_check_transfer_size(drive, len))
- goto out_end;
- }
- cmd->last_xfer_len = 0;
- }
+ cmd->last_xfer_len = 0;
if (ireason == 0) {
write = 1;
@@ -1611,9 +1580,6 @@ static const struct ide_proc_devset *ide
#endif
static const struct cd_list_entry ide_cd_quirks_list[] = {
- /* Limit transfer size per interrupt. */
- { "SAMSUNG CD-ROM SCR-2430", NULL, IDE_AFLAG_LIMIT_NFRAMES },
- { "SAMSUNG CD-ROM SCR-2432", NULL, IDE_AFLAG_LIMIT_NFRAMES },
/* SCR-3231 doesn't support the SET_CD_SPEED command. */
{ "SAMSUNG CD-ROM SCR-3231", NULL, IDE_AFLAG_NO_SPEED_SELECT },
/* Old NEC260 (not R) was released before ATAPI 1.2 spec. */
Index: b/include/linux/ide.h
===================================================================
--- a/include/linux/ide.h
+++ b/include/linux/ide.h
@@ -458,11 +458,6 @@ enum {
IDE_AFLAG_TOCADDR_AS_BCD = (1 << 3),
/* TOC track numbers are in BCD. */
IDE_AFLAG_TOCTRACKS_AS_BCD = (1 << 4),
- /*
- * Drive does not provide data in multiples of SECTOR_SIZE
- * when more than one interrupt is needed.
- */
- IDE_AFLAG_LIMIT_NFRAMES = (1 << 5),
/* Saved TOC information is current. */
IDE_AFLAG_TOC_VALID = (1 << 6),
/* We think that the drive door is locked. */
^ permalink raw reply [flat|nested] 23+ messages in thread
* [PATCH 17/20] ide-cd: merge ide_cd_prepare_rw_request() into cdrom_start_rw()
2009-02-16 0:13 [PATCH 00/20] ide-cd: use scatterlists also for PIO transfers Bartlomiej Zolnierkiewicz
` (15 preceding siblings ...)
2009-02-16 0:14 ` [PATCH 16/20] ide-cd: fix non-SECTOR_SIZE-multiples PIO transfers for fs requests Bartlomiej Zolnierkiewicz
@ 2009-02-16 0:15 ` Bartlomiej Zolnierkiewicz
2009-02-16 0:15 ` [PATCH 18/20] ide-cd: use scatterlists for PIO transfers (non-fs requests) Bartlomiej Zolnierkiewicz
` (2 subsequent siblings)
19 siblings, 0 replies; 23+ messages in thread
From: Bartlomiej Zolnierkiewicz @ 2009-02-16 0:15 UTC (permalink / raw)
To: linux-ide; +Cc: Borislav Petkov, Bartlomiej Zolnierkiewicz, linux-kernel
From: Bartlomiej Zolnierkiewicz <bzolnier@gmail.com>
Subject: [PATCH] ide-cd: merge ide_cd_prepare_rw_request() into cdrom_start_rw()
There should be no functional changes caused by this patch.
Cc: Borislav Petkov <petkovbb@gmail.com>
Signed-off-by: Bartlomiej Zolnierkiewicz <bzolnier@gmail.com>
---
drivers/ide/ide-cd.c | 21 +++++----------------
1 file changed, 5 insertions(+), 16 deletions(-)
Index: b/drivers/ide/ide-cd.c
===================================================================
--- a/drivers/ide/ide-cd.c
+++ b/drivers/ide/ide-cd.c
@@ -501,17 +501,6 @@ static int ide_cd_check_ireason(ide_driv
return -1;
}
-static ide_startstop_t ide_cd_prepare_rw_request(ide_drive_t *drive,
- struct request *rq)
-{
- ide_debug_log(IDE_DBG_RQ, "rq->cmd_flags: 0x%x", rq->cmd_flags);
-
- /* set up the command */
- rq->timeout = ATAPI_WAIT_PC;
-
- return ide_started;
-}
-
static void ide_cd_request_sense_fixup(ide_drive_t *drive, struct request *rq)
{
ide_debug_log(IDE_DBG_FUNC, "rq->cmd[0]: 0x%x", rq->cmd[0]);
@@ -863,9 +852,9 @@ static ide_startstop_t cdrom_start_rw(id
unsigned short sectors_per_frame =
queue_hardsect_size(q) >> SECTOR_BITS;
- ide_debug_log(IDE_DBG_RQ, "rq->cmd[0]: 0x%x, write: 0x%x, "
+ ide_debug_log(IDE_DBG_RQ, "rq->cmd[0]: 0x%x, rq->cmd_flags: 0x%x, "
"secs_per_frame: %u",
- rq->cmd[0], write, sectors_per_frame);
+ rq->cmd[0], rq->cmd_flags, sectors_per_frame);
if (write) {
/* disk has become write protected */
@@ -890,6 +879,8 @@ static ide_startstop_t cdrom_start_rw(id
if (write)
cd->devinfo.media_written = 1;
+ rq->timeout = ATAPI_WAIT_PC;
+
return ide_started;
}
@@ -946,10 +937,8 @@ static ide_startstop_t ide_cd_do_request
blk_dump_rq_flags(rq, "ide_cd_do_request");
if (blk_fs_request(rq)) {
- if (cdrom_start_rw(drive, rq) == ide_stopped ||
- ide_cd_prepare_rw_request(drive, rq) == ide_stopped) {
+ if (cdrom_start_rw(drive, rq) == ide_stopped)
goto out_end;
- }
} else if (blk_sense_request(rq) || blk_pc_request(rq) ||
rq->cmd_type == REQ_TYPE_ATA_PC) {
if (!rq->timeout)
^ permalink raw reply [flat|nested] 23+ messages in thread
* [PATCH 18/20] ide-cd: use scatterlists for PIO transfers (non-fs requests)
2009-02-16 0:13 [PATCH 00/20] ide-cd: use scatterlists also for PIO transfers Bartlomiej Zolnierkiewicz
` (16 preceding siblings ...)
2009-02-16 0:15 ` [PATCH 17/20] ide-cd: merge ide_cd_prepare_rw_request() into cdrom_start_rw() Bartlomiej Zolnierkiewicz
@ 2009-02-16 0:15 ` Bartlomiej Zolnierkiewicz
2009-02-16 0:15 ` [PATCH 19/20] ide-cd: use common completion path for DMA requests in cdrom_newpc_intr() Bartlomiej Zolnierkiewicz
2009-02-16 0:15 ` [PATCH 20/20] ide-cd: unify transfer padding " Bartlomiej Zolnierkiewicz
19 siblings, 0 replies; 23+ messages in thread
From: Bartlomiej Zolnierkiewicz @ 2009-02-16 0:15 UTC (permalink / raw)
To: linux-ide; +Cc: Borislav Petkov, Bartlomiej Zolnierkiewicz, linux-kernel
From: Bartlomiej Zolnierkiewicz <bzolnier@gmail.com>
Subject: [PATCH] ide-cd: use scatterlists for PIO transfers (non-fs requests)
Convert ide-cd to use scatterlists for PIO transfers and get rid of
partial completions (except on error) also for non-fs requests.
Cc: Borislav Petkov <petkovbb@gmail.com>
Signed-off-by: Bartlomiej Zolnierkiewicz <bzolnier@gmail.com>
---
drivers/ide/ide-cd.c | 102 +++++++++++++++------------------------------------
1 file changed, 30 insertions(+), 72 deletions(-)
Index: b/drivers/ide/ide-cd.c
===================================================================
--- a/drivers/ide/ide-cd.c
+++ b/drivers/ide/ide-cd.c
@@ -501,8 +501,10 @@ static int ide_cd_check_ireason(ide_driv
return -1;
}
-static void ide_cd_request_sense_fixup(ide_drive_t *drive, struct request *rq)
+static void ide_cd_request_sense_fixup(ide_drive_t *drive, struct ide_cmd *cmd)
{
+ struct request *rq = cmd->rq;
+
ide_debug_log(IDE_DBG_FUNC, "rq->cmd[0]: 0x%x", rq->cmd[0]);
/*
@@ -510,11 +512,14 @@ static void ide_cd_request_sense_fixup(i
* and some drives don't send them. Sigh.
*/
if (rq->cmd[0] == GPCMD_REQUEST_SENSE &&
- rq->data_len > 0 && rq->data_len <= 5)
- while (rq->data_len > 0) {
- *(u8 *)rq->data++ = 0;
- --rq->data_len;
+ cmd->nleft > 0 && cmd->nleft <= 5) {
+ unsigned int ofs = cmd->nbytes - cmd->nleft;
+
+ while (cmd->nleft > 0) {
+ *((u8 *)rq->data + ofs++) = 0;
+ cmd->nleft--;
}
+ }
}
int ide_cd_queue_pc(ide_drive_t *drive, const unsigned char *cmd,
@@ -605,22 +610,11 @@ static void ide_cd_error_cmd(ide_drive_t
ide_complete_rq(drive, 0, nr_bytes);
}
-/*
- * Called from blk_end_request_callback() after the data of the request is
- * completed and before the request itself is completed. By returning value '1',
- * blk_end_request_callback() returns immediately without completing it.
- */
-static int cdrom_newpc_intr_dummy_cb(struct request *rq)
-{
- return 1;
-}
-
static ide_startstop_t cdrom_newpc_intr(ide_drive_t *drive)
{
ide_hwif_t *hwif = drive->hwif;
struct ide_cmd *cmd = &hwif->cmd;
struct request *rq = hwif->rq;
- xfer_func_t *xferfunc;
ide_expiry_t *expiry = NULL;
int dma_error = 0, dma, stat, thislen, uptodate = 0;
int write = (rq_data_dir(rq) == WRITE) ? 1 : 0, rc, nsectors;
@@ -670,7 +664,7 @@ static ide_startstop_t cdrom_newpc_intr(
ide_read_bcount_and_ireason(drive, &len, &ireason);
- thislen = blk_fs_request(rq) ? len : rq->data_len;
+ thislen = blk_fs_request(rq) ? len : cmd->nleft;
if (thislen > len)
thislen = len;
@@ -694,9 +688,9 @@ static ide_startstop_t cdrom_newpc_intr(
uptodate = 0;
}
} else if (!blk_pc_request(rq)) {
- ide_cd_request_sense_fixup(drive, rq);
+ ide_cd_request_sense_fixup(drive, cmd);
/* complain if we still have data left to transfer */
- uptodate = rq->data_len ? 0 : 1;
+ uptodate = cmd->nleft ? 0 : 1;
if (uptodate == 0)
rq->cmd_flags |= REQ_FAILED;
}
@@ -710,35 +704,15 @@ static ide_startstop_t cdrom_newpc_intr(
cmd->last_xfer_len = 0;
- if (ireason == 0) {
- write = 1;
- xferfunc = hwif->tp_ops->output_data;
- } else {
- write = 0;
- xferfunc = hwif->tp_ops->input_data;
- }
-
ide_debug_log(IDE_DBG_PC, "data transfer, rq->cmd_type: 0x%x, "
"ireason: 0x%x",
rq->cmd_type, ireason);
/* transfer data */
while (thislen > 0) {
- u8 *ptr = blk_fs_request(rq) ? NULL : rq->data;
- int blen = rq->data_len;
-
- /* bio backed? */
- if (rq->bio) {
- if (blk_fs_request(rq)) {
- blen = min_t(int, thislen, cmd->nleft);
- } else {
- ptr = bio_data(rq->bio);
- blen = bio_iovec(rq->bio)->bv_len;
- }
- }
+ int blen = min_t(int, thislen, cmd->nleft);
- if ((blk_fs_request(rq) && cmd->nleft == 0) ||
- (blk_fs_request(rq) == 0 && ptr == NULL)) {
+ if (cmd->nleft == 0) {
if (blk_fs_request(rq) && !write)
/*
* If the buffers are full, pipe the rest into
@@ -755,33 +729,12 @@ static ide_startstop_t cdrom_newpc_intr(
break;
}
- if (blen > thislen)
- blen = thislen;
-
- if (blk_fs_request(rq)) {
- ide_pio_bytes(drive, cmd, write, blen);
- cmd->last_xfer_len += blen;
- } else
- xferfunc(drive, NULL, ptr, blen);
+ ide_pio_bytes(drive, cmd, write, blen);
+ cmd->last_xfer_len += blen;
thislen -= blen;
len -= blen;
- if (blk_fs_request(rq) == 0) {
- rq->data_len -= blen;
-
- /*
- * The request can't be completed until DRQ is cleared.
- * So complete the data, but don't complete the request
- * using the dummy function for the callback feature
- * of blk_end_request_callback().
- */
- if (rq->bio)
- blk_end_request_callback(rq, 0, blen,
- cdrom_newpc_intr_dummy_cb);
- else
- rq->data += blen;
- }
if (sense && write == 0)
rq->sense_len += blen;
}
@@ -806,8 +759,7 @@ out_end:
if (blk_pc_request(rq) && rc == 0) {
unsigned int dlen = rq->data_len;
- if (dma)
- rq->data_len = 0;
+ rq->data_len = 0;
if (blk_end_request(rq, 0, dlen))
BUG();
@@ -820,13 +772,14 @@ out_end:
if (blk_fs_request(rq)) {
if (cmd->nleft == 0)
uptodate = 1;
- if (uptodate == 0)
- ide_cd_error_cmd(drive, cmd);
} else {
if (uptodate <= 0 && rq->errors == 0)
rq->errors = -EIO;
}
+ if (uptodate == 0)
+ ide_cd_error_cmd(drive, cmd);
+
/* make sure it's fully ended */
if (blk_pc_request(rq))
nsectors = (rq->data_len + 511) >> 9;
@@ -836,6 +789,12 @@ out_end:
if (nsectors == 0)
nsectors = 1;
+ if (blk_fs_request(rq) == 0) {
+ rq->data_len -= (cmd->nbytes - cmd->nleft);
+ if (uptodate == 0 && (cmd->tf_flags & IDE_TFLAG_WRITE))
+ rq->data_len += cmd->last_xfer_len;
+ }
+
ide_complete_rq(drive, uptodate ? 0 : -EIO, nsectors << 9);
if (sense && rc == 2)
@@ -963,10 +922,9 @@ static ide_startstop_t ide_cd_do_request
cmd.rq = rq;
- if (blk_fs_request(rq)) {
- ide_init_sg_cmd(&cmd, rq->nr_sectors << 9);
- ide_map_sg(drive, &cmd);
- }
+ ide_init_sg_cmd(&cmd,
+ blk_fs_request(rq) ? (rq->nr_sectors << 9) : rq->data_len);
+ ide_map_sg(drive, &cmd);
return ide_issue_pc(drive, &cmd);
out_end:
^ permalink raw reply [flat|nested] 23+ messages in thread
* [PATCH 19/20] ide-cd: use common completion path for DMA requests in cdrom_newpc_intr()
2009-02-16 0:13 [PATCH 00/20] ide-cd: use scatterlists also for PIO transfers Bartlomiej Zolnierkiewicz
` (17 preceding siblings ...)
2009-02-16 0:15 ` [PATCH 18/20] ide-cd: use scatterlists for PIO transfers (non-fs requests) Bartlomiej Zolnierkiewicz
@ 2009-02-16 0:15 ` Bartlomiej Zolnierkiewicz
2009-02-16 0:15 ` [PATCH 20/20] ide-cd: unify transfer padding " Bartlomiej Zolnierkiewicz
19 siblings, 0 replies; 23+ messages in thread
From: Bartlomiej Zolnierkiewicz @ 2009-02-16 0:15 UTC (permalink / raw)
To: linux-ide; +Cc: Borislav Petkov, Bartlomiej Zolnierkiewicz, linux-kernel
From: Bartlomiej Zolnierkiewicz <bzolnier@gmail.com>
Subject: [PATCH] ide-cd: use common completion path for DMA requests in cdrom_newpc_intr()
Use the following facts:
- rq->nr_sectors should now be always equal to (non-zero)
rq->hard_nr_sectors for fs requests
- REQ_TYPE_ATA_PC requests have never bio attached to them
- rq->hard_nr_sectors == 0 for REQ_TYPE_ATA_PC requests
- DMA is used only for fs, pc and REQ_TYPE_ATA_PC requests
- 'uptodate' is ignored for pc requests ('rc == 0' case)
and use the common completion path also for DMA requests.
There should be no functional changes caused by this patch
Cc: Borislav Petkov <petkovbb@gmail.com>
Signed-off-by: Bartlomiej Zolnierkiewicz <bzolnier@gmail.com>
---
drivers/ide/ide-cd.c | 11 +----------
1 file changed, 1 insertion(+), 10 deletions(-)
Index: b/drivers/ide/ide-cd.c
===================================================================
--- a/drivers/ide/ide-cd.c
+++ b/drivers/ide/ide-cd.c
@@ -660,16 +660,7 @@ static ide_startstop_t cdrom_newpc_intr(
if (dma) {
if (dma_error)
return ide_error(drive, "dma error", stat);
- if (blk_fs_request(rq)) {
- ide_complete_rq(drive, 0, rq->nr_sectors
- ? (rq->nr_sectors << 9) : ide_rq_bytes(rq));
- return ide_stopped;
- } else if (rq->cmd_type == REQ_TYPE_ATA_PC && !rq->bio) {
- ide_complete_rq(drive, 0, 512);
- return ide_stopped;
- }
- if (blk_pc_request(rq) == 0 && uptodate == 0)
- rq->cmd_flags |= REQ_FAILED;
+ uptodate = 1;
goto out_end;
}
^ permalink raw reply [flat|nested] 23+ messages in thread
* [PATCH 20/20] ide-cd: unify transfer padding in cdrom_newpc_intr()
2009-02-16 0:13 [PATCH 00/20] ide-cd: use scatterlists also for PIO transfers Bartlomiej Zolnierkiewicz
` (18 preceding siblings ...)
2009-02-16 0:15 ` [PATCH 19/20] ide-cd: use common completion path for DMA requests in cdrom_newpc_intr() Bartlomiej Zolnierkiewicz
@ 2009-02-16 0:15 ` Bartlomiej Zolnierkiewicz
19 siblings, 0 replies; 23+ messages in thread
From: Bartlomiej Zolnierkiewicz @ 2009-02-16 0:15 UTC (permalink / raw)
To: linux-ide; +Cc: Borislav Petkov, Bartlomiej Zolnierkiewicz, linux-kernel
From: Bartlomiej Zolnierkiewicz <bzolnier@gmail.com>
Subject: [PATCH] ide-cd: unify transfer padding in cdrom_newpc_intr()
* 'thislen' is always <= cmd->nleft for non-fs requests so the transfer
padding inside the 'while (thislen > 0)' loop can happen only for fs
requests -- then move it out of the loop and unify with the transfer
padding for non-fs requests ('thislen' == 'len' for fs requests).
* blk_dump_rq_flags() dumps all request flags so it is enough to pass
only the function name to it.
* Update my Copyrights while at it.
Cc: Borislav Petkov <petkovbb@gmail.com>
Signed-off-by: Bartlomiej Zolnierkiewicz <bzolnier@gmail.com>
---
drivers/ide/ide-cd.c | 29 +++++++++++------------------
1 file changed, 11 insertions(+), 18 deletions(-)
Index: b/drivers/ide/ide-cd.c
===================================================================
--- a/drivers/ide/ide-cd.c
+++ b/drivers/ide/ide-cd.c
@@ -4,7 +4,7 @@
* Copyright (C) 1994-1996 Scott Snyder <snyder@fnald0.fnal.gov>
* Copyright (C) 1996-1998 Erik Andersen <andersee@debian.org>
* Copyright (C) 1998-2000 Jens Axboe <axboe@suse.de>
- * Copyright (C) 2005, 2007 Bartlomiej Zolnierkiewicz
+ * Copyright (C) 2005, 2007-2009 Bartlomiej Zolnierkiewicz
*
* May be copied or modified under the terms of the GNU General Public
* License. See linux/COPYING for more information.
@@ -703,22 +703,8 @@ static ide_startstop_t cdrom_newpc_intr(
while (thislen > 0) {
int blen = min_t(int, thislen, cmd->nleft);
- if (cmd->nleft == 0) {
- if (blk_fs_request(rq) && !write)
- /*
- * If the buffers are full, pipe the rest into
- * oblivion.
- */
- ide_pad_transfer(drive, 0, thislen);
- else {
- printk(KERN_ERR PFX "%s: confused, missing data\n",
- drive->name);
- blk_dump_rq_flags(rq, rq_data_dir(rq)
- ? "cdrom_newpc_intr, write"
- : "cdrom_newpc_intr, read");
- }
+ if (cmd->nleft == 0)
break;
- }
ide_pio_bytes(drive, cmd, write, blen);
cmd->last_xfer_len += blen;
@@ -731,8 +717,15 @@ static ide_startstop_t cdrom_newpc_intr(
}
/* pad, if necessary */
- if (!blk_fs_request(rq) && len > 0)
- ide_pad_transfer(drive, write, len);
+ if (len > 0) {
+ if (blk_fs_request(rq) == 0 || write == 0)
+ ide_pad_transfer(drive, write, len);
+ else {
+ printk(KERN_ERR PFX "%s: confused, missing data\n",
+ drive->name);
+ blk_dump_rq_flags(rq, "cdrom_newpc_intr");
+ }
+ }
if (blk_pc_request(rq)) {
timeout = rq->timeout;
^ permalink raw reply [flat|nested] 23+ messages in thread
* Re: [PATCH 11/20] ide-cd: unify cdrom_newpc_intr() exit paths
2009-02-16 0:14 ` [PATCH 11/20] ide-cd: unify cdrom_newpc_intr() exit paths Bartlomiej Zolnierkiewicz
@ 2009-02-16 9:25 ` Borislav Petkov
2009-02-16 21:09 ` Bartlomiej Zolnierkiewicz
0 siblings, 1 reply; 23+ messages in thread
From: Borislav Petkov @ 2009-02-16 9:25 UTC (permalink / raw)
To: Bartlomiej Zolnierkiewicz; +Cc: linux-ide, linux-kernel
On Mon, Feb 16, 2009 at 01:14:22AM +0100, Bartlomiej Zolnierkiewicz wrote:
> From: Bartlomiej Zolnierkiewicz <bzolnier@gmail.com>
> Subject: [PATCH] ide-cd: unify cdrom_newpc_intr() exit paths
>
> * Move cdrom_end_request() calls from cdrom_decode_status()
> and ide_cd_check_ireason() to cdrom_newpc_intr().
>
> * Unify cdrom_newpc_intr() exit paths.
>
> There should be no functional changes caused by this patch.
>
> Cc: Borislav Petkov <petkovbb@gmail.com>
> Signed-off-by: Bartlomiej Zolnierkiewicz <bzolnier@gmail.com>
> ---
> drivers/ide/ide-cd.c | 48 +++++++++++++++++++++++-------------------------
> 1 file changed, 23 insertions(+), 25 deletions(-)
>
> Index: b/drivers/ide/ide-cd.c
> ===================================================================
> --- a/drivers/ide/ide-cd.c
> +++ b/drivers/ide/ide-cd.c
> @@ -291,7 +291,8 @@ static void cdrom_end_request(ide_drive_
> /*
> * Returns:
> * 0: if the request should be continued.
> - * 1: if the request was ended.
> + * 1: if the request will be going through error recovery.
> + * 2: if the request should be ended.
Yeah, we need defines for those. Especially if they're checked in other
functions:
if (rc == 2)
is simply not ok :). Rather,
if (rc == DO_END_REQUEST)
or something like that is much better, imho.
> */
> static int cdrom_decode_status(ide_drive_t *drive, int good_stat, int *stat_ret)
> {
> @@ -324,10 +325,7 @@ static int cdrom_decode_status(ide_drive
> * Just give up.
> */
> rq->cmd_flags |= REQ_FAILED;
> - cdrom_end_request(drive, 0);
> - ide_error(drive, "request sense failure", stat);
> - return 1;
> -
> + return 2;
> } else if (blk_pc_request(rq) || rq->cmd_type == REQ_TYPE_ATA_PC) {
> /* All other functions, except for READ. */
>
> @@ -467,14 +465,12 @@ static int cdrom_decode_status(ide_drive
> */
> if (stat & ATA_ERR)
> cdrom_queue_request_sense(drive, NULL, NULL);
> + return 1;
> } else {
> blk_dump_rq_flags(rq, PFX "bad rq");
> - cdrom_end_request(drive, 0);
> + return 2;
> }
>
> - /* retry, or handle the next request */
> - return 1;
> -
> end_request:
> if (stat & ATA_ERR) {
> struct request_queue *q = drive->queue;
> @@ -487,10 +483,9 @@ end_request:
> hwif->rq = NULL;
>
> cdrom_queue_request_sense(drive, rq->sense, rq);
> + return 1;
> } else
> - cdrom_end_request(drive, 0);
> -
> - return 1;
> + return 2;
> }
>
> /*
> @@ -534,7 +529,6 @@ static int ide_cd_check_ireason(ide_driv
> if (rq->cmd_type == REQ_TYPE_ATA_PC)
> rq->cmd_flags |= REQ_FAILED;
>
> - cdrom_end_request(drive, 0);
> return -1;
> }
>
> @@ -736,7 +730,8 @@ static ide_startstop_t cdrom_newpc_intr(
> xfer_func_t *xferfunc;
> ide_expiry_t *expiry = NULL;
> int dma_error = 0, dma, stat, thislen, uptodate = 0;
> - int write = (rq_data_dir(rq) == WRITE) ? 1 : 0;
> + int write = (rq_data_dir(rq) == WRITE) ? 1 : 0, rc;
> + int sense = blk_sense_request(rq);
> unsigned int timeout;
> u16 len;
> u8 ireason;
> @@ -756,8 +751,12 @@ static ide_startstop_t cdrom_newpc_intr(
> }
> }
>
> - if (cdrom_decode_status(drive, 0, &stat))
> + rc = cdrom_decode_status(drive, 0, &stat);
> + if (rc) {
> + if (rc == 2)
> + goto out_end;
> return ide_stopped;
> + }
>
> /* using dma, transfer is complete now */
> if (dma) {
> @@ -802,8 +801,6 @@ static ide_startstop_t cdrom_newpc_intr(
> rq->cmd_flags |= REQ_FAILED;
> uptodate = 0;
> }
> - cdrom_end_request(drive, uptodate);
> - return ide_stopped;
> } else if (!blk_pc_request(rq)) {
> ide_cd_request_sense_fixup(drive, rq);
> /* complain if we still have data left to transfer */
> @@ -815,17 +812,16 @@ static ide_startstop_t cdrom_newpc_intr(
> }
>
> /* check which way to transfer data */
> - if (ide_cd_check_ireason(drive, rq, len, ireason, write))
> - return ide_stopped;
> + rc = ide_cd_check_ireason(drive, rq, len, ireason, write);
> + if (rc)
> + goto out_end;
>
> if (blk_fs_request(rq)) {
> if (write == 0) {
> int nskip;
>
> - if (ide_cd_check_transfer_size(drive, len)) {
> - cdrom_end_request(drive, 0);
> - return ide_stopped;
> - }
> + if (ide_cd_check_transfer_size(drive, len))
> + goto out_end;
>
> /*
> * First, figure out if we need to bit-bucket
> @@ -918,7 +914,7 @@ static ide_startstop_t cdrom_newpc_intr(
> else
> rq->data += blen;
> }
> - if (!write && blk_sense_request(rq))
> + if (sense && write == 0)
> rq->sense_len += blen;
> }
>
> @@ -939,7 +935,7 @@ static ide_startstop_t cdrom_newpc_intr(
> return ide_started;
>
> out_end:
> - if (blk_pc_request(rq)) {
> + if (blk_pc_request(rq) && rc == 0) {
> unsigned int dlen = rq->data_len;
>
> if (dma)
> @@ -951,6 +947,8 @@ out_end:
> hwif->rq = NULL;
> } else {
> cdrom_end_request(drive, uptodate);
> + if (sense && rc == 2)
> + ide_error(drive, "request sense failure", stat);
> }
> return ide_stopped;
> }
--
Regards/Gruss,
Boris.
^ permalink raw reply [flat|nested] 23+ messages in thread
* Re: [PATCH 11/20] ide-cd: unify cdrom_newpc_intr() exit paths
2009-02-16 9:25 ` Borislav Petkov
@ 2009-02-16 21:09 ` Bartlomiej Zolnierkiewicz
0 siblings, 0 replies; 23+ messages in thread
From: Bartlomiej Zolnierkiewicz @ 2009-02-16 21:09 UTC (permalink / raw)
To: petkovbb; +Cc: linux-ide, linux-kernel
On Monday 16 February 2009, Borislav Petkov wrote:
> On Mon, Feb 16, 2009 at 01:14:22AM +0100, Bartlomiej Zolnierkiewicz wrote:
> > From: Bartlomiej Zolnierkiewicz <bzolnier@gmail.com>
> > Subject: [PATCH] ide-cd: unify cdrom_newpc_intr() exit paths
> >
> > * Move cdrom_end_request() calls from cdrom_decode_status()
> > and ide_cd_check_ireason() to cdrom_newpc_intr().
> >
> > * Unify cdrom_newpc_intr() exit paths.
> >
> > There should be no functional changes caused by this patch.
> >
> > Cc: Borislav Petkov <petkovbb@gmail.com>
> > Signed-off-by: Bartlomiej Zolnierkiewicz <bzolnier@gmail.com>
> > ---
> > drivers/ide/ide-cd.c | 48 +++++++++++++++++++++++-------------------------
> > 1 file changed, 23 insertions(+), 25 deletions(-)
> >
> > Index: b/drivers/ide/ide-cd.c
> > ===================================================================
> > --- a/drivers/ide/ide-cd.c
> > +++ b/drivers/ide/ide-cd.c
> > @@ -291,7 +291,8 @@ static void cdrom_end_request(ide_drive_
> > /*
> > * Returns:
> > * 0: if the request should be continued.
> > - * 1: if the request was ended.
> > + * 1: if the request will be going through error recovery.
> > + * 2: if the request should be ended.
>
> Yeah, we need defines for those. Especially if they're checked in other
> functions:
>
> if (rc == 2)
>
> is simply not ok :). Rather,
>
> if (rc == DO_END_REQUEST)
>
> or something like that is much better, imho.
The whole cdrom_decode_status() needs a rewrite. It could be as well
that after that happens magic defines won't be needed anylonger...
Thanks,
Bart
^ permalink raw reply [flat|nested] 23+ messages in thread
end of thread, other threads:[~2009-02-16 21:54 UTC | newest]
Thread overview: 23+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2009-02-16 0:13 [PATCH 00/20] ide-cd: use scatterlists also for PIO transfers Bartlomiej Zolnierkiewicz
2009-02-16 0:13 ` [PATCH 01/20] ide: add support for arbitrary transfer lengths to ide_pio_bytes() Bartlomiej Zolnierkiewicz
2009-02-16 0:13 ` [PATCH 02/20] ide: use PageHighMem() instead of ifdefs in ide_pio_bytes() Bartlomiej Zolnierkiewicz
2009-02-16 0:13 ` [PATCH 03/20] ide-cd: remove dead URLs Bartlomiej Zolnierkiewicz
2009-02-16 0:13 ` [PATCH 04/20] ide-cd: use ide_end_rq() also for failed non-fs requests Bartlomiej Zolnierkiewicz
2009-02-16 0:13 ` [PATCH 05/20] ide-cd: remove dead code from cdrom_decode_status() Bartlomiej Zolnierkiewicz
2009-02-16 0:13 ` [PATCH 06/20] ide: remove needless ide_dump_status_no_sense() wrapper Bartlomiej Zolnierkiewicz
2009-02-16 0:13 ` [PATCH 07/20] ide-cd: remove no longer needed 'ignore' module parameter Bartlomiej Zolnierkiewicz
2009-02-16 0:14 ` [PATCH 08/20] ide-cd: factor out failed request completion from cdrom_end_request() Bartlomiej Zolnierkiewicz
2009-02-16 0:14 ` [PATCH 09/20] ide-cd: unify ide_cd_do_request() exit paths Bartlomiej Zolnierkiewicz
2009-02-16 0:14 ` [PATCH 10/20] ide-cd: move setting REQ_FAILED flag out from 'end_request' exit path Bartlomiej Zolnierkiewicz
2009-02-16 0:14 ` [PATCH 11/20] ide-cd: unify cdrom_newpc_intr() exit paths Bartlomiej Zolnierkiewicz
2009-02-16 9:25 ` Borislav Petkov
2009-02-16 21:09 ` Bartlomiej Zolnierkiewicz
2009-02-16 0:14 ` [PATCH 12/20] ide-cd: remove cdrom_end_request() Bartlomiej Zolnierkiewicz
2009-02-16 0:14 ` [PATCH 13/20] ide-cd: kill whole failed request in ide_cd_do_request() Bartlomiej Zolnierkiewicz
2009-02-16 0:14 ` [PATCH 14/20] ide-cd: cleanup ide_cd_do_request() Bartlomiej Zolnierkiewicz
2009-02-16 0:14 ` [PATCH 15/20] ide-cd: use scatterlists for PIO transfers (fs requests) Bartlomiej Zolnierkiewicz
2009-02-16 0:14 ` [PATCH 16/20] ide-cd: fix non-SECTOR_SIZE-multiples PIO transfers for fs requests Bartlomiej Zolnierkiewicz
2009-02-16 0:15 ` [PATCH 17/20] ide-cd: merge ide_cd_prepare_rw_request() into cdrom_start_rw() Bartlomiej Zolnierkiewicz
2009-02-16 0:15 ` [PATCH 18/20] ide-cd: use scatterlists for PIO transfers (non-fs requests) Bartlomiej Zolnierkiewicz
2009-02-16 0:15 ` [PATCH 19/20] ide-cd: use common completion path for DMA requests in cdrom_newpc_intr() Bartlomiej Zolnierkiewicz
2009-02-16 0:15 ` [PATCH 20/20] ide-cd: unify transfer padding " Bartlomiej Zolnierkiewicz
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).