diff options
Diffstat (limited to 'drivers/ide/ide-tape.c')
-rw-r--r-- | drivers/ide/ide-tape.c | 43 |
1 files changed, 11 insertions, 32 deletions
diff --git a/drivers/ide/ide-tape.c b/drivers/ide/ide-tape.c index 8eb117519ba4..c4b470999203 100644 --- a/drivers/ide/ide-tape.c +++ b/drivers/ide/ide-tape.c | |||
@@ -221,19 +221,15 @@ enum { | |||
221 | /* 0 When the tape position is unknown */ | 221 | /* 0 When the tape position is unknown */ |
222 | IDETAPE_FLAG_ADDRESS_VALID = (1 << 1), | 222 | IDETAPE_FLAG_ADDRESS_VALID = (1 << 1), |
223 | /* Device already opened */ | 223 | /* Device already opened */ |
224 | IDETAPE_FLAG_BUSY = (1 << 2), | 224 | IDETAPE_FLAG_BUSY = (1 << 2), |
225 | /* Error detected in a pipeline stage */ | ||
226 | IDETAPE_FLAG_PIPELINE_ERR = (1 << 3), | ||
227 | /* Attempt to auto-detect the current user block size */ | 225 | /* Attempt to auto-detect the current user block size */ |
228 | IDETAPE_FLAG_DETECT_BS = (1 << 4), | 226 | IDETAPE_FLAG_DETECT_BS = (1 << 3), |
229 | /* Currently on a filemark */ | 227 | /* Currently on a filemark */ |
230 | IDETAPE_FLAG_FILEMARK = (1 << 5), | 228 | IDETAPE_FLAG_FILEMARK = (1 << 4), |
231 | /* DRQ interrupt device */ | 229 | /* DRQ interrupt device */ |
232 | IDETAPE_FLAG_DRQ_INTERRUPT = (1 << 6), | 230 | IDETAPE_FLAG_DRQ_INTERRUPT = (1 << 5), |
233 | /* pipeline active */ | ||
234 | IDETAPE_FLAG_PIPELINE_ACTIVE = (1 << 7), | ||
235 | /* 0 = no tape is loaded, so we don't rewind after ejecting */ | 231 | /* 0 = no tape is loaded, so we don't rewind after ejecting */ |
236 | IDETAPE_FLAG_MEDIUM_PRESENT = (1 << 8), | 232 | IDETAPE_FLAG_MEDIUM_PRESENT = (1 << 6), |
237 | }; | 233 | }; |
238 | 234 | ||
239 | /* A pipeline stage. */ | 235 | /* A pipeline stage. */ |
@@ -695,7 +691,6 @@ static int idetape_end_request(ide_drive_t *drive, int uptodate, int nr_sects) | |||
695 | 691 | ||
696 | ide_end_drive_cmd(drive, 0, 0); | 692 | ide_end_drive_cmd(drive, 0, 0); |
697 | 693 | ||
698 | clear_bit(IDETAPE_FLAG_PIPELINE_ACTIVE, &tape->flags); | ||
699 | spin_unlock_irqrestore(&tape->lock, flags); | 694 | spin_unlock_irqrestore(&tape->lock, flags); |
700 | return 0; | 695 | return 0; |
701 | } | 696 | } |
@@ -1728,8 +1723,6 @@ static int __idetape_discard_read_pipeline(ide_drive_t *drive) | |||
1728 | tape->merge_stage = NULL; | 1723 | tape->merge_stage = NULL; |
1729 | } | 1724 | } |
1730 | 1725 | ||
1731 | /* Clear pipeline flags. */ | ||
1732 | clear_bit(IDETAPE_FLAG_PIPELINE_ERR, &tape->flags); | ||
1733 | tape->chrdev_dir = IDETAPE_DIR_NONE; | 1726 | tape->chrdev_dir = IDETAPE_DIR_NONE; |
1734 | 1727 | ||
1735 | /* Remove pipeline stages. */ | 1728 | /* Remove pipeline stages. */ |
@@ -1808,12 +1801,6 @@ static int idetape_queue_rw_tail(ide_drive_t *drive, int cmd, int blocks, | |||
1808 | 1801 | ||
1809 | debug_log(DBG_SENSE, "%s: cmd=%d\n", __func__, cmd); | 1802 | debug_log(DBG_SENSE, "%s: cmd=%d\n", __func__, cmd); |
1810 | 1803 | ||
1811 | if (test_bit(IDETAPE_FLAG_PIPELINE_ACTIVE, &tape->flags)) { | ||
1812 | printk(KERN_ERR "ide-tape: bug: the pipeline is active in %s\n", | ||
1813 | __func__); | ||
1814 | return (0); | ||
1815 | } | ||
1816 | |||
1817 | idetape_init_rq(&rq, cmd); | 1804 | idetape_init_rq(&rq, cmd); |
1818 | rq.rq_disk = tape->disk; | 1805 | rq.rq_disk = tape->disk; |
1819 | rq.special = (void *)bh; | 1806 | rq.special = (void *)bh; |
@@ -1931,7 +1918,6 @@ static void idetape_empty_write_pipeline(ide_drive_t *drive) | |||
1931 | __idetape_kfree_stage(tape->merge_stage); | 1918 | __idetape_kfree_stage(tape->merge_stage); |
1932 | tape->merge_stage = NULL; | 1919 | tape->merge_stage = NULL; |
1933 | } | 1920 | } |
1934 | clear_bit(IDETAPE_FLAG_PIPELINE_ERR, &tape->flags); | ||
1935 | tape->chrdev_dir = IDETAPE_DIR_NONE; | 1921 | tape->chrdev_dir = IDETAPE_DIR_NONE; |
1936 | 1922 | ||
1937 | /* | 1923 | /* |
@@ -1993,14 +1979,13 @@ static int idetape_init_read(ide_drive_t *drive, int max_stages) | |||
1993 | } | 1979 | } |
1994 | } | 1980 | } |
1995 | 1981 | ||
1996 | if (!test_bit(IDETAPE_FLAG_PIPELINE_ACTIVE, &tape->flags)) { | 1982 | if (tape->nr_pending_stages >= 3 * max_stages / 4) { |
1997 | if (tape->nr_pending_stages >= 3 * max_stages / 4) { | 1983 | tape->measure_insert_time = 1; |
1998 | tape->measure_insert_time = 1; | 1984 | tape->insert_time = jiffies; |
1999 | tape->insert_time = jiffies; | 1985 | tape->insert_size = 0; |
2000 | tape->insert_size = 0; | 1986 | tape->insert_speed = 0; |
2001 | tape->insert_speed = 0; | ||
2002 | } | ||
2003 | } | 1987 | } |
1988 | |||
2004 | return 0; | 1989 | return 0; |
2005 | } | 1990 | } |
2006 | 1991 | ||
@@ -2020,9 +2005,6 @@ static int idetape_add_chrdev_read_request(ide_drive_t *drive, int blocks) | |||
2020 | 2005 | ||
2021 | idetape_init_read(drive, tape->max_stages); | 2006 | idetape_init_read(drive, tape->max_stages); |
2022 | 2007 | ||
2023 | if (test_bit(IDETAPE_FLAG_PIPELINE_ERR, &tape->flags)) | ||
2024 | return 0; | ||
2025 | |||
2026 | return idetape_queue_rw_tail(drive, REQ_IDETAPE_READ, blocks, | 2008 | return idetape_queue_rw_tail(drive, REQ_IDETAPE_READ, blocks, |
2027 | tape->merge_stage->bh); | 2009 | tape->merge_stage->bh); |
2028 | } | 2010 | } |
@@ -2604,9 +2586,6 @@ static int idetape_chrdev_open(struct inode *inode, struct file *filp) | |||
2604 | if (!test_bit(IDETAPE_FLAG_ADDRESS_VALID, &tape->flags)) | 2586 | if (!test_bit(IDETAPE_FLAG_ADDRESS_VALID, &tape->flags)) |
2605 | (void)idetape_rewind_tape(drive); | 2587 | (void)idetape_rewind_tape(drive); |
2606 | 2588 | ||
2607 | if (tape->chrdev_dir != IDETAPE_DIR_READ) | ||
2608 | clear_bit(IDETAPE_FLAG_PIPELINE_ERR, &tape->flags); | ||
2609 | |||
2610 | /* Read block size and write protect status from drive. */ | 2589 | /* Read block size and write protect status from drive. */ |
2611 | ide_tape_get_bsize_from_bdesc(drive); | 2590 | ide_tape_get_bsize_from_bdesc(drive); |
2612 | 2591 | ||