Lines Matching refs:req
47 struct request *req; member
449 struct io_thread_req *req; in ubd_handler() local
456 n = os_read_file(thread_fd, &req, in ubd_handler()
458 if(n != sizeof(req)){ in ubd_handler()
466 blk_end_request(req->req, 0, req->length); in ubd_handler()
467 kfree(req); in ubd_handler()
1191 static void cowify_req(struct io_thread_req *req, unsigned long *bitmap, in cowify_req() argument
1194 __u64 sector = req->offset >> 9; in cowify_req()
1197 if(req->length > (sizeof(req->sector_mask) * 8) << 9) in cowify_req()
1200 if(req->op == UBD_READ) { in cowify_req()
1201 for(i = 0; i < req->length >> 9; i++){ in cowify_req()
1204 &req->sector_mask); in cowify_req()
1207 else cowify_bitmap(req->offset, req->length, &req->sector_mask, in cowify_req()
1208 &req->cow_offset, bitmap, bitmap_offset, in cowify_req()
1209 req->bitmap_words, bitmap_len); in cowify_req()
1213 static void prepare_request(struct request *req, struct io_thread_req *io_req, in prepare_request() argument
1217 struct gendisk *disk = req->rq_disk; in prepare_request()
1220 io_req->req = req; in prepare_request()
1230 io_req->op = (rq_data_dir(req) == READ) ? UBD_READ : UBD_WRITE; in prepare_request()
1243 static void prepare_flush_request(struct request *req, in prepare_flush_request() argument
1246 struct gendisk *disk = req->rq_disk; in prepare_flush_request()
1249 io_req->req = req; in prepare_flush_request()
1276 struct request *req; in do_ubd_request() local
1281 struct request *req = blk_fetch_request(q); in do_ubd_request() local
1282 if(req == NULL) in do_ubd_request()
1285 dev->request = req; in do_ubd_request()
1286 dev->rq_pos = blk_rq_pos(req); in do_ubd_request()
1288 dev->end_sg = blk_rq_map_sg(q, req, dev->sg); in do_ubd_request()
1291 req = dev->request; in do_ubd_request()
1293 if (req->cmd_flags & REQ_FLUSH) { in do_ubd_request()
1301 prepare_flush_request(req, io_req); in do_ubd_request()
1316 prepare_request(req, io_req, in do_ubd_request()
1373 static int update_bitmap(struct io_thread_req *req) in update_bitmap() argument
1377 if(req->cow_offset == -1) in update_bitmap()
1380 n = os_seek_file(req->fds[1], req->cow_offset); in update_bitmap()
1386 n = os_write_file(req->fds[1], &req->bitmap_words, in update_bitmap()
1387 sizeof(req->bitmap_words)); in update_bitmap()
1388 if(n != sizeof(req->bitmap_words)){ in update_bitmap()
1390 req->fds[1]); in update_bitmap()
1397 static void do_io(struct io_thread_req *req) in do_io() argument
1405 if (req->op == UBD_FLUSH) { in do_io()
1407 n = os_sync_file(req->fds[0]); in do_io()
1410 "fd = %d\n", -n, req->fds[0]); in do_io()
1411 req->error = 1; in do_io()
1416 nsectors = req->length / req->sectorsize; in do_io()
1419 bit = ubd_test_bit(start, (unsigned char *) &req->sector_mask); in do_io()
1423 &req->sector_mask) == bit)) in do_io()
1426 off = req->offset + req->offsets[bit] + in do_io()
1427 start * req->sectorsize; in do_io()
1428 len = (end - start) * req->sectorsize; in do_io()
1429 buf = &req->buffer[start * req->sectorsize]; in do_io()
1431 err = os_seek_file(req->fds[bit], off); in do_io()
1434 req->error = 1; in do_io()
1437 if(req->op == UBD_READ){ in do_io()
1442 n = os_read_file(req->fds[bit], buf, len); in do_io()
1445 "fd = %d\n", -n, req->fds[bit]); in do_io()
1446 req->error = 1; in do_io()
1452 n = os_write_file(req->fds[bit], buf, len); in do_io()
1455 "fd = %d\n", -n, req->fds[bit]); in do_io()
1456 req->error = 1; in do_io()
1464 req->error = update_bitmap(req); in do_io()
1477 struct io_thread_req *req; in io_thread() local
1483 n = os_read_file(kernel_fd, &req, in io_thread()
1496 do_io(req); in io_thread()
1497 n = os_write_file(kernel_fd, &req, in io_thread()