Lines Matching full:request

292 __tape_cancel_io(struct tape_device *device, struct tape_request *request)  in __tape_cancel_io()  argument
298 if (request->callback == NULL) in __tape_cancel_io()
303 rc = ccw_device_clear(device->cdev, (long) request); in __tape_cancel_io()
307 request->status = TAPE_REQUEST_DONE; in __tape_cancel_io()
310 request->status = TAPE_REQUEST_CANCEL; in __tape_cancel_io()
434 * request. We refuse to suspend if the device is loaded or in use for the
483 * request. We may prevent this by returning an error.
641 struct tape_request * request; in __tape_discard_requests() local
645 request = list_entry(l, struct tape_request, list); in __tape_discard_requests()
646 if (request->status == TAPE_REQUEST_IN_IO) in __tape_discard_requests()
647 request->status = TAPE_REQUEST_DONE; in __tape_discard_requests()
648 list_del(&request->list); in __tape_discard_requests()
650 /* Decrease ref_count for removed request. */ in __tape_discard_requests()
651 request->device = NULL; in __tape_discard_requests()
653 request->rc = -EIO; in __tape_discard_requests()
654 if (request->callback != NULL) in __tape_discard_requests()
655 request->callback(request, request->callback_data); in __tape_discard_requests()
698 * an interrupt for a request that was running. So we in tape_generic_remove()
720 * Allocate a new tape ccw request
725 struct tape_request *request; in tape_alloc_request() local
731 request = kzalloc(sizeof(struct tape_request), GFP_KERNEL); in tape_alloc_request()
732 if (request == NULL) { in tape_alloc_request()
738 request->cpaddr = kcalloc(cplength, sizeof(struct ccw1), in tape_alloc_request()
740 if (request->cpaddr == NULL) { in tape_alloc_request()
742 kfree(request); in tape_alloc_request()
748 request->cpdata = kzalloc(datasize, GFP_KERNEL | GFP_DMA); in tape_alloc_request()
749 if (request->cpdata == NULL) { in tape_alloc_request()
751 kfree(request->cpaddr); in tape_alloc_request()
752 kfree(request); in tape_alloc_request()
756 DBF_LH(6, "New request %p(%p/%p)\n", request, request->cpaddr, in tape_alloc_request()
757 request->cpdata); in tape_alloc_request()
759 return request; in tape_alloc_request()
763 * Free tape ccw request
766 tape_free_request (struct tape_request * request) in tape_free_request() argument
768 DBF_LH(6, "Free request %p\n", request); in tape_free_request()
770 if (request->device) in tape_free_request()
771 tape_put_device(request->device); in tape_free_request()
772 kfree(request->cpdata); in tape_free_request()
773 kfree(request->cpaddr); in tape_free_request()
774 kfree(request); in tape_free_request()
778 __tape_start_io(struct tape_device *device, struct tape_request *request) in __tape_start_io() argument
784 request->cpaddr, in __tape_start_io()
785 (unsigned long) request, in __tape_start_io()
787 request->options in __tape_start_io()
790 request->status = TAPE_REQUEST_IN_IO; in __tape_start_io()
793 request->status = TAPE_REQUEST_QUEUED; in __tape_start_io()
797 /* Start failed. Remove request and indicate failure. */ in __tape_start_io()
798 DBF_EVENT(1, "tape: start request failed with RC = %i\n", rc); in __tape_start_io()
807 struct tape_request *request; in __tape_start_next_request() local
812 * Try to start each request on request queue until one is in __tape_start_next_request()
816 request = list_entry(l, struct tape_request, list); in __tape_start_next_request()
822 if (request->status == TAPE_REQUEST_IN_IO) in __tape_start_next_request()
825 * Request has already been stopped. We have to wait until in __tape_start_next_request()
826 * the request is removed from the queue in the interrupt in __tape_start_next_request()
829 if (request->status == TAPE_REQUEST_DONE) in __tape_start_next_request()
833 * We wanted to cancel the request but the common I/O layer in __tape_start_next_request()
836 * Otherwise we start the next request on the queue. in __tape_start_next_request()
838 if (request->status == TAPE_REQUEST_CANCEL) { in __tape_start_next_request()
839 rc = __tape_cancel_io(device, request); in __tape_start_next_request()
841 rc = __tape_start_io(device, request); in __tape_start_next_request()
847 request->rc = rc; in __tape_start_next_request()
848 request->status = TAPE_REQUEST_DONE; in __tape_start_next_request()
850 /* Remove from request queue. */ in __tape_start_next_request()
851 list_del(&request->list); in __tape_start_next_request()
854 if (request->callback != NULL) in __tape_start_next_request()
855 request->callback(request, request->callback_data); in __tape_start_next_request()
874 struct tape_request *request; in tape_long_busy_timeout() local
877 request = list_entry(device->req_queue.next, struct tape_request, list); in tape_long_busy_timeout()
878 BUG_ON(request->status != TAPE_REQUEST_LONG_BUSY); in tape_long_busy_timeout()
888 struct tape_request * request, in __tape_end_request() argument
891 DBF_LH(6, "__tape_end_request(%p, %p, %i)\n", device, request, rc); in __tape_end_request()
892 if (request) { in __tape_end_request()
893 request->rc = rc; in __tape_end_request()
894 request->status = TAPE_REQUEST_DONE; in __tape_end_request()
896 /* Remove from request queue. */ in __tape_end_request()
897 list_del(&request->list); in __tape_end_request()
900 if (request->callback != NULL) in __tape_end_request()
901 request->callback(request, request->callback_data); in __tape_end_request()
904 /* Start next request. */ in __tape_end_request()
913 tape_dump_sense_dbf(struct tape_device *device, struct tape_request *request, in tape_dump_sense_dbf() argument
919 if (request != NULL) in tape_dump_sense_dbf()
920 op = tape_op_verbose[request->op]; in tape_dump_sense_dbf()
934 * I/O helper function. Adds the request to the request queue
939 __tape_start_request(struct tape_device *device, struct tape_request *request) in __tape_start_request() argument
943 switch (request->op) { in __tape_start_request()
961 /* Increase use count of device for the added request. */ in __tape_start_request()
962 request->device = tape_get_device(device); in __tape_start_request()
966 rc = __tape_start_io(device, request); in __tape_start_request()
970 DBF_LH(5, "Request %p added for execution.\n", request); in __tape_start_request()
971 list_add(&request->list, &device->req_queue); in __tape_start_request()
973 DBF_LH(5, "Request %p add to queue.\n", request); in __tape_start_request()
974 request->status = TAPE_REQUEST_QUEUED; in __tape_start_request()
975 list_add_tail(&request->list, &device->req_queue); in __tape_start_request()
981 * Add the request to the request queue, try to start it if the
985 tape_do_io_async(struct tape_device *device, struct tape_request *request) in tape_do_io_async() argument
989 DBF_LH(6, "tape_do_io_async(%p, %p)\n", device, request); in tape_do_io_async()
992 /* Add request to request queue and try to start it. */ in tape_do_io_async()
993 rc = __tape_start_request(device, request); in tape_do_io_async()
1000 * Add the request to the request queue, try to start it if the
1004 __tape_wake_up(struct tape_request *request, void *data) in __tape_wake_up() argument
1006 request->callback = NULL; in __tape_wake_up()
1011 tape_do_io(struct tape_device *device, struct tape_request *request) in tape_do_io() argument
1017 request->callback = __tape_wake_up; in tape_do_io()
1018 request->callback_data = &device->wait_queue; in tape_do_io()
1019 /* Add request to request queue and try to start it. */ in tape_do_io()
1020 rc = __tape_start_request(device, request); in tape_do_io()
1024 /* Request added to the queue. Wait for its completion. */ in tape_do_io()
1025 wait_event(device->wait_queue, (request->callback == NULL)); in tape_do_io()
1026 /* Get rc from request */ in tape_do_io()
1027 return request->rc; in tape_do_io()
1032 * Add the request to the request queue, try to start it if the
1036 __tape_wake_up_interruptible(struct tape_request *request, void *data) in __tape_wake_up_interruptible() argument
1038 request->callback = NULL; in __tape_wake_up_interruptible()
1044 struct tape_request *request) in tape_do_io_interruptible() argument
1050 request->callback = __tape_wake_up_interruptible; in tape_do_io_interruptible()
1051 request->callback_data = &device->wait_queue; in tape_do_io_interruptible()
1052 rc = __tape_start_request(device, request); in tape_do_io_interruptible()
1056 /* Request added to the queue. Wait for its completion. */ in tape_do_io_interruptible()
1058 (request->callback == NULL)); in tape_do_io_interruptible()
1060 /* Request finished normally. */ in tape_do_io_interruptible()
1061 return request->rc; in tape_do_io_interruptible()
1063 /* Interrupted by a signal. We have to stop the current request. */ in tape_do_io_interruptible()
1065 rc = __tape_cancel_io(device, request); in tape_do_io_interruptible()
1072 (request->callback == NULL) in tape_do_io_interruptible()
1086 tape_cancel_io(struct tape_device *device, struct tape_request *request) in tape_cancel_io() argument
1091 rc = __tape_cancel_io(device, request); in tape_cancel_io()
1103 struct tape_request *request; in __tape_do_irq() local
1110 request = (struct tape_request *) intparm; in __tape_do_irq()
1112 DBF_LH(6, "__tape_do_irq(device=%p, request=%p)\n", device, request); in __tape_do_irq()
1116 /* FIXME: What to do with the request? */ in __tape_do_irq()
1119 DBF_LH(1, "(%08x): Request timed out\n", in __tape_do_irq()
1123 __tape_end_request(device, request, -EIO); in __tape_do_irq()
1136 * error might still apply. So we just schedule the request to be in __tape_do_irq()
1141 (request->status == TAPE_REQUEST_IN_IO)) { in __tape_do_irq()
1144 request->status = TAPE_REQUEST_QUEUED; in __tape_do_irq()
1150 if(request != NULL) in __tape_do_irq()
1151 request->rescnt = irb->scsw.cmd.count; in __tape_do_irq()
1175 * Any request that does not come back with channel end in __tape_do_irq()
1179 tape_dump_sense_dbf(device, request, irb); in __tape_do_irq()
1190 * Request that were canceled still come back with an interrupt. in __tape_do_irq()
1191 * To detect these request the state will be set to TAPE_REQUEST_DONE. in __tape_do_irq()
1193 if(request != NULL && request->status == TAPE_REQUEST_DONE) { in __tape_do_irq()
1194 __tape_end_request(device, request, -EIO); in __tape_do_irq()
1198 rc = device->discipline->irq(device, request, irb); in __tape_do_irq()
1200 * rc < 0 : request finished unsuccessfully. in __tape_do_irq()
1201 * rc == TAPE_IO_SUCCESS: request finished successfully. in __tape_do_irq()
1202 * rc == TAPE_IO_PENDING: request is still running. Ignore rc. in __tape_do_irq()
1203 * rc == TAPE_IO_RETRY: request finished but needs another go. in __tape_do_irq()
1204 * rc == TAPE_IO_STOP: request needs to get terminated. in __tape_do_irq()
1210 __tape_end_request(device, request, rc); in __tape_do_irq()
1219 request->status = TAPE_REQUEST_LONG_BUSY; in __tape_do_irq()
1222 rc = __tape_start_io(device, request); in __tape_do_irq()
1224 __tape_end_request(device, request, rc); in __tape_do_irq()
1227 rc = __tape_cancel_io(device, request); in __tape_do_irq()
1229 __tape_end_request(device, request, rc); in __tape_do_irq()
1234 __tape_end_request(device, request, -EIO); in __tape_do_irq()
1236 __tape_end_request(device, request, rc); in __tape_do_irq()