aboutsummaryrefslogtreecommitdiffstats
path: root/block
diff options
context:
space:
mode:
Diffstat (limited to 'block')
-rw-r--r--block/blk-core.c58
1 files changed, 7 insertions, 51 deletions
diff --git a/block/blk-core.c b/block/blk-core.c
index b2d0ac8b760e..2d053b584410 100644
--- a/block/blk-core.c
+++ b/block/blk-core.c
@@ -1790,17 +1790,6 @@ static void end_that_request_last(struct request *req, int error)
1790 } 1790 }
1791} 1791}
1792 1792
1793static inline void __end_request(struct request *rq, int uptodate,
1794 unsigned int nr_bytes)
1795{
1796 int error = 0;
1797
1798 if (uptodate <= 0)
1799 error = uptodate ? uptodate : -EIO;
1800
1801 __blk_end_request(rq, error, nr_bytes);
1802}
1803
1804/** 1793/**
1805 * blk_rq_bytes - Returns bytes left to complete in the entire request 1794 * blk_rq_bytes - Returns bytes left to complete in the entire request
1806 * @rq: the request being processed 1795 * @rq: the request being processed
@@ -1831,41 +1820,6 @@ unsigned int blk_rq_cur_bytes(struct request *rq)
1831EXPORT_SYMBOL_GPL(blk_rq_cur_bytes); 1820EXPORT_SYMBOL_GPL(blk_rq_cur_bytes);
1832 1821
1833/** 1822/**
1834 * end_queued_request - end all I/O on a queued request
1835 * @rq: the request being processed
1836 * @uptodate: error value or %0/%1 uptodate flag
1837 *
1838 * Description:
1839 * Ends all I/O on a request, and removes it from the block layer queues.
1840 * Not suitable for normal I/O completion, unless the driver still has
1841 * the request attached to the block layer.
1842 *
1843 **/
1844void end_queued_request(struct request *rq, int uptodate)
1845{
1846 __end_request(rq, uptodate, blk_rq_bytes(rq));
1847}
1848EXPORT_SYMBOL(end_queued_request);
1849
1850/**
1851 * end_dequeued_request - end all I/O on a dequeued request
1852 * @rq: the request being processed
1853 * @uptodate: error value or %0/%1 uptodate flag
1854 *
1855 * Description:
1856 * Ends all I/O on a request. The request must already have been
1857 * dequeued using blkdev_dequeue_request(), as is normally the case
1858 * for most drivers.
1859 *
1860 **/
1861void end_dequeued_request(struct request *rq, int uptodate)
1862{
1863 __end_request(rq, uptodate, blk_rq_bytes(rq));
1864}
1865EXPORT_SYMBOL(end_dequeued_request);
1866
1867
1868/**
1869 * end_request - end I/O on the current segment of the request 1823 * end_request - end I/O on the current segment of the request
1870 * @req: the request being processed 1824 * @req: the request being processed
1871 * @uptodate: error value or %0/%1 uptodate flag 1825 * @uptodate: error value or %0/%1 uptodate flag
@@ -1879,14 +1833,16 @@ EXPORT_SYMBOL(end_dequeued_request);
1879 * they have a residual value to account for. For that case this function 1833 * they have a residual value to account for. For that case this function
1880 * isn't really useful, unless the residual just happens to be the 1834 * isn't really useful, unless the residual just happens to be the
1881 * full current segment. In other words, don't use this function in new 1835 * full current segment. In other words, don't use this function in new
1882 * code. Use blk_end_request() or __blk_end_request() to end partial parts 1836 * code. Use blk_end_request() or __blk_end_request() to end a request.
1883 * of a request, or end_dequeued_request() and end_queued_request() to
1884 * completely end IO on a dequeued/queued request.
1885 *
1886 **/ 1837 **/
1887void end_request(struct request *req, int uptodate) 1838void end_request(struct request *req, int uptodate)
1888{ 1839{
1889 __end_request(req, uptodate, req->hard_cur_sectors << 9); 1840 int error = 0;
1841
1842 if (uptodate <= 0)
1843 error = uptodate ? uptodate : -EIO;
1844
1845 __blk_end_request(req, error, req->hard_cur_sectors << 9);
1890} 1846}
1891EXPORT_SYMBOL(end_request); 1847EXPORT_SYMBOL(end_request);
1892 1848