|
@@ -2605,3 +2605,66 @@ EXPORT_SYMBOL(blk_end_request_cur);
|
|
* Complete @rq till the next failure boundary.
|
|
* Complete @rq till the next failure boundary.
|
|
*
|
|
*
|
|
* Return:
|
|
* Return:
|
|
|
|
+ * %false - we are done with this request
|
|
|
|
+ * %true - still buffers pending for this request
|
|
|
|
+ */
|
|
|
|
+bool blk_end_request_err(struct request *rq, int error)
|
|
|
|
+{
|
|
|
|
+ WARN_ON(error >= 0);
|
|
|
|
+ return blk_end_request(rq, error, blk_rq_err_bytes(rq));
|
|
|
|
+}
|
|
|
|
+EXPORT_SYMBOL_GPL(blk_end_request_err);
|
|
|
|
+
|
|
|
|
+/**
|
|
|
|
+ * __blk_end_request - Helper function for drivers to complete the request.
|
|
|
|
+ * @rq: the request being processed
|
|
|
|
+ * @error: %0 for success, < %0 for error
|
|
|
|
+ * @nr_bytes: number of bytes to complete
|
|
|
|
+ *
|
|
|
|
+ * Description:
|
|
|
|
+ * Must be called with queue lock held unlike blk_end_request().
|
|
|
|
+ *
|
|
|
|
+ * Return:
|
|
|
|
+ * %false - we are done with this request
|
|
|
|
+ * %true - still buffers pending for this request
|
|
|
|
+ **/
|
|
|
|
+bool __blk_end_request(struct request *rq, int error, unsigned int nr_bytes)
|
|
|
|
+{
|
|
|
|
+ return __blk_end_bidi_request(rq, error, nr_bytes, 0);
|
|
|
|
+}
|
|
|
|
+EXPORT_SYMBOL(__blk_end_request);
|
|
|
|
+
|
|
|
|
+/**
|
|
|
|
+ * __blk_end_request_all - Helper function for drives to finish the request.
|
|
|
|
+ * @rq: the request to finish
|
|
|
|
+ * @error: %0 for success, < %0 for error
|
|
|
|
+ *
|
|
|
|
+ * Description:
|
|
|
|
+ * Completely finish @rq. Must be called with queue lock held.
|
|
|
|
+ */
|
|
|
|
+void __blk_end_request_all(struct request *rq, int error)
|
|
|
|
+{
|
|
|
|
+ bool pending;
|
|
|
|
+ unsigned int bidi_bytes = 0;
|
|
|
|
+
|
|
|
|
+ if (unlikely(blk_bidi_rq(rq)))
|
|
|
|
+ bidi_bytes = blk_rq_bytes(rq->next_rq);
|
|
|
|
+
|
|
|
|
+ pending = __blk_end_bidi_request(rq, error, blk_rq_bytes(rq), bidi_bytes);
|
|
|
|
+ BUG_ON(pending);
|
|
|
|
+}
|
|
|
|
+EXPORT_SYMBOL(__blk_end_request_all);
|
|
|
|
+
|
|
|
|
+/**
|
|
|
|
+ * __blk_end_request_cur - Helper function to finish the current request chunk.
|
|
|
|
+ * @rq: the request to finish the current chunk for
|
|
|
|
+ * @error: %0 for success, < %0 for error
|
|
|
|
+ *
|
|
|
|
+ * Description:
|
|
|
|
+ * Complete the current consecutively mapped chunk from @rq. Must
|
|
|
|
+ * be called with queue lock held.
|
|
|
|
+ *
|
|
|
|
+ * Return:
|
|
|
|
+ * %false - we are done with this request
|
|
|
|
+ * %true - still buffers pending for this request
|
|
|
|
+ */
|