aboutsummaryrefslogtreecommitdiffstats
path: root/drivers
diff options
context:
space:
mode:
authorBorislav Petkov <petkovbb@googlemail.com>2008-04-27 09:38:27 -0400
committerBartlomiej Zolnierkiewicz <bzolnier@gmail.com>2008-04-27 09:38:27 -0400
commit189bb3b345f59b11484b43f2717a66824acdc548 (patch)
tree275b027fee8e6e75e194f6b76120918748ada706 /drivers
parent473567f1a4996a49cb5456e55815051a6e6eb3f1 (diff)
ide-tape: remove pipeline-specific code from idetape_end_request()
As a side effect, remove unused idetape_kfree_stage() and idetape_abort_pipeline() [bart: resurrect taking tape->lock + clearing IDETAPE_FLAG_PIPELINE_ACTIVE] Signed-off-by: Borislav Petkov <petkovbb@gmail.com> Signed-off-by: Bartlomiej Zolnierkiewicz <bzolnier@gmail.com>
Diffstat (limited to 'drivers')
-rw-r--r--drivers/ide/ide-tape.c80
1 files changed, 1 insertions, 79 deletions
diff --git a/drivers/ide/ide-tape.c b/drivers/ide/ide-tape.c
index cbba475ebc5a..d907abaed909 100644
--- a/drivers/ide/ide-tape.c
+++ b/drivers/ide/ide-tape.c
@@ -686,37 +686,6 @@ static void __idetape_kfree_stage(idetape_stage_t *stage)
686 kfree(stage); 686 kfree(stage);
687} 687}
688 688
689static void idetape_kfree_stage(idetape_tape_t *tape, idetape_stage_t *stage)
690{
691 __idetape_kfree_stage(stage);
692}
693
694/*
695 * This will free all the pipeline stages starting from new_last_stage->next
696 * to the end of the list, and point tape->last_stage to new_last_stage.
697 */
698static void idetape_abort_pipeline(ide_drive_t *drive,
699 idetape_stage_t *new_last_stage)
700{
701 idetape_tape_t *tape = drive->driver_data;
702 idetape_stage_t *stage = new_last_stage->next;
703 idetape_stage_t *nstage;
704
705 debug_log(DBG_PROCS, "%s: Enter %s\n", tape->name, __func__);
706
707 while (stage) {
708 nstage = stage->next;
709 idetape_kfree_stage(tape, stage);
710 --tape->nr_stages;
711 --tape->nr_pending_stages;
712 stage = nstage;
713 }
714 if (new_last_stage)
715 new_last_stage->next = NULL;
716 tape->last_stage = new_last_stage;
717 tape->next_stage = NULL;
718}
719
720/* 689/*
721 * Finish servicing a request and insert a pending pipeline request into the 690 * Finish servicing a request and insert a pending pipeline request into the
722 * main device queue. 691 * main device queue.
@@ -727,7 +696,6 @@ static int idetape_end_request(ide_drive_t *drive, int uptodate, int nr_sects)
727 idetape_tape_t *tape = drive->driver_data; 696 idetape_tape_t *tape = drive->driver_data;
728 unsigned long flags; 697 unsigned long flags;
729 int error; 698 int error;
730 idetape_stage_t *active_stage;
731 699
732 debug_log(DBG_PROCS, "Enter %s\n", __func__); 700 debug_log(DBG_PROCS, "Enter %s\n", __func__);
733 701
@@ -747,55 +715,9 @@ static int idetape_end_request(ide_drive_t *drive, int uptodate, int nr_sects)
747 715
748 spin_lock_irqsave(&tape->lock, flags); 716 spin_lock_irqsave(&tape->lock, flags);
749 717
750 /* The request was a pipelined data transfer request */
751 if (tape->active_data_rq == rq) {
752 active_stage = tape->active_stage;
753 tape->active_stage = NULL;
754 tape->active_data_rq = NULL;
755 tape->nr_pending_stages--;
756 if (rq->cmd[0] & REQ_IDETAPE_WRITE) {
757 if (error) {
758 set_bit(IDETAPE_FLAG_PIPELINE_ERR,
759 &tape->flags);
760 if (error == IDETAPE_ERROR_EOD)
761 idetape_abort_pipeline(drive,
762 active_stage);
763 }
764 } else if (rq->cmd[0] & REQ_IDETAPE_READ) {
765 if (error == IDETAPE_ERROR_EOD) {
766 set_bit(IDETAPE_FLAG_PIPELINE_ERR,
767 &tape->flags);
768 idetape_abort_pipeline(drive, active_stage);
769 }
770 }
771 if (tape->next_stage != NULL) {
772 idetape_activate_next_stage(drive);
773
774 /* Insert the next request into the request queue. */
775 (void)ide_do_drive_cmd(drive, tape->active_data_rq,
776 ide_end);
777 } else if (!error) {
778 /*
779 * This is a part of the feedback loop which tries to
780 * find the optimum number of stages. We are starting
781 * from a minimum maximum number of stages, and if we
782 * sense that the pipeline is empty, we try to increase
783 * it, until we reach the user compile time memory
784 * limit.
785 */
786 int i = (tape->max_pipeline - tape->min_pipeline) / 10;
787
788 tape->max_stages += max(i, 1);
789 tape->max_stages = max(tape->max_stages,
790 tape->min_pipeline);
791 tape->max_stages = min(tape->max_stages,
792 tape->max_pipeline);
793 }
794 }
795 ide_end_drive_cmd(drive, 0, 0); 718 ide_end_drive_cmd(drive, 0, 0);
796 719
797 if (tape->active_data_rq == NULL) 720 clear_bit(IDETAPE_FLAG_PIPELINE_ACTIVE, &tape->flags);
798 clear_bit(IDETAPE_FLAG_PIPELINE_ACTIVE, &tape->flags);
799 spin_unlock_irqrestore(&tape->lock, flags); 721 spin_unlock_irqrestore(&tape->lock, flags);
800 return 0; 722 return 0;
801} 723}