2008年1月7日 星期一

request queue

represented by a pointer to struct request_queue

initialization:
request_queue_t *blk_init_queue(request_fn_proc *request_fn, spinlock_t *lock);
// request_fn is the driver's function which will process requests

remove queue
void blk_cleanup_queue(request_queue_t *q);

Note that neither of these functions is normally called if a "make request" function is being used

find the next request to process with
struct request *elv_next_request(request_queue_t *q);

a request contains a list of BIO structures. iterating through a request's BIOs
struct bio *bio;
rq_for_each_bio(bio, req) {
/* Process this BIO */
}

As your driver performs the transfers described by the BIO structures, it will need to update the kernel on its progress.
int end_that_request_first(struct request *req, int uptodate, int nsectors);

remove request from queue
void blkdev_dequeue_request(struct request *req);
void end_that_request_last(struct request *req);

沒有留言: