mirror of
https://mirrors.bfsu.edu.cn/git/linux.git
synced 2024-11-23 20:24:12 +08:00
s390/tape: remove tape block leftovers
Signed-off-by: Heiko Carstens <heiko.carstens@de.ibm.com> Signed-off-by: Martin Schwidefsky <schwidefsky@de.ibm.com>
This commit is contained in:
parent
b2a68c2356
commit
161beff8f4
@ -154,12 +154,6 @@ struct tape_discipline {
|
||||
struct tape_request *(*read_block)(struct tape_device *, size_t);
|
||||
struct tape_request *(*write_block)(struct tape_device *, size_t);
|
||||
void (*process_eov)(struct tape_device*);
|
||||
#ifdef CONFIG_S390_TAPE_BLOCK
|
||||
/* Block device stuff. */
|
||||
struct tape_request *(*bread)(struct tape_device *, struct request *);
|
||||
void (*check_locate)(struct tape_device *, struct tape_request *);
|
||||
void (*free_bread)(struct tape_request *);
|
||||
#endif
|
||||
/* ioctl function for additional ioctls. */
|
||||
int (*ioctl_fn)(struct tape_device *, unsigned int, unsigned long);
|
||||
/* Array of tape commands with TAPE_NR_MTOPS entries */
|
||||
@ -182,26 +176,6 @@ struct tape_char_data {
|
||||
int block_size; /* of size block_size. */
|
||||
};
|
||||
|
||||
#ifdef CONFIG_S390_TAPE_BLOCK
|
||||
/* Block Frontend Data */
|
||||
struct tape_blk_data
|
||||
{
|
||||
struct tape_device * device;
|
||||
/* Block device request queue. */
|
||||
struct request_queue * request_queue;
|
||||
spinlock_t request_queue_lock;
|
||||
|
||||
/* Task to move entries from block request to CCS request queue. */
|
||||
struct work_struct requeue_task;
|
||||
atomic_t requeue_scheduled;
|
||||
|
||||
/* Current position on the tape. */
|
||||
long block_position;
|
||||
int medium_changed;
|
||||
struct gendisk * disk;
|
||||
};
|
||||
#endif
|
||||
|
||||
/* Tape Info */
|
||||
struct tape_device {
|
||||
/* entry in tape_device_list */
|
||||
@ -248,10 +222,6 @@ struct tape_device {
|
||||
|
||||
/* Character device frontend data */
|
||||
struct tape_char_data char_data;
|
||||
#ifdef CONFIG_S390_TAPE_BLOCK
|
||||
/* Block dev frontend data */
|
||||
struct tape_blk_data blk_data;
|
||||
#endif
|
||||
|
||||
/* Function to start or stop the next request later. */
|
||||
struct delayed_work tape_dnr;
|
||||
@ -313,19 +283,6 @@ extern void tapechar_exit(void);
|
||||
extern int tapechar_setup_device(struct tape_device *);
|
||||
extern void tapechar_cleanup_device(struct tape_device *);
|
||||
|
||||
/* Externals from tape_block.c */
|
||||
#ifdef CONFIG_S390_TAPE_BLOCK
|
||||
extern int tapeblock_init (void);
|
||||
extern void tapeblock_exit(void);
|
||||
extern int tapeblock_setup_device(struct tape_device *);
|
||||
extern void tapeblock_cleanup_device(struct tape_device *);
|
||||
#else
|
||||
static inline int tapeblock_init (void) {return 0;}
|
||||
static inline void tapeblock_exit (void) {;}
|
||||
static inline int tapeblock_setup_device(struct tape_device *t) {return 0;}
|
||||
static inline void tapeblock_cleanup_device (struct tape_device *t) {;}
|
||||
#endif
|
||||
|
||||
/* tape initialisation functions */
|
||||
#ifdef CONFIG_PROC_FS
|
||||
extern void tape_proc_init (void);
|
||||
|
@ -323,20 +323,6 @@ tape_34xx_unit_check(struct tape_device *device, struct tape_request *request,
|
||||
inhibit_cu_recovery = (*device->modeset_byte & 0x80) ? 1 : 0;
|
||||
sense = irb->ecw;
|
||||
|
||||
#ifdef CONFIG_S390_TAPE_BLOCK
|
||||
if (request->op == TO_BLOCK) {
|
||||
/*
|
||||
* Recovery for block device requests. Set the block_position
|
||||
* to something invalid and retry.
|
||||
*/
|
||||
device->blk_data.block_position = -1;
|
||||
if (request->retries-- <= 0)
|
||||
return tape_34xx_erp_failed(request, -EIO);
|
||||
else
|
||||
return tape_34xx_erp_retry(request);
|
||||
}
|
||||
#endif
|
||||
|
||||
if (
|
||||
sense[0] & SENSE_COMMAND_REJECT &&
|
||||
sense[1] & SENSE_WRITE_PROTECT
|
||||
@ -1129,123 +1115,6 @@ tape_34xx_mtseek(struct tape_device *device, int mt_count)
|
||||
return tape_do_io_free(device, request);
|
||||
}
|
||||
|
||||
#ifdef CONFIG_S390_TAPE_BLOCK
|
||||
/*
|
||||
* Tape block read for 34xx.
|
||||
*/
|
||||
static struct tape_request *
|
||||
tape_34xx_bread(struct tape_device *device, struct request *req)
|
||||
{
|
||||
struct tape_request *request;
|
||||
struct ccw1 *ccw;
|
||||
int count = 0;
|
||||
unsigned off;
|
||||
char *dst;
|
||||
struct bio_vec *bv;
|
||||
struct req_iterator iter;
|
||||
struct tape_34xx_block_id * start_block;
|
||||
|
||||
DBF_EVENT(6, "xBREDid:");
|
||||
|
||||
/* Count the number of blocks for the request. */
|
||||
rq_for_each_segment(bv, req, iter)
|
||||
count += bv->bv_len >> (TAPEBLOCK_HSEC_S2B + 9);
|
||||
|
||||
/* Allocate the ccw request. */
|
||||
request = tape_alloc_request(3+count+1, 8);
|
||||
if (IS_ERR(request))
|
||||
return request;
|
||||
|
||||
/* Setup ccws. */
|
||||
request->op = TO_BLOCK;
|
||||
start_block = (struct tape_34xx_block_id *) request->cpdata;
|
||||
start_block->block = blk_rq_pos(req) >> TAPEBLOCK_HSEC_S2B;
|
||||
DBF_EVENT(6, "start_block = %i\n", start_block->block);
|
||||
|
||||
ccw = request->cpaddr;
|
||||
ccw = tape_ccw_cc(ccw, MODE_SET_DB, 1, device->modeset_byte);
|
||||
|
||||
/*
|
||||
* We always setup a nop after the mode set ccw. This slot is
|
||||
* used in tape_std_check_locate to insert a locate ccw if the
|
||||
* current tape position doesn't match the start block to be read.
|
||||
* The second nop will be filled with a read block id which is in
|
||||
* turn used by tape_34xx_free_bread to populate the segment bid
|
||||
* table.
|
||||
*/
|
||||
ccw = tape_ccw_cc(ccw, NOP, 0, NULL);
|
||||
ccw = tape_ccw_cc(ccw, NOP, 0, NULL);
|
||||
|
||||
rq_for_each_segment(bv, req, iter) {
|
||||
dst = kmap(bv->bv_page) + bv->bv_offset;
|
||||
for (off = 0; off < bv->bv_len; off += TAPEBLOCK_HSEC_SIZE) {
|
||||
ccw->flags = CCW_FLAG_CC;
|
||||
ccw->cmd_code = READ_FORWARD;
|
||||
ccw->count = TAPEBLOCK_HSEC_SIZE;
|
||||
set_normalized_cda(ccw, (void*) __pa(dst));
|
||||
ccw++;
|
||||
dst += TAPEBLOCK_HSEC_SIZE;
|
||||
}
|
||||
}
|
||||
|
||||
ccw = tape_ccw_end(ccw, NOP, 0, NULL);
|
||||
DBF_EVENT(6, "xBREDccwg\n");
|
||||
return request;
|
||||
}
|
||||
|
||||
static void
|
||||
tape_34xx_free_bread (struct tape_request *request)
|
||||
{
|
||||
struct ccw1* ccw;
|
||||
|
||||
ccw = request->cpaddr;
|
||||
if ((ccw + 2)->cmd_code == READ_BLOCK_ID) {
|
||||
struct {
|
||||
struct tape_34xx_block_id cbid;
|
||||
struct tape_34xx_block_id dbid;
|
||||
} __attribute__ ((packed)) *rbi_data;
|
||||
|
||||
rbi_data = request->cpdata;
|
||||
|
||||
if (request->device)
|
||||
tape_34xx_add_sbid(request->device, rbi_data->cbid);
|
||||
}
|
||||
|
||||
/* Last ccw is a nop and doesn't need clear_normalized_cda */
|
||||
for (; ccw->flags & CCW_FLAG_CC; ccw++)
|
||||
if (ccw->cmd_code == READ_FORWARD)
|
||||
clear_normalized_cda(ccw);
|
||||
tape_free_request(request);
|
||||
}
|
||||
|
||||
/*
|
||||
* check_locate is called just before the tape request is passed to
|
||||
* the common io layer for execution. It has to check the current
|
||||
* tape position and insert a locate ccw if it doesn't match the
|
||||
* start block for the request.
|
||||
*/
|
||||
static void
|
||||
tape_34xx_check_locate(struct tape_device *device, struct tape_request *request)
|
||||
{
|
||||
struct tape_34xx_block_id * start_block;
|
||||
|
||||
start_block = (struct tape_34xx_block_id *) request->cpdata;
|
||||
if (start_block->block == device->blk_data.block_position)
|
||||
return;
|
||||
|
||||
DBF_LH(4, "Block seek(%06d+%06d)\n", start_block->block, device->bof);
|
||||
start_block->wrap = 0;
|
||||
start_block->segment = 1;
|
||||
start_block->format = (*device->modeset_byte & 0x08) ?
|
||||
TAPE34XX_FMT_3480_XF :
|
||||
TAPE34XX_FMT_3480;
|
||||
start_block->block = start_block->block + device->bof;
|
||||
tape_34xx_merge_sbid(device, start_block);
|
||||
tape_ccw_cc(request->cpaddr + 1, LOCATE, 4, request->cpdata);
|
||||
tape_ccw_cc(request->cpaddr + 2, READ_BLOCK_ID, 8, request->cpdata);
|
||||
}
|
||||
#endif
|
||||
|
||||
/*
|
||||
* List of 3480/3490 magnetic tape commands.
|
||||
*/
|
||||
@ -1295,11 +1164,6 @@ static struct tape_discipline tape_discipline_34xx = {
|
||||
.irq = tape_34xx_irq,
|
||||
.read_block = tape_std_read_block,
|
||||
.write_block = tape_std_write_block,
|
||||
#ifdef CONFIG_S390_TAPE_BLOCK
|
||||
.bread = tape_34xx_bread,
|
||||
.free_bread = tape_34xx_free_bread,
|
||||
.check_locate = tape_34xx_check_locate,
|
||||
#endif
|
||||
.ioctl_fn = tape_34xx_ioctl,
|
||||
.mtop_array = tape_34xx_mtop
|
||||
};
|
||||
|
@ -670,92 +670,6 @@ tape_3590_schedule_work(struct tape_device *device, enum tape_op op)
|
||||
return 0;
|
||||
}
|
||||
|
||||
#ifdef CONFIG_S390_TAPE_BLOCK
|
||||
/*
|
||||
* Tape Block READ
|
||||
*/
|
||||
static struct tape_request *
|
||||
tape_3590_bread(struct tape_device *device, struct request *req)
|
||||
{
|
||||
struct tape_request *request;
|
||||
struct ccw1 *ccw;
|
||||
int count = 0, start_block;
|
||||
unsigned off;
|
||||
char *dst;
|
||||
struct bio_vec *bv;
|
||||
struct req_iterator iter;
|
||||
|
||||
DBF_EVENT(6, "xBREDid:");
|
||||
start_block = blk_rq_pos(req) >> TAPEBLOCK_HSEC_S2B;
|
||||
DBF_EVENT(6, "start_block = %i\n", start_block);
|
||||
|
||||
rq_for_each_segment(bv, req, iter)
|
||||
count += bv->bv_len >> (TAPEBLOCK_HSEC_S2B + 9);
|
||||
|
||||
request = tape_alloc_request(2 + count + 1, 4);
|
||||
if (IS_ERR(request))
|
||||
return request;
|
||||
request->op = TO_BLOCK;
|
||||
*(__u32 *) request->cpdata = start_block;
|
||||
ccw = request->cpaddr;
|
||||
ccw = tape_ccw_cc(ccw, MODE_SET_DB, 1, device->modeset_byte);
|
||||
|
||||
/*
|
||||
* We always setup a nop after the mode set ccw. This slot is
|
||||
* used in tape_std_check_locate to insert a locate ccw if the
|
||||
* current tape position doesn't match the start block to be read.
|
||||
*/
|
||||
ccw = tape_ccw_cc(ccw, NOP, 0, NULL);
|
||||
|
||||
rq_for_each_segment(bv, req, iter) {
|
||||
dst = page_address(bv->bv_page) + bv->bv_offset;
|
||||
for (off = 0; off < bv->bv_len; off += TAPEBLOCK_HSEC_SIZE) {
|
||||
ccw->flags = CCW_FLAG_CC;
|
||||
ccw->cmd_code = READ_FORWARD;
|
||||
ccw->count = TAPEBLOCK_HSEC_SIZE;
|
||||
set_normalized_cda(ccw, (void *) __pa(dst));
|
||||
ccw++;
|
||||
dst += TAPEBLOCK_HSEC_SIZE;
|
||||
}
|
||||
BUG_ON(off > bv->bv_len);
|
||||
}
|
||||
ccw = tape_ccw_end(ccw, NOP, 0, NULL);
|
||||
DBF_EVENT(6, "xBREDccwg\n");
|
||||
return request;
|
||||
}
|
||||
|
||||
static void
|
||||
tape_3590_free_bread(struct tape_request *request)
|
||||
{
|
||||
struct ccw1 *ccw;
|
||||
|
||||
/* Last ccw is a nop and doesn't need clear_normalized_cda */
|
||||
for (ccw = request->cpaddr; ccw->flags & CCW_FLAG_CC; ccw++)
|
||||
if (ccw->cmd_code == READ_FORWARD)
|
||||
clear_normalized_cda(ccw);
|
||||
tape_free_request(request);
|
||||
}
|
||||
|
||||
/*
|
||||
* check_locate is called just before the tape request is passed to
|
||||
* the common io layer for execution. It has to check the current
|
||||
* tape position and insert a locate ccw if it doesn't match the
|
||||
* start block for the request.
|
||||
*/
|
||||
static void
|
||||
tape_3590_check_locate(struct tape_device *device, struct tape_request *request)
|
||||
{
|
||||
__u32 *start_block;
|
||||
|
||||
start_block = (__u32 *) request->cpdata;
|
||||
if (*start_block != device->blk_data.block_position) {
|
||||
/* Add the start offset of the file to get the real block. */
|
||||
*start_block += device->bof;
|
||||
tape_ccw_cc(request->cpaddr + 1, LOCATE, 4, request->cpdata);
|
||||
}
|
||||
}
|
||||
#endif
|
||||
|
||||
static void tape_3590_med_state_set(struct tape_device *device,
|
||||
struct tape_3590_med_sense *sense)
|
||||
{
|
||||
@ -1423,20 +1337,6 @@ tape_3590_unit_check(struct tape_device *device, struct tape_request *request,
|
||||
{
|
||||
struct tape_3590_sense *sense;
|
||||
|
||||
#ifdef CONFIG_S390_TAPE_BLOCK
|
||||
if (request->op == TO_BLOCK) {
|
||||
/*
|
||||
* Recovery for block device requests. Set the block_position
|
||||
* to something invalid and retry.
|
||||
*/
|
||||
device->blk_data.block_position = -1;
|
||||
if (request->retries-- <= 0)
|
||||
return tape_3590_erp_failed(device, request, irb, -EIO);
|
||||
else
|
||||
return tape_3590_erp_retry(device, request, irb);
|
||||
}
|
||||
#endif
|
||||
|
||||
sense = (struct tape_3590_sense *) irb->ecw;
|
||||
|
||||
DBF_EVENT(6, "Unit Check: RQC = %x\n", sense->rc_rqc);
|
||||
@ -1729,11 +1629,6 @@ static struct tape_discipline tape_discipline_3590 = {
|
||||
.irq = tape_3590_irq,
|
||||
.read_block = tape_std_read_block,
|
||||
.write_block = tape_std_write_block,
|
||||
#ifdef CONFIG_S390_TAPE_BLOCK
|
||||
.bread = tape_3590_bread,
|
||||
.free_bread = tape_3590_free_bread,
|
||||
.check_locate = tape_3590_check_locate,
|
||||
#endif
|
||||
.ioctl_fn = tape_3590_ioctl,
|
||||
.mtop_array = tape_3590_mtop
|
||||
};
|
||||
|
@ -161,11 +161,6 @@ tapechar_read(struct file *filp, char __user *data, size_t count, loff_t *ppos)
|
||||
if (rc)
|
||||
return rc;
|
||||
|
||||
#ifdef CONFIG_S390_TAPE_BLOCK
|
||||
/* Changes position. */
|
||||
device->blk_data.medium_changed = 1;
|
||||
#endif
|
||||
|
||||
DBF_EVENT(6, "TCHAR:nbytes: %lx\n", block_size);
|
||||
/* Let the discipline build the ccw chain. */
|
||||
request = device->discipline->read_block(device, block_size);
|
||||
@ -218,11 +213,6 @@ tapechar_write(struct file *filp, const char __user *data, size_t count, loff_t
|
||||
if (rc)
|
||||
return rc;
|
||||
|
||||
#ifdef CONFIG_S390_TAPE_BLOCK
|
||||
/* Changes position. */
|
||||
device->blk_data.medium_changed = 1;
|
||||
#endif
|
||||
|
||||
DBF_EVENT(6,"TCHAR:nbytes: %lx\n", block_size);
|
||||
DBF_EVENT(6, "TCHAR:nblocks: %x\n", nblocks);
|
||||
/* Let the discipline build the ccw chain. */
|
||||
@ -379,9 +369,6 @@ __tapechar_ioctl(struct tape_device *device,
|
||||
case MTBSFM:
|
||||
case MTFSFM:
|
||||
case MTSEEK:
|
||||
#ifdef CONFIG_S390_TAPE_BLOCK
|
||||
device->blk_data.medium_changed = 1;
|
||||
#endif
|
||||
if (device->required_tapemarks)
|
||||
tape_std_terminate_write(device);
|
||||
default:
|
||||
|
@ -401,9 +401,6 @@ tape_generic_online(struct tape_device *device,
|
||||
rc = tapechar_setup_device(device);
|
||||
if (rc)
|
||||
goto out_minor;
|
||||
rc = tapeblock_setup_device(device);
|
||||
if (rc)
|
||||
goto out_char;
|
||||
|
||||
tape_state_set(device, TS_UNUSED);
|
||||
|
||||
@ -411,8 +408,6 @@ tape_generic_online(struct tape_device *device,
|
||||
|
||||
return 0;
|
||||
|
||||
out_char:
|
||||
tapechar_cleanup_device(device);
|
||||
out_minor:
|
||||
tape_remove_minor(device);
|
||||
out_discipline:
|
||||
@ -426,7 +421,6 @@ out:
|
||||
static void
|
||||
tape_cleanup_device(struct tape_device *device)
|
||||
{
|
||||
tapeblock_cleanup_device(device);
|
||||
tapechar_cleanup_device(device);
|
||||
device->discipline->cleanup_device(device);
|
||||
module_put(device->discipline->owner);
|
||||
@ -785,10 +779,6 @@ __tape_start_io(struct tape_device *device, struct tape_request *request)
|
||||
{
|
||||
int rc;
|
||||
|
||||
#ifdef CONFIG_S390_TAPE_BLOCK
|
||||
if (request->op == TO_BLOCK)
|
||||
device->discipline->check_locate(device, request);
|
||||
#endif
|
||||
rc = ccw_device_start(
|
||||
device->cdev,
|
||||
request->cpaddr,
|
||||
@ -1253,7 +1243,7 @@ __tape_do_irq (struct ccw_device *cdev, unsigned long intparm, struct irb *irb)
|
||||
}
|
||||
|
||||
/*
|
||||
* Tape device open function used by tape_char & tape_block frontends.
|
||||
* Tape device open function used by tape_char frontend.
|
||||
*/
|
||||
int
|
||||
tape_open(struct tape_device *device)
|
||||
@ -1283,7 +1273,7 @@ tape_open(struct tape_device *device)
|
||||
}
|
||||
|
||||
/*
|
||||
* Tape device release function used by tape_char & tape_block frontends.
|
||||
* Tape device release function used by tape_char frontend.
|
||||
*/
|
||||
int
|
||||
tape_release(struct tape_device *device)
|
||||
@ -1344,7 +1334,6 @@ tape_init (void)
|
||||
DBF_EVENT(3, "tape init\n");
|
||||
tape_proc_init();
|
||||
tapechar_init ();
|
||||
tapeblock_init ();
|
||||
return 0;
|
||||
}
|
||||
|
||||
@ -1358,7 +1347,6 @@ tape_exit(void)
|
||||
|
||||
/* Get rid of the frontends */
|
||||
tapechar_exit();
|
||||
tapeblock_exit();
|
||||
tape_proc_cleanup();
|
||||
debug_unregister (TAPE_DBF_AREA);
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user