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 | 6259f28459a9de820f47a9ece4ffa22d4596a9af (patch) | |
tree | bff61125a1b8298ce870c7ed3e53b9622a56b13f /drivers/block/loop.c | |
parent | d391a2dda2f1c993f094bdb3a8a342c5e0546553 (diff) |
block/loop: implement REQ_FLUSH/FUA support
Deprecate REQ_HARDBARRIER and implement REQ_FLUSH/FUA instead. Also,
instead of checking file->f_op->fsync() directly, look at the value of
vfs_fsync() and ignore -EINVAL return.
Signed-off-by: Tejun Heo <tj@kernel.org>
Signed-off-by: Jens Axboe <jaxboe@fusionio.com>
Diffstat (limited to 'drivers/block/loop.c')
-rw-r--r-- | drivers/block/loop.c | 18 |
1 files changed, 9 insertions, 9 deletions
diff --git a/drivers/block/loop.c b/drivers/block/loop.c index 953d1e12f4d4..5d27bc6596de 100644 --- a/drivers/block/loop.c +++ b/drivers/block/loop.c | |||
@@ -477,17 +477,17 @@ static int do_bio_filebacked(struct loop_device *lo, struct bio *bio) | |||
477 | pos = ((loff_t) bio->bi_sector << 9) + lo->lo_offset; | 477 | pos = ((loff_t) bio->bi_sector << 9) + lo->lo_offset; |
478 | 478 | ||
479 | if (bio_rw(bio) == WRITE) { | 479 | if (bio_rw(bio) == WRITE) { |
480 | bool barrier = (bio->bi_rw & REQ_HARDBARRIER); | ||
481 | struct file *file = lo->lo_backing_file; | 480 | struct file *file = lo->lo_backing_file; |
482 | 481 | ||
483 | if (barrier) { | 482 | /* REQ_HARDBARRIER is deprecated */ |
484 | if (unlikely(!file->f_op->fsync)) { | 483 | if (bio->bi_rw & REQ_HARDBARRIER) { |
485 | ret = -EOPNOTSUPP; | 484 | ret = -EOPNOTSUPP; |
486 | goto out; | 485 | goto out; |
487 | } | 486 | } |
488 | 487 | ||
488 | if (bio->bi_rw & REQ_FLUSH) { | ||
489 | ret = vfs_fsync(file, 0); | 489 | ret = vfs_fsync(file, 0); |
490 | if (unlikely(ret)) { | 490 | if (unlikely(ret && ret != -EINVAL)) { |
491 | ret = -EIO; | 491 | ret = -EIO; |
492 | goto out; | 492 | goto out; |
493 | } | 493 | } |
@@ -495,9 +495,9 @@ static int do_bio_filebacked(struct loop_device *lo, struct bio *bio) | |||
495 | 495 | ||
496 | ret = lo_send(lo, bio, pos); | 496 | ret = lo_send(lo, bio, pos); |
497 | 497 | ||
498 | if (barrier && !ret) { | 498 | if ((bio->bi_rw & REQ_FUA) && !ret) { |
499 | ret = vfs_fsync(file, 0); | 499 | ret = vfs_fsync(file, 0); |
500 | if (unlikely(ret)) | 500 | if (unlikely(ret && ret != -EINVAL)) |
501 | ret = -EIO; | 501 | ret = -EIO; |
502 | } | 502 | } |
503 | } else | 503 | } else |