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 04/17] ide-tape: remove idetape_empty_write_pipeline()
Date: Mon, 17 Mar 2008 07:41:17 +0100	[thread overview]
Message-ID: <1205736090-4435-5-git-send-email-petkovbb@gmail.com> (raw)
In-Reply-To: <1205736090-4435-1-git-send-email-petkovbb@gmail.com>

In order _not_ to skip over some pipeline stages left, we carefully flush any
remaining ones. Nevertheless, this is only a temporary measure (git-bisect)
before removing pipeline functionality completely.

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

diff --git a/drivers/ide/ide-tape.c b/drivers/ide/ide-tape.c
index 429fed4..d4a94d5 100644
--- a/drivers/ide/ide-tape.c
+++ b/drivers/ide/ide-tape.c
@@ -2041,80 +2041,6 @@ static void idetape_wait_for_pipeline(ide_drive_t *drive)
 	}
 }
 
-static void idetape_empty_write_pipeline(ide_drive_t *drive)
-{
-	idetape_tape_t *tape = drive->driver_data;
-	int blocks, min;
-	struct idetape_bh *bh;
-
-	if (tape->chrdev_dir != IDETAPE_DIR_WRITE) {
-		printk(KERN_ERR "ide-tape: bug: Trying to empty write pipeline,"
-				" but we are not writing.\n");
-		return;
-	}
-	if (tape->merge_stage_size > tape->stage_size) {
-		printk(KERN_ERR "ide-tape: bug: merge_buffer too big\n");
-		tape->merge_stage_size = tape->stage_size;
-	}
-	if (tape->merge_stage_size) {
-		blocks = tape->merge_stage_size / tape->blk_size;
-		if (tape->merge_stage_size % tape->blk_size) {
-			unsigned int i;
-
-			blocks++;
-			i = tape->blk_size - tape->merge_stage_size %
-				tape->blk_size;
-			bh = tape->bh->b_reqnext;
-			while (bh) {
-				atomic_set(&bh->b_count, 0);
-				bh = bh->b_reqnext;
-			}
-			bh = tape->bh;
-			while (i) {
-				if (bh == NULL) {
-					printk(KERN_INFO "ide-tape: bug,"
-							 " bh NULL\n");
-					break;
-				}
-				min = min(i, (unsigned int)(bh->b_size -
-						atomic_read(&bh->b_count)));
-				memset(bh->b_data + atomic_read(&bh->b_count),
-						0, min);
-				atomic_add(min, &bh->b_count);
-				i -= min;
-				bh = bh->b_reqnext;
-			}
-		}
-		(void) idetape_add_chrdev_write_request(drive, blocks);
-		tape->merge_stage_size = 0;
-	}
-	idetape_wait_for_pipeline(drive);
-	if (tape->merge_stage != NULL) {
-		__idetape_kfree_stage(tape->merge_stage);
-		tape->merge_stage = NULL;
-	}
-	clear_bit(IDETAPE_FLAG_PIPELINE_ERR, &tape->flags);
-	tape->chrdev_dir = IDETAPE_DIR_NONE;
-
-	/*
-	 * On the next backup, perform the feedback loop again. (I don't want to
-	 * keep sense information between backups, as some systems are
-	 * constantly on, and the system load can be totally different on the
-	 * next backup).
-	 */
-	tape->max_stages = tape->min_pipeline;
-	if (tape->first_stage != NULL ||
-	    tape->next_stage != NULL ||
-	    tape->last_stage != NULL ||
-	    tape->nr_stages != 0) {
-		printk(KERN_ERR "ide-tape: ide-tape pipeline bug, "
-			"first_stage %p, next_stage %p, "
-			"last_stage %p, nr_stages %d\n",
-			tape->first_stage, tape->next_stage,
-			tape->last_stage, tape->nr_stages);
-	}
-}
-
 static int idetape_init_read(ide_drive_t *drive, int max_stages)
 {
 	idetape_tape_t *tape = drive->driver_data;
@@ -2123,7 +2049,7 @@ 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_empty_write_pipeline(drive);
+			idetape_wait_for_pipeline(drive);
 			idetape_flush_tape_buffers(drive);
 		}
 		if (tape->merge_stage || tape->merge_stage_size) {
@@ -2702,7 +2628,7 @@ 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_empty_write_pipeline(drive);
+		idetape_wait_for_pipeline(drive);
 		idetape_flush_tape_buffers(drive);
 	}
 	if (cmd == MTIOCGET || cmd == MTIOCPOS) {
@@ -2852,7 +2778,7 @@ static void idetape_write_release(ide_drive_t *drive, unsigned int minor)
 {
 	idetape_tape_t *tape = drive->driver_data;
 
-	idetape_empty_write_pipeline(drive);
+	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 *
-- 
1.5.4.1


  parent reply	other threads:[~2008-03-17  6:43 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 ` Borislav Petkov [this message]
2008-03-21  0:09   ` [PATCH 04/17] ide-tape: remove idetape_empty_write_pipeline() 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 ` [PATCH 10/17] ide-tape: remove remaining pipeline functionality Borislav Petkov
2008-03-21  0:09   ` 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-5-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 04/17] ide-tape: remove idetape_empty_write_pipeline()' \
    /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).