|
@@ -1255,3 +1255,66 @@ static void part_round_stats_single(int cpu, struct hd_struct *part,
|
|
|
* the current jiffies and restarts the counters again.
|
|
|
*/
|
|
|
void part_round_stats(int cpu, struct hd_struct *part)
|
|
|
+{
|
|
|
+ unsigned long now = jiffies;
|
|
|
+
|
|
|
+ if (part->partno)
|
|
|
+ part_round_stats_single(cpu, &part_to_disk(part)->part0, now);
|
|
|
+ part_round_stats_single(cpu, part, now);
|
|
|
+}
|
|
|
+EXPORT_SYMBOL_GPL(part_round_stats);
|
|
|
+
|
|
|
+/*
|
|
|
+ * queue lock must be held
|
|
|
+ */
|
|
|
+void __blk_put_request(struct request_queue *q, struct request *req)
|
|
|
+{
|
|
|
+ if (unlikely(!q))
|
|
|
+ return;
|
|
|
+ if (unlikely(--req->ref_count))
|
|
|
+ return;
|
|
|
+
|
|
|
+ elv_completed_request(q, req);
|
|
|
+
|
|
|
+ /* this is a bio leak */
|
|
|
+ WARN_ON(req->bio != NULL);
|
|
|
+
|
|
|
+ /*
|
|
|
+ * Request may not have originated from ll_rw_blk. if not,
|
|
|
+ * it didn't come out of our reserved rq pools
|
|
|
+ */
|
|
|
+ if (req->cmd_flags & REQ_ALLOCED) {
|
|
|
+ unsigned int flags = req->cmd_flags;
|
|
|
+ struct request_list *rl = blk_rq_rl(req);
|
|
|
+
|
|
|
+ BUG_ON(!list_empty(&req->queuelist));
|
|
|
+ BUG_ON(!hlist_unhashed(&req->hash));
|
|
|
+
|
|
|
+ blk_free_request(rl, req);
|
|
|
+ freed_request(rl, flags);
|
|
|
+ blk_put_rl(rl);
|
|
|
+ }
|
|
|
+}
|
|
|
+EXPORT_SYMBOL_GPL(__blk_put_request);
|
|
|
+
|
|
|
+void blk_put_request(struct request *req)
|
|
|
+{
|
|
|
+ unsigned long flags;
|
|
|
+ struct request_queue *q = req->q;
|
|
|
+
|
|
|
+ spin_lock_irqsave(q->queue_lock, flags);
|
|
|
+ __blk_put_request(q, req);
|
|
|
+ spin_unlock_irqrestore(q->queue_lock, flags);
|
|
|
+}
|
|
|
+EXPORT_SYMBOL(blk_put_request);
|
|
|
+
|
|
|
+/**
|
|
|
+ * blk_add_request_payload - add a payload to a request
|
|
|
+ * @rq: request to update
|
|
|
+ * @page: page backing the payload
|
|
|
+ * @len: length of the payload.
|
|
|
+ *
|
|
|
+ * This allows to later add a payload to an already submitted request by
|
|
|
+ * a block driver. The driver needs to take care of freeing the payload
|
|
|
+ * itself.
|
|
|
+ *
|