Commit c4b22f81 authored by Borislav Petkov's avatar Borislav Petkov Committed by Bartlomiej Zolnierkiewicz

ide-tape: remove idetape_pipeline_active()

This function was simply a wrapper for a test_bit() macro so remove it and
use the macro instead.
Signed-off-by: default avatarBorislav Petkov <petkovbb@gmail.com>
Signed-off-by: default avatarBartlomiej Zolnierkiewicz <bzolnier@gmail.com>
parent 3dd89a9b
...@@ -1605,14 +1605,6 @@ out: ...@@ -1605,14 +1605,6 @@ out:
} }
/* Pipeline related functions */ /* Pipeline related functions */
static inline int idetape_pipeline_active(idetape_tape_t *tape)
{
int rc1, rc2;
rc1 = test_bit(IDETAPE_FLAG_PIPELINE_ACTIVE, &tape->flags);
rc2 = (tape->active_data_rq != NULL);
return rc1;
}
/* /*
* The function below uses __get_free_page to allocate a pipeline stage, along * The function below uses __get_free_page to allocate a pipeline stage, along
...@@ -2058,7 +2050,7 @@ static int __idetape_discard_read_pipeline(ide_drive_t *drive) ...@@ -2058,7 +2050,7 @@ static int __idetape_discard_read_pipeline(ide_drive_t *drive)
spin_lock_irqsave(&tape->lock, flags); spin_lock_irqsave(&tape->lock, flags);
tape->next_stage = NULL; tape->next_stage = NULL;
if (idetape_pipeline_active(tape)) if (test_bit(IDETAPE_FLAG_PIPELINE_ACTIVE, &tape->flags))
idetape_wait_for_request(drive, tape->active_data_rq); idetape_wait_for_request(drive, tape->active_data_rq);
spin_unlock_irqrestore(&tape->lock, flags); spin_unlock_irqrestore(&tape->lock, flags);
...@@ -2131,7 +2123,7 @@ static int idetape_queue_rw_tail(ide_drive_t *drive, int cmd, int blocks, ...@@ -2131,7 +2123,7 @@ static int idetape_queue_rw_tail(ide_drive_t *drive, int cmd, int blocks,
debug_log(DBG_SENSE, "%s: cmd=%d\n", __func__, cmd); debug_log(DBG_SENSE, "%s: cmd=%d\n", __func__, cmd);
if (idetape_pipeline_active(tape)) { if (test_bit(IDETAPE_FLAG_PIPELINE_ACTIVE, &tape->flags)) {
printk(KERN_ERR "ide-tape: bug: the pipeline is active in %s\n", printk(KERN_ERR "ide-tape: bug: the pipeline is active in %s\n",
__func__); __func__);
return (0); return (0);
...@@ -2162,8 +2154,7 @@ static void idetape_plug_pipeline(ide_drive_t *drive) ...@@ -2162,8 +2154,7 @@ static void idetape_plug_pipeline(ide_drive_t *drive)
if (tape->next_stage == NULL) if (tape->next_stage == NULL)
return; return;
if (!idetape_pipeline_active(tape)) { if (!test_and_set_bit(IDETAPE_FLAG_PIPELINE_ACTIVE, &tape->flags)) {
set_bit(IDETAPE_FLAG_PIPELINE_ACTIVE, &tape->flags);
idetape_activate_next_stage(drive); idetape_activate_next_stage(drive);
(void) ide_do_drive_cmd(drive, tape->active_data_rq, ide_end); (void) ide_do_drive_cmd(drive, tape->active_data_rq, ide_end);
} }
...@@ -2242,13 +2233,14 @@ static int idetape_add_chrdev_write_request(ide_drive_t *drive, int blocks) ...@@ -2242,13 +2233,14 @@ static int idetape_add_chrdev_write_request(ide_drive_t *drive, int blocks)
/* Attempt to allocate a new stage. Beware possible race conditions. */ /* Attempt to allocate a new stage. Beware possible race conditions. */
while ((new_stage = idetape_kmalloc_stage(tape)) == NULL) { while ((new_stage = idetape_kmalloc_stage(tape)) == NULL) {
spin_lock_irqsave(&tape->lock, flags); spin_lock_irqsave(&tape->lock, flags);
if (idetape_pipeline_active(tape)) { if (test_bit(IDETAPE_FLAG_PIPELINE_ACTIVE, &tape->flags)) {
idetape_wait_for_request(drive, tape->active_data_rq); idetape_wait_for_request(drive, tape->active_data_rq);
spin_unlock_irqrestore(&tape->lock, flags); spin_unlock_irqrestore(&tape->lock, flags);
} else { } else {
spin_unlock_irqrestore(&tape->lock, flags); spin_unlock_irqrestore(&tape->lock, flags);
idetape_plug_pipeline(drive); idetape_plug_pipeline(drive);
if (idetape_pipeline_active(tape)) if (test_bit(IDETAPE_FLAG_PIPELINE_ACTIVE,
&tape->flags))
continue; continue;
/* /*
* The machine is short on memory. Fallback to non- * The machine is short on memory. Fallback to non-
...@@ -2277,7 +2269,7 @@ static int idetape_add_chrdev_write_request(ide_drive_t *drive, int blocks) ...@@ -2277,7 +2269,7 @@ static int idetape_add_chrdev_write_request(ide_drive_t *drive, int blocks)
* starting to service requests, so that we will be able to keep up with * starting to service requests, so that we will be able to keep up with
* the higher speeds of the tape. * the higher speeds of the tape.
*/ */
if (!idetape_pipeline_active(tape)) { if (!test_bit(IDETAPE_FLAG_PIPELINE_ACTIVE, &tape->flags)) {
if (tape->nr_stages >= tape->max_stages * 9 / 10 || if (tape->nr_stages >= tape->max_stages * 9 / 10 ||
tape->nr_stages >= tape->max_stages - tape->nr_stages >= tape->max_stages -
tape->uncontrolled_pipeline_head_speed * 3 * 1024 / tape->uncontrolled_pipeline_head_speed * 3 * 1024 /
...@@ -2304,10 +2296,11 @@ static void idetape_wait_for_pipeline(ide_drive_t *drive) ...@@ -2304,10 +2296,11 @@ static void idetape_wait_for_pipeline(ide_drive_t *drive)
idetape_tape_t *tape = drive->driver_data; idetape_tape_t *tape = drive->driver_data;
unsigned long flags; unsigned long flags;
while (tape->next_stage || idetape_pipeline_active(tape)) { while (tape->next_stage || test_bit(IDETAPE_FLAG_PIPELINE_ACTIVE,
&tape->flags)) {
idetape_plug_pipeline(drive); idetape_plug_pipeline(drive);
spin_lock_irqsave(&tape->lock, flags); spin_lock_irqsave(&tape->lock, flags);
if (idetape_pipeline_active(tape)) if (test_bit(IDETAPE_FLAG_PIPELINE_ACTIVE, &tape->flags))
idetape_wait_for_request(drive, tape->active_data_rq); idetape_wait_for_request(drive, tape->active_data_rq);
spin_unlock_irqrestore(&tape->lock, flags); spin_unlock_irqrestore(&tape->lock, flags);
} }
...@@ -2464,7 +2457,7 @@ static int idetape_init_read(ide_drive_t *drive, int max_stages) ...@@ -2464,7 +2457,7 @@ static int idetape_init_read(ide_drive_t *drive, int max_stages)
new_stage = idetape_kmalloc_stage(tape); new_stage = idetape_kmalloc_stage(tape);
} }
} }
if (!idetape_pipeline_active(tape)) { if (!test_bit(IDETAPE_FLAG_PIPELINE_ACTIVE, &tape->flags)) {
if (tape->nr_pending_stages >= 3 * max_stages / 4) { if (tape->nr_pending_stages >= 3 * max_stages / 4) {
tape->measure_insert_time = 1; tape->measure_insert_time = 1;
tape->insert_time = jiffies; tape->insert_time = jiffies;
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment