diff options
author | Tejun Heo <tj@kernel.org> | 2010-09-03 05:56:17 -0400 |
---|---|---|
committer | Jens Axboe <jaxboe@fusionio.com> | 2010-09-10 06:35:37 -0400 |
commit | d391a2dda2f1c993f094bdb3a8a342c5e0546553 (patch) | |
tree | 315b4d8431db05b96d578e2d7183081b91fa4e84 /block/blk-flush.c | |
parent | 04ccc65cd1f57aee861708e08cd2272c5a0d088c (diff) |
block: use REQ_FLUSH in blkdev_issue_flush()
Update blkdev_issue_flush() to use new REQ_FLUSH interface.
Signed-off-by: Tejun Heo <tj@kernel.org>
Cc: Christoph Hellwig <hch@infradead.org>
Signed-off-by: Jens Axboe <jaxboe@fusionio.com>
Diffstat (limited to 'block/blk-flush.c')
-rw-r--r-- | block/blk-flush.c | 17 |
1 files changed, 6 insertions, 11 deletions
diff --git a/block/blk-flush.c b/block/blk-flush.c index 7d1fc982e78f..62b7df9bca9d 100644 --- a/block/blk-flush.c +++ b/block/blk-flush.c | |||
@@ -191,13 +191,10 @@ struct request *blk_do_flush(struct request_queue *q, struct request *rq) | |||
191 | return blk_flush_complete_seq(q, skip, 0); | 191 | return blk_flush_complete_seq(q, skip, 0); |
192 | } | 192 | } |
193 | 193 | ||
194 | static void bio_end_empty_barrier(struct bio *bio, int err) | 194 | static void bio_end_flush(struct bio *bio, int err) |
195 | { | 195 | { |
196 | if (err) { | 196 | if (err) |
197 | if (err == -EOPNOTSUPP) | ||
198 | set_bit(BIO_EOPNOTSUPP, &bio->bi_flags); | ||
199 | clear_bit(BIO_UPTODATE, &bio->bi_flags); | 197 | clear_bit(BIO_UPTODATE, &bio->bi_flags); |
200 | } | ||
201 | if (bio->bi_private) | 198 | if (bio->bi_private) |
202 | complete(bio->bi_private); | 199 | complete(bio->bi_private); |
203 | bio_put(bio); | 200 | bio_put(bio); |
@@ -235,19 +232,19 @@ int blkdev_issue_flush(struct block_device *bdev, gfp_t gfp_mask, | |||
235 | * some block devices may not have their queue correctly set up here | 232 | * some block devices may not have their queue correctly set up here |
236 | * (e.g. loop device without a backing file) and so issuing a flush | 233 | * (e.g. loop device without a backing file) and so issuing a flush |
237 | * here will panic. Ensure there is a request function before issuing | 234 | * here will panic. Ensure there is a request function before issuing |
238 | * the barrier. | 235 | * the flush. |
239 | */ | 236 | */ |
240 | if (!q->make_request_fn) | 237 | if (!q->make_request_fn) |
241 | return -ENXIO; | 238 | return -ENXIO; |
242 | 239 | ||
243 | bio = bio_alloc(gfp_mask, 0); | 240 | bio = bio_alloc(gfp_mask, 0); |
244 | bio->bi_end_io = bio_end_empty_barrier; | 241 | bio->bi_end_io = bio_end_flush; |
245 | bio->bi_bdev = bdev; | 242 | bio->bi_bdev = bdev; |
246 | if (test_bit(BLKDEV_WAIT, &flags)) | 243 | if (test_bit(BLKDEV_WAIT, &flags)) |
247 | bio->bi_private = &wait; | 244 | bio->bi_private = &wait; |
248 | 245 | ||
249 | bio_get(bio); | 246 | bio_get(bio); |
250 | submit_bio(WRITE_BARRIER, bio); | 247 | submit_bio(WRITE_FLUSH, bio); |
251 | if (test_bit(BLKDEV_WAIT, &flags)) { | 248 | if (test_bit(BLKDEV_WAIT, &flags)) { |
252 | wait_for_completion(&wait); | 249 | wait_for_completion(&wait); |
253 | /* | 250 | /* |
@@ -259,9 +256,7 @@ int blkdev_issue_flush(struct block_device *bdev, gfp_t gfp_mask, | |||
259 | *error_sector = bio->bi_sector; | 256 | *error_sector = bio->bi_sector; |
260 | } | 257 | } |
261 | 258 | ||
262 | if (bio_flagged(bio, BIO_EOPNOTSUPP)) | 259 | if (!bio_flagged(bio, BIO_UPTODATE)) |
263 | ret = -EOPNOTSUPP; | ||
264 | else if (!bio_flagged(bio, BIO_UPTODATE)) | ||
265 | ret = -EIO; | 260 | ret = -EIO; |
266 | 261 | ||
267 | bio_put(bio); | 262 | bio_put(bio); |