blk_peek_request
来源:互联网 发布:车险计算软件 编辑:程序博客网 时间:2024/06/16 18:26
1. blk_fetch_request
/**
* blk_peek_request - peek at the top of a request queue * @q: request queue to peek at * * Description: * Return the request at the top of @q. The returned request * should be started using blk_start_request() before LLD starts * processing it. * * Return: * Pointer to the request at the top of @q if available. Null * otherwise. * * Context: * queue_lock must be held. */struct request *blk_peek_request(struct request_queue *q){struct request *rq;int ret;while ((rq = __elv_next_request(q)) != NULL) {rq = blk_pm_peek_request(q, rq);if (!rq)break;if (!(rq->cmd_flags & REQ_STARTED)) {/* * This is the first time the device driver * sees this request (possibly after * requeueing). Notify IO scheduler. */if (rq->cmd_flags & REQ_SORTED)elv_activate_rq(q, rq);/* * just mark as started even if we don't start * it, a request that has been delayed should * not be passed by new incoming requests */rq->cmd_flags |= REQ_STARTED;trace_block_rq_issue(q, rq);}if (!q->boundary_rq || q->boundary_rq == rq) {q->end_sector = rq_end_sector(rq);q->boundary_rq = NULL;}if (rq->cmd_flags & REQ_DONTPREP)break;if (q->dma_drain_size && blk_rq_bytes(rq)) {/* * make sure space for the drain appears we * know we can do this because max_hw_segments * has been adjusted to be one fewer than the * device can handle */rq->nr_phys_segments++;}if (!q->prep_rq_fn)break;ret = q->prep_rq_fn(q, rq);if (ret == BLKPREP_OK) {break;} else if (ret == BLKPREP_DEFER) {/* * the request may have been (partially) prepped. * we need to keep this request in the front to * avoid resource deadlock. REQ_STARTED will * prevent other fs requests from passing this one. */if (q->dma_drain_size && blk_rq_bytes(rq) && !(rq->cmd_flags & REQ_DONTPREP)) {/* * remove the space for the drain we added * so that we don't add it again */--rq->nr_phys_segments;}rq = NULL;break;} else if (ret == BLKPREP_KILL || ret == BLKPREP_INVALID) {int err = (ret == BLKPREP_INVALID) ? -EREMOTEIO : -EIO;rq->cmd_flags |= REQ_QUIET;/* * Mark this request as started so we don't trigger * any debug logic in the end I/O path. */blk_start_request(rq);__blk_end_request_all(rq, err);} else {printk(KERN_ERR "%s: bad return=%d\n", __func__, ret);break;}}return rq;}
0 0
- blk_peek_request
- __elv_next_request 和 blk_peek_request
- python 中 eval函数,exec与eval对不
- 每天一个linux命令(10):cat 命令
- 原生js实现二级联动下拉列表菜单
- 如何理解变量赋值(如: int x = 1;)
- ogg参数解析
- blk_peek_request
- xml自动提示
- 18 Linux which
- Qt QComboBox自定义的下拉框
- Highcharts实现圆角柱形图
- caffe学习笔记11-deploy.prototxt学习
- 数据库存储过程、函数、触发器的区别
- 矩阵快速幂
- 【Redis】Java中使用Jedis操作Redis(Maven导入包)、创建Redis连接池