patch-2.3.9 linux/drivers/block/ide-tape.c
Next file: linux/drivers/block/ide.c
Previous file: linux/drivers/block/ide-proc.c
Back to the patch index
Back to the overall index
- Lines: 139
- Date:
Tue Jun 29 09:22:08 1999
- Orig file:
v2.3.8/linux/drivers/block/ide-tape.c
- Orig date:
Thu May 13 11:04:54 1999
diff -u --recursive --new-file v2.3.8/linux/drivers/block/ide-tape.c linux/drivers/block/ide-tape.c
@@ -1073,13 +1073,13 @@
return;
}
#endif /* IDETAPE_DEBUG_BUGS */
- count = IDE_MIN (bh->b_size - bh->b_count, bcount);
- atapi_input_bytes (drive, bh->b_data + bh->b_count, count);
- bcount -= count; bh->b_count += count;
- if (bh->b_count == bh->b_size) {
+ count = IDE_MIN (bh->b_size - atomic_read(&bh->b_count), bcount);
+ atapi_input_bytes (drive, bh->b_data + atomic_read(&bh->b_count), count);
+ bcount -= count; atomic_add(count, &bh->b_count);
+ if (atomic_read(&bh->b_count) == bh->b_size) {
bh = bh->b_reqnext;
if (bh)
- bh->b_count = 0;
+ atomic_set(&bh->b_count, 0);
}
}
pc->bh = bh;
@@ -1104,7 +1104,7 @@
pc->bh = bh = bh->b_reqnext;
if (bh) {
pc->b_data = bh->b_data;
- pc->b_count = bh->b_count;
+ pc->b_count = atomic_read(&bh->b_count);
}
}
}
@@ -1126,8 +1126,8 @@
}
#endif /* IDETAPE_DEBUG_BUGS */
count = IDE_MIN (bh->b_size, bcount);
- bh->b_count = count;
- if (bh->b_count == bh->b_size)
+ atomic_set(&bh->b_count, count);
+ if (atomic_read(&bh->b_count) == bh->b_size)
bh = bh->b_reqnext;
bcount -= count;
}
@@ -1351,13 +1351,13 @@
return;
}
#endif /* IDETAPE_DEBUG_BUGS */
- count = IDE_MIN (bh->b_size - bh->b_count, n);
- copy_from_user (bh->b_data + bh->b_count, buf, count);
- n -= count; bh->b_count += count; buf += count;
- if (bh->b_count == bh->b_size) {
+ count = IDE_MIN (bh->b_size - atomic_read(&bh->b_count), n);
+ copy_from_user (bh->b_data + atomic_read(&bh->b_count), buf, count);
+ n -= count; atomic_add(count, &bh->b_count); buf += count;
+ if (atomic_read(&bh->b_count) == bh->b_size) {
bh = bh->b_reqnext;
if (bh)
- bh->b_count = 0;
+ atomic_set(&bh->b_count, 0);
}
}
tape->bh = bh;
@@ -1382,7 +1382,7 @@
tape->bh = bh = bh->b_reqnext;
if (bh) {
tape->b_data = bh->b_data;
- tape->b_count = bh->b_count;
+ tape->b_count = atomic_read(&bh->b_count);
}
}
}
@@ -1394,10 +1394,10 @@
tape->bh = bh;
if (tape->chrdev_direction == idetape_direction_write)
- bh->b_count = 0;
+ atomic_set(&bh->b_count, 0);
else {
tape->b_data = bh->b_data;
- tape->b_count = bh->b_count;
+ tape->b_count = atomic_read(&bh->b_count);
}
}
@@ -2131,7 +2131,7 @@
pc->c[1] = 1;
pc->callback = &idetape_rw_callback;
pc->bh = bh;
- bh->b_count = 0;
+ atomic_set(&bh->b_count, 0);
pc->buffer = NULL;
pc->request_transfer = pc->buffer_size = length * tape->tape_block_size;
if (pc->request_transfer == tape->stage_size)
@@ -2158,7 +2158,7 @@
set_bit (PC_WRITING, &pc->flags);
pc->bh = bh;
pc->b_data = bh->b_data;
- pc->b_count = bh->b_count;
+ pc->b_count = atomic_read(&bh->b_count);
pc->buffer = NULL;
pc->request_transfer = pc->buffer_size = length * tape->tape_block_size;
if (pc->request_transfer == tape->stage_size)
@@ -2587,9 +2587,9 @@
bcount -= count;
blocks = count / tape->tape_block_size;
while (count) {
- bh->b_count = IDE_MIN (count, bh->b_size);
- memset (bh->b_data, 0, bh->b_count);
- count -= bh->b_count;
+ atomic_set(&bh->b_count, IDE_MIN (count, bh->b_size));
+ memset (bh->b_data, 0, atomic_read(&bh->b_count));
+ count -= atomic_read(&bh->b_count);
bh = bh->b_reqnext;
}
idetape_queue_rw_tail (drive, IDETAPE_WRITE_RQ, blocks, tape->merge_stage->bh);
@@ -2616,8 +2616,8 @@
if (tape->merge_stage_size % tape->tape_block_size) {
blocks++;
i = tape->tape_block_size - tape->merge_stage_size % tape->tape_block_size;
- memset (tape->bh->b_data + tape->bh->b_count, 0, i);
- tape->bh->b_count += i;
+ memset (tape->bh->b_data + atomic_read(&tape->bh->b_count), 0, i);
+ atomic_add(i, &tape->bh->b_count);
}
(void) idetape_add_chrdev_write_request (drive, blocks);
tape->merge_stage_size = 0;
@@ -3814,8 +3814,14 @@
for (minor = 0; minor < MAX_HWIFS * MAX_DRIVES; minor++) {
drive = idetape_chrdevs[minor].drive;
- if (drive != NULL && idetape_cleanup (drive))
- printk (KERN_ERR "ide-tape: %s: cleanup_module() called while still busy\n", drive->name);
+ if (drive) {
+ if (idetape_cleanup (drive))
+ printk (KERN_ERR "ide-tape: %s: cleanup_module() called while still busy\n", drive->name);
+ /* We must remove proc entries defined in this module.
+ Otherwise we oops while accessing these entries */
+ if (drive->proc)
+ ide_remove_proc_entries(drive->proc, idetape_proc);
+ }
}
ide_unregister_module(&idetape_module);
}
FUNET's LINUX-ADM group, linux-adm@nic.funet.fi
TCL-scripts by Sam Shen (who was at: slshen@lbl.gov)