LKML Archive on lore.kernel.org
help / color / mirror / Atom feed
From: Borislav Petkov <petkovbb@googlemail.com>
To: <bzolnier@gmail.com>
Cc: linux-kernel@vger.kernel.org, linux-ide@vger.kernel.org,
	Borislav Petkov <petkovbb@gmail.com>
Subject: [PATCH 10/17] ide-tape: remove remaining pipeline functionality
Date: Mon, 17 Mar 2008 07:41:23 +0100	[thread overview]
Message-ID: <1205736090-4435-11-git-send-email-petkovbb@gmail.com> (raw)
In-Reply-To: <1205736090-4435-1-git-send-email-petkovbb@gmail.com>

The driver is using now solely its own request queue.

Signed-off-by: Borislav Petkov <petkovbb@gmail.com>
---
 drivers/ide/ide-tape.c |  103 +-----------------------------------------------
 1 files changed, 2 insertions(+), 101 deletions(-)

diff --git a/drivers/ide/ide-tape.c b/drivers/ide/ide-tape.c
index a85866a..c612c8c 100644
--- a/drivers/ide/ide-tape.c
+++ b/drivers/ide/ide-tape.c
@@ -642,28 +642,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)
 {
@@ -1541,28 +1519,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;
@@ -1806,19 +1762,6 @@ static int idetape_queue_rw_tail(ide_drive_t *drive, int cmd, int blocks,
 	return (tape->blk_size * (blocks-rq.current_nr_sectors));
 }
 
-/* start servicing the pipeline stages, starting from tape->next_stage. */
-static void idetape_plug_pipeline(ide_drive_t *drive)
-{
-	idetape_tape_t *tape = drive->driver_data;
-
-	if (tape->next_stage == NULL)
-		return;
-	if (!test_and_set_bit(IDETAPE_FLAG_PIPELINE_ACTIVE, &tape->flags)) {
-		idetape_activate_next_stage(drive);
-		(void) ide_do_drive_cmd(drive, tape->active_data_rq, ide_end);
-	}
-}
-
 static void idetape_create_inquiry_cmd(struct ide_atapi_pc *pc)
 {
 	idetape_init_pc(pc);
@@ -1860,45 +1803,11 @@ static void idetape_create_space_cmd(struct ide_atapi_pc *pc, int count, u8 cmd)
 static int idetape_add_chrdev_write_request(ide_drive_t *drive, int blocks)
 {
 	idetape_tape_t *tape = drive->driver_data;
-	unsigned long flags;
 
 	debug_log(DBG_CHRDEV, "Enter %s\n", __func__);
 
-	/* Attempt to allocate a new stage. Beware possible race conditions. */
-	while (1) {
-		spin_lock_irqsave(&tape->lock, flags);
-		if (test_bit(IDETAPE_FLAG_PIPELINE_ACTIVE, &tape->flags)) {
-			idetape_wait_for_request(drive, tape->active_data_rq);
-			spin_unlock_irqrestore(&tape->lock, flags);
-		} else {
-			spin_unlock_irqrestore(&tape->lock, flags);
-			idetape_plug_pipeline(drive);
-			if (test_bit(IDETAPE_FLAG_PIPELINE_ACTIVE,
-					&tape->flags))
-				continue;
-			return idetape_queue_rw_tail(drive, REQ_IDETAPE_WRITE,
-						blocks, tape->merge_stage->bh);
-		}
-	}
-}
-
-/*
- * Wait until all pending pipeline requests are serviced. Typically called on
- * device close.
- */
-static void idetape_wait_for_pipeline(ide_drive_t *drive)
-{
-	idetape_tape_t *tape = drive->driver_data;
-	unsigned long flags;
-
-	while (tape->next_stage || test_bit(IDETAPE_FLAG_PIPELINE_ACTIVE,
-						&tape->flags)) {
-		idetape_plug_pipeline(drive);
-		spin_lock_irqsave(&tape->lock, flags);
-		if (test_bit(IDETAPE_FLAG_PIPELINE_ACTIVE, &tape->flags))
-			idetape_wait_for_request(drive, tape->active_data_rq);
-		spin_unlock_irqrestore(&tape->lock, flags);
-	}
+	return idetape_queue_rw_tail(drive, REQ_IDETAPE_WRITE,
+				     blocks, tape->merge_stage->bh);
 }
 
 static int idetape_init_read(ide_drive_t *drive, int max_stages)
@@ -1909,7 +1818,6 @@ static int idetape_init_read(ide_drive_t *drive, int max_stages)
 	/* Initialize read operation */
 	if (tape->chrdev_dir != IDETAPE_DIR_READ) {
 		if (tape->chrdev_dir == IDETAPE_DIR_WRITE) {
-			idetape_wait_for_pipeline(drive);
 			idetape_flush_tape_buffers(drive);
 		}
 		if (tape->merge_stage || tape->merge_stage_size) {
@@ -1947,7 +1855,6 @@ static int idetape_init_read(ide_drive_t *drive, int max_stages)
 			tape->insert_time = jiffies;
 			tape->insert_size = 0;
 			tape->insert_speed = 0;
-			idetape_plug_pipeline(drive);
 		}
 	}
 	return 0;
@@ -2428,7 +2335,6 @@ static int idetape_chrdev_ioctl(struct inode *inode, struct file *file,
 	debug_log(DBG_CHRDEV, "Enter %s, cmd=%u\n", __func__, cmd);
 
 	if (tape->chrdev_dir == IDETAPE_DIR_WRITE) {
-		idetape_wait_for_pipeline(drive);
 		idetape_flush_tape_buffers(drive);
 	}
 	if (cmd == MTIOCGET || cmd == MTIOCPOS) {
@@ -2578,7 +2484,6 @@ static void idetape_write_release(ide_drive_t *drive, unsigned int minor)
 {
 	idetape_tape_t *tape = drive->driver_data;
 
-	idetape_wait_for_pipeline(drive);
 	tape->merge_stage = __idetape_kmalloc_stage(tape, 1, 0);
 	if (tape->merge_stage != NULL) {
 		idetape_pad_zeros(drive, tape->blk_size *
@@ -2605,10 +2510,6 @@ static int idetape_chrdev_release(struct inode *inode, struct file *filp)
 
 	if (tape->chrdev_dir == IDETAPE_DIR_WRITE)
 		idetape_write_release(drive, minor);
-	if (tape->chrdev_dir == IDETAPE_DIR_READ) {
-		if (minor >= 128)
-			idetape_wait_for_pipeline(drive);
-	}
 
 	if (minor < 128 && test_bit(IDETAPE_FLAG_MEDIUM_PRESENT, &tape->flags))
 		(void) idetape_rewind_tape(drive);
-- 
1.5.4.1


  parent reply	other threads:[~2008-03-17  6:44 UTC|newest]

Thread overview: 36+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2008-03-17  6:41 [PATCH 0/17] ide-tape: remove pipeline functionality-v3 Borislav Petkov
2008-03-17  6:41 ` [PATCH 01/17] ide-tape: remove unused parameter from idetape_copy_stage_to_user Borislav Petkov
2008-03-20 21:42   ` Bartlomiej Zolnierkiewicz
2008-03-17  6:41 ` [PATCH 02/17] ide-tape: remove unused parameter from idetape_copy_stage_from_user Borislav Petkov
2008-03-20 21:42   ` Bartlomiej Zolnierkiewicz
2008-03-17  6:41 ` [PATCH 03/17] ide-tape: remove idetape_discard_read_pipeline() Borislav Petkov
2008-03-21  0:09   ` Bartlomiej Zolnierkiewicz
2008-03-17  6:41 ` [PATCH 04/17] ide-tape: remove idetape_empty_write_pipeline() Borislav Petkov
2008-03-21  0:09   ` Bartlomiej Zolnierkiewicz
2008-03-17  6:41 ` [PATCH 05/17] ide-tape: remove pipeline-specific code in idetape_space_over_filemarks() Borislav Petkov
2008-03-21  0:09   ` Bartlomiej Zolnierkiewicz
2008-03-17  6:41 ` [PATCH 06/17] ide-tape: remove idetape_pipeline_size() Borislav Petkov
2008-03-21  0:09   ` Bartlomiej Zolnierkiewicz
2008-03-17  6:41 ` [PATCH 07/17] ide-tape: remove idetape_remove_stage_head() Borislav Petkov
2008-03-21  0:09   ` Bartlomiej Zolnierkiewicz
2008-03-17  6:41 ` [PATCH 08/17] ide-tape: remove pipeline-specific code from idetape_end_request() Borislav Petkov
2008-03-21  0:09   ` Bartlomiej Zolnierkiewicz
2008-03-17  6:41 ` [PATCH 09/17] ide-tape: unwrap idetape_queue_pc_tail() Borislav Petkov
2008-03-21  0:09   ` Bartlomiej Zolnierkiewicz
2008-03-17  6:41 ` Borislav Petkov [this message]
2008-03-21  0:09   ` [PATCH 10/17] ide-tape: remove remaining pipeline functionality Bartlomiej Zolnierkiewicz
2008-03-17  6:41 ` [PATCH 11/17] ide-tape: remove pipeline-specific code from idetape_setup Borislav Petkov
2008-03-21  0:09   ` Bartlomiej Zolnierkiewicz
2008-03-17  6:41 ` [PATCH 12/17] ide-tape: remove pipelined mode parameters Borislav Petkov
2008-03-21  0:09   ` Bartlomiej Zolnierkiewicz
2008-03-17  6:41 ` [PATCH 13/17] ide-tape: remove pipelined mode tape control flags Borislav Petkov
2008-03-21  0:09   ` Bartlomiej Zolnierkiewicz
2008-03-17  6:41 ` [PATCH 14/17] ide-tape: remove pipeline-specific members from struct ide_tape_obj Borislav Petkov
2008-03-21  0:09   ` Bartlomiej Zolnierkiewicz
2008-03-17  6:41 ` [PATCH 15/17] ide-tape: remove misc references to pipelined operation in the comments Borislav Petkov
2008-03-21  0:09   ` Bartlomiej Zolnierkiewicz
2008-03-17  6:41 ` [PATCH 16/17] ide-tape: remove pipelined mode description from Documentation/ide/ide-tape.txt Borislav Petkov
2008-03-21  0:09   ` Bartlomiej Zolnierkiewicz
2008-03-17  6:41 ` [PATCH 17/17] ide-tape: remove comments markup " Borislav Petkov
2008-03-21  0:09   ` Bartlomiej Zolnierkiewicz
2008-03-21  0:04 ` [PATCH 0/17] ide-tape: remove pipeline functionality-v3 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=1205736090-4435-11-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 \
    --subject='Re: [PATCH 10/17] ide-tape: remove remaining pipeline functionality' \
    /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

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).