From: Borislav Petkov <petkovbb@googlemail.com>
To: <bzolnier@gmail.com>
Cc: linux-ide@vger.kernel.org, linux-kernel@vger.kernel.org,
Borislav Petkov <petkovbb@gmail.com>
Subject: [PATCH 15/24] ide-tape: remove pipeline-specific code from idetape_end_request
Date: Sat, 1 Mar 2008 09:58:39 +0100 [thread overview]
Message-ID: <1204361928-30229-16-git-send-email-petkovbb@gmail.com> (raw)
In-Reply-To: <1204361928-30229-1-git-send-email-petkovbb@gmail.com>
As a result, remove orphaned
idetape_activate_next_stage
idetape_remove_stage_head
idetape_abort_pipeline
idetape_wait_for_request
idetape_kfree_stage
too.
Signed-off-by: Borislav Petkov <petkovbb@gmail.com>
---
drivers/ide/ide-tape.c | 172 +-----------------------------------------------
1 files changed, 1 insertions(+), 171 deletions(-)
diff --git a/drivers/ide/ide-tape.c b/drivers/ide/ide-tape.c
index a3a45b5..93e42e6 100644
--- a/drivers/ide/ide-tape.c
+++ b/drivers/ide/ide-tape.c
@@ -673,28 +673,6 @@ static void idetape_analyze_error(ide_drive_t *drive, u8 *sense)
}
}
-static void idetape_activate_next_stage(ide_drive_t *drive)
-{
- idetape_tape_t *tape = drive->driver_data;
- idetape_stage_t *stage = tape->next_stage;
- struct request *rq = &stage->rq;
-
- debug_log(DBG_PROCS, "Enter %s\n", __func__);
-
- if (stage == NULL) {
- printk(KERN_ERR "ide-tape: bug: Trying to activate a non"
- " existing stage\n");
- return;
- }
-
- rq->rq_disk = tape->disk;
- rq->buffer = NULL;
- rq->special = (void *)stage->bh;
- tape->active_data_rq = rq;
- tape->active_stage = stage;
- tape->next_stage = stage->next;
-}
-
/* Free a stage along with its related buffers completely. */
static void __idetape_kfree_stage(idetape_stage_t *stage)
{
@@ -717,84 +695,12 @@ static void __idetape_kfree_stage(idetape_stage_t *stage)
kfree(stage);
}
-static void idetape_kfree_stage(idetape_tape_t *tape, idetape_stage_t *stage)
-{
- __idetape_kfree_stage(stage);
-}
-
-/*
- * Remove tape->first_stage from the pipeline. The caller should avoid race
- * conditions.
- */
-static void idetape_remove_stage_head(ide_drive_t *drive)
-{
- idetape_tape_t *tape = drive->driver_data;
- idetape_stage_t *stage;
-
- debug_log(DBG_PROCS, "Enter %s\n", __func__);
-
- if (tape->first_stage == NULL) {
- printk(KERN_ERR "ide-tape: bug: tape->first_stage is NULL\n");
- return;
- }
- if (tape->active_stage == tape->first_stage) {
- printk(KERN_ERR "ide-tape: bug: Trying to free our active "
- "pipeline stage\n");
- return;
- }
- stage = tape->first_stage;
- tape->first_stage = stage->next;
- idetape_kfree_stage(tape, stage);
- tape->nr_stages--;
- if (tape->first_stage == NULL) {
- tape->last_stage = NULL;
- if (tape->next_stage != NULL)
- printk(KERN_ERR "ide-tape: bug: tape->next_stage !="
- " NULL\n");
- if (tape->nr_stages)
- printk(KERN_ERR "ide-tape: bug: nr_stages should be 0 "
- "now\n");
- }
-}
-
-/*
- * This will free all the pipeline stages starting from new_last_stage->next
- * to the end of the list, and point tape->last_stage to new_last_stage.
- */
-static void idetape_abort_pipeline(ide_drive_t *drive,
- idetape_stage_t *new_last_stage)
-{
- idetape_tape_t *tape = drive->driver_data;
- idetape_stage_t *stage = new_last_stage->next;
- idetape_stage_t *nstage;
-
- debug_log(DBG_PROCS, "%s: Enter %s\n", tape->name, __func__);
-
- while (stage) {
- nstage = stage->next;
- idetape_kfree_stage(tape, stage);
- --tape->nr_stages;
- --tape->nr_pending_stages;
- stage = nstage;
- }
- if (new_last_stage)
- new_last_stage->next = NULL;
- tape->last_stage = new_last_stage;
- tape->next_stage = NULL;
-}
-
-/*
- * Finish servicing a request and insert a pending pipeline request into the
- * main device queue.
- */
+/* Finish servicing a request. */
static int idetape_end_request(ide_drive_t *drive, int uptodate, int nr_sects)
{
struct request *rq = HWGROUP(drive)->rq;
idetape_tape_t *tape = drive->driver_data;
- unsigned long flags;
int error;
- int remove_stage = 0;
- idetape_stage_t *active_stage;
debug_log(DBG_PROCS, "Enter %s\n", __func__);
@@ -812,61 +718,8 @@ static int idetape_end_request(ide_drive_t *drive, int uptodate, int nr_sects)
return 0;
}
- spin_lock_irqsave(&tape->lock, flags);
-
- /* The request was a pipelined data transfer request */
- if (tape->active_data_rq == rq) {
- active_stage = tape->active_stage;
- tape->active_stage = NULL;
- tape->active_data_rq = NULL;
- tape->nr_pending_stages--;
- if (rq->cmd[0] & REQ_IDETAPE_WRITE) {
- remove_stage = 1;
- if (error) {
- set_bit(IDETAPE_FLAG_PIPELINE_ERR,
- &tape->flags);
- if (error == IDETAPE_ERROR_EOD)
- idetape_abort_pipeline(drive,
- active_stage);
- }
- } else if (rq->cmd[0] & REQ_IDETAPE_READ) {
- if (error == IDETAPE_ERROR_EOD) {
- set_bit(IDETAPE_FLAG_PIPELINE_ERR,
- &tape->flags);
- idetape_abort_pipeline(drive, active_stage);
- }
- }
- if (tape->next_stage != NULL) {
- idetape_activate_next_stage(drive);
-
- /* Insert the next request into the request queue. */
- (void)ide_do_drive_cmd(drive, tape->active_data_rq,
- ide_end);
- } else if (!error) {
- /*
- * This is a part of the feedback loop which tries to
- * find the optimum number of stages. We are starting
- * from a minimum maximum number of stages, and if we
- * sense that the pipeline is empty, we try to increase
- * it, until we reach the user compile time memory
- * limit.
- */
- int i = (tape->max_pipeline - tape->min_pipeline) / 10;
-
- tape->max_stages += max(i, 1);
- tape->max_stages = max(tape->max_stages,
- tape->min_pipeline);
- tape->max_stages = min(tape->max_stages,
- tape->max_pipeline);
- }
- }
ide_end_drive_cmd(drive, 0, 0);
- if (remove_stage)
- idetape_remove_stage_head(drive);
- if (tape->active_data_rq == NULL)
- clear_bit(IDETAPE_FLAG_PIPELINE_ACTIVE, &tape->flags);
- spin_unlock_irqrestore(&tape->lock, flags);
return 0;
}
@@ -1760,29 +1613,6 @@ static void idetape_init_merge_stage(idetape_tape_t *tape)
}
}
-/*
- * Install a completion in a pending request and sleep until it is serviced. The
- * caller should ensure that the request will not be serviced before we install
- * the completion (usually by disabling interrupts).
- */
-static void idetape_wait_for_request(ide_drive_t *drive, struct request *rq)
-{
- DECLARE_COMPLETION_ONSTACK(wait);
- idetape_tape_t *tape = drive->driver_data;
-
- if (rq == NULL || !blk_special_request(rq)) {
- printk(KERN_ERR "ide-tape: bug: Trying to sleep on non-valid"
- " request\n");
- return;
- }
- rq->end_io_data = &wait;
- rq->end_io = blk_end_sync_rq;
- spin_unlock_irq(&tape->lock);
- wait_for_completion(&wait);
- /* The stage and its struct request have been deallocated */
- spin_lock_irq(&tape->lock);
-}
-
static ide_startstop_t idetape_read_position_callback(ide_drive_t *drive)
{
idetape_tape_t *tape = drive->driver_data;
--
1.5.4.1
next prev parent reply other threads:[~2008-03-01 9:06 UTC|newest]
Thread overview: 44+ messages / expand[flat|nested] mbox.gz Atom feed top
2008-03-01 8:58 [PATCH 00/24] ide-tape: remove pipelined mode operation Borislav Petkov
2008-03-01 8:58 ` [PATCH 01/24] ide-tape: remove idetape_pipeline_active() Borislav Petkov
2008-03-02 18:21 ` Bartlomiej Zolnierkiewicz
2008-03-01 8:58 ` [PATCH 02/24] ide-tape: remove pipeline-specific code from idetape_add_chrdev_write_request Borislav Petkov
2008-03-02 18:33 ` Bartlomiej Zolnierkiewicz
2008-03-02 21:19 ` Borislav Petkov
2008-03-02 23:16 ` Bartlomiej Zolnierkiewicz
2008-03-03 6:43 ` Borislav Petkov
2008-03-03 22:32 ` Bartlomiej Zolnierkiewicz
2008-03-01 8:58 ` [PATCH 03/24] ide-tape: remove pipeline-specific code from idetape_add_chrdev_read_request Borislav Petkov
2008-03-02 18:36 ` Bartlomiej Zolnierkiewicz
2008-03-02 21:28 ` Borislav Petkov
2008-03-01 8:58 ` [PATCH 04/24] ide-tape: remove pipeline-specific code from idetape_chrdev_write Borislav Petkov
2008-03-02 18:41 ` Bartlomiej Zolnierkiewicz
2008-03-02 21:31 ` Borislav Petkov
2008-03-02 23:17 ` Bartlomiej Zolnierkiewicz
2008-03-01 8:58 ` [PATCH 05/24] ide-tape: cleanup pipeline-specific code from idetape_init_read Borislav Petkov
2008-03-02 18:48 ` Bartlomiej Zolnierkiewicz
2008-03-01 8:58 ` [PATCH 06/24] ide-tape: remove unused stage-parameter from idetape_copy_stage_to_user Borislav Petkov
2008-03-02 19:15 ` Bartlomiej Zolnierkiewicz
2008-03-01 8:58 ` [PATCH 07/24] ide-tape: remove pipeline-specific code bits from idetape_chrdev_read Borislav Petkov
2008-03-01 8:58 ` [PATCH 08/24] ide-tape: remove pipeline-specific code from idetape_space_over_filemarks Borislav Petkov
2008-03-01 8:58 ` [PATCH 09/24] ide-tape: remove pipeline-specific code from idetape_mtioctop Borislav Petkov
2008-03-01 8:58 ` [RFCPATCH 10/24] ide-tape: remove pipeline-specific code from idetape_chrdev_ioctl Borislav Petkov
2008-03-01 8:58 ` [PATCH 11/24] ide-tape: remove pipeline-specific code from idetape_blkdev_ioctl Borislav Petkov
2008-03-01 8:58 ` [PATCH 12/24] ide-tape: remove idetape_empty_write_pipeline Borislav Petkov
2008-03-01 8:58 ` [PATCH 13/24] ide-tape: remove pipeline-specific code from idetape_chrdev_release Borislav Petkov
2008-03-01 8:58 ` [PATCH 14/24] ide-tape: remove __idetape_discard_read_pipeline Borislav Petkov
2008-03-01 8:58 ` Borislav Petkov [this message]
2008-03-01 8:58 ` [PATCH 16/24] ide-tape: remove idetape_calculate_speeds Borislav Petkov
2008-03-01 8:58 ` [PATCH 17/24] ide-tape: remove pipeline-specific code from idetape_chrdev_open Borislav Petkov
2008-03-01 8:58 ` [PATCH 18/24] ide-tape: remove pipeline-specific code from idetape_setup Borislav Petkov
2008-03-01 8:58 ` [PATCH 19/24] ide-tape: remove pipelined mode parameters Borislav Petkov
2008-03-01 8:58 ` [PATCH 20/24] ide-tape: remove pipelined mode tape control flags Borislav Petkov
2008-03-01 8:58 ` [PATCH 21/24] ide-tape: remove pipeline-specific members from struct ide_tape_obj Borislav Petkov
2008-03-01 8:58 ` [PATCH 22/24] ide-tape: remove misc references to pipelined operation in the comments Borislav Petkov
2008-03-01 8:58 ` [PATCH 23/24] ide-tape: remove pipelined mode description from Documentation/ide/ide-tape.txt Borislav Petkov
2008-03-01 8:58 ` [PATCH 24/24] ide-tape: remove comments markup " Borislav Petkov
2008-03-01 9:55 ` [PATCH 00/24] ide-tape: remove pipelined mode operation Jens Axboe
2008-03-01 15:45 ` Borislav Petkov
2008-03-01 18:36 ` Jens Axboe
2008-03-01 10:20 ` Adrian Bunk
2008-03-01 15:37 ` Borislav Petkov
2008-03-22 16:09 ` Bartlomiej Zolnierkiewicz
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=1204361928-30229-16-git-send-email-petkovbb@gmail.com \
--to=petkovbb@googlemail.com \
--cc=bzolnier@gmail.com \
--cc=linux-ide@vger.kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=petkovbb@gmail.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
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).