drbd: REQ_HARDBARRIER -> REQ_FUA transition for meta data accesses
Signed-off-by: Philipp Reisner <philipp.reisner@linbit.com> Signed-off-by: Lars Ellenberg <lars.ellenberg@linbit.com>
This commit is contained in:
parent
2451fc3b2b
commit
a8a4e51e69
|
@ -78,11 +78,10 @@ static int _drbd_md_sync_page_io(struct drbd_conf *mdev,
|
|||
init_completion(&md_io.event);
|
||||
md_io.error = 0;
|
||||
|
||||
if ((rw & WRITE) && !test_bit(MD_NO_BARRIER, &mdev->flags))
|
||||
rw |= REQ_HARDBARRIER;
|
||||
if ((rw & WRITE) && !test_bit(MD_NO_FUA, &mdev->flags))
|
||||
rw |= REQ_FUA;
|
||||
rw |= REQ_UNPLUG | REQ_SYNC;
|
||||
|
||||
retry:
|
||||
bio = bio_alloc(GFP_NOIO, 1);
|
||||
bio->bi_bdev = bdev->md_bdev;
|
||||
bio->bi_sector = sector;
|
||||
|
@ -100,17 +99,6 @@ static int _drbd_md_sync_page_io(struct drbd_conf *mdev,
|
|||
wait_for_completion(&md_io.event);
|
||||
ok = bio_flagged(bio, BIO_UPTODATE) && md_io.error == 0;
|
||||
|
||||
/* check for unsupported barrier op.
|
||||
* would rather check on EOPNOTSUPP, but that is not reliable.
|
||||
* don't try again for ANY return value != 0 */
|
||||
if (unlikely((bio->bi_rw & REQ_HARDBARRIER) && !ok)) {
|
||||
/* Try again with no barrier */
|
||||
dev_warn(DEV, "Barriers not supported on meta data device - disabling\n");
|
||||
set_bit(MD_NO_BARRIER, &mdev->flags);
|
||||
rw &= ~REQ_HARDBARRIER;
|
||||
bio_put(bio);
|
||||
goto retry;
|
||||
}
|
||||
out:
|
||||
bio_put(bio);
|
||||
return ok;
|
||||
|
|
|
@ -835,8 +835,7 @@ enum {
|
|||
NO_BARRIER_SUPP, /* underlying block device doesn't implement barriers */
|
||||
CONSIDER_RESYNC,
|
||||
|
||||
MD_NO_BARRIER, /* meta data device does not support barriers,
|
||||
so don't even try */
|
||||
MD_NO_FUA, /* Users wants us to not use FUA/FLUSH on meta data dev */
|
||||
SUSPEND_IO, /* suspend application io */
|
||||
BITMAP_IO, /* suspend application io;
|
||||
once no more io in flight, start bitmap io */
|
||||
|
@ -2404,13 +2403,13 @@ static inline void drbd_md_flush(struct drbd_conf *mdev)
|
|||
{
|
||||
int r;
|
||||
|
||||
if (test_bit(MD_NO_BARRIER, &mdev->flags))
|
||||
if (test_bit(MD_NO_FUA, &mdev->flags))
|
||||
return;
|
||||
|
||||
r = blkdev_issue_flush(mdev->ldev->md_bdev, GFP_KERNEL, NULL,
|
||||
BLKDEV_IFL_WAIT);
|
||||
if (r) {
|
||||
set_bit(MD_NO_BARRIER, &mdev->flags);
|
||||
set_bit(MD_NO_FUA, &mdev->flags);
|
||||
dev_err(DEV, "meta data flush failed with status %d, disabling md-flushes\n", r);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -1103,9 +1103,9 @@ static int drbd_nl_disk_conf(struct drbd_conf *mdev, struct drbd_nl_cfg_req *nlp
|
|||
/* Reset the "barriers don't work" bits here, then force meta data to
|
||||
* be written, to ensure we determine if barriers are supported. */
|
||||
if (nbc->dc.no_md_flush)
|
||||
set_bit(MD_NO_BARRIER, &mdev->flags);
|
||||
set_bit(MD_NO_FUA, &mdev->flags);
|
||||
else
|
||||
clear_bit(MD_NO_BARRIER, &mdev->flags);
|
||||
clear_bit(MD_NO_FUA, &mdev->flags);
|
||||
|
||||
/* Point of no return reached.
|
||||
* Devices and memory are no longer released by error cleanup below.
|
||||
|
|
Loading…
Reference in New Issue