Commit 3fbf4d21 authored by Andreas Gruenbacher's avatar Andreas Gruenbacher Committed by Philipp Reisner

drbd: drbd_md_sync_page_io(): Return 0 upon success and an error code otherwise

Signed-off-by: default avatarPhilipp Reisner <philipp.reisner@linbit.com>
Signed-off-by: default avatarLars Ellenberg <lars.ellenberg@linbit.com>
parent ac29f403
...@@ -151,7 +151,7 @@ static int _drbd_md_sync_page_io(struct drbd_conf *mdev, ...@@ -151,7 +151,7 @@ static int _drbd_md_sync_page_io(struct drbd_conf *mdev,
int drbd_md_sync_page_io(struct drbd_conf *mdev, struct drbd_backing_dev *bdev, int drbd_md_sync_page_io(struct drbd_conf *mdev, struct drbd_backing_dev *bdev,
sector_t sector, int rw) sector_t sector, int rw)
{ {
int ok; int err;
struct page *iop = mdev->md_io_page; struct page *iop = mdev->md_io_page;
D_ASSERT(mutex_is_locked(&mdev->md_io_mutex)); D_ASSERT(mutex_is_locked(&mdev->md_io_mutex));
...@@ -168,14 +168,12 @@ int drbd_md_sync_page_io(struct drbd_conf *mdev, struct drbd_backing_dev *bdev, ...@@ -168,14 +168,12 @@ int drbd_md_sync_page_io(struct drbd_conf *mdev, struct drbd_backing_dev *bdev,
current->comm, current->pid, __func__, current->comm, current->pid, __func__,
(unsigned long long)sector, (rw & WRITE) ? "WRITE" : "READ"); (unsigned long long)sector, (rw & WRITE) ? "WRITE" : "READ");
ok = !_drbd_md_sync_page_io(mdev, bdev, iop, sector, rw, MD_BLOCK_SIZE); err = _drbd_md_sync_page_io(mdev, bdev, iop, sector, rw, MD_BLOCK_SIZE);
if (unlikely(!ok)) { if (err) {
dev_err(DEV, "drbd_md_sync_page_io(,%llus,%s) failed!\n", dev_err(DEV, "drbd_md_sync_page_io(,%llus,%s) failed!\n",
(unsigned long long)sector, (rw & WRITE) ? "WRITE" : "READ"); (unsigned long long)sector, (rw & WRITE) ? "WRITE" : "READ");
return 0;
} }
return err;
return ok;
} }
static struct lc_element *_al_get(struct drbd_conf *mdev, unsigned int enr) static struct lc_element *_al_get(struct drbd_conf *mdev, unsigned int enr)
...@@ -392,7 +390,7 @@ w_al_write_transaction(struct drbd_work *w, int unused) ...@@ -392,7 +390,7 @@ w_al_write_transaction(struct drbd_work *w, int unused)
if (drbd_bm_write_hinted(mdev)) if (drbd_bm_write_hinted(mdev))
aw->err = -EIO; aw->err = -EIO;
/* drbd_chk_io_error done already */ /* drbd_chk_io_error done already */
else if (!drbd_md_sync_page_io(mdev, mdev->ldev, sector, WRITE)) { else if (drbd_md_sync_page_io(mdev, mdev->ldev, sector, WRITE)) {
aw->err = -EIO; aw->err = -EIO;
drbd_chk_io_error(mdev, 1, true); drbd_chk_io_error(mdev, 1, true);
} else { } else {
...@@ -439,7 +437,7 @@ static int drbd_al_read_tr(struct drbd_conf *mdev, ...@@ -439,7 +437,7 @@ static int drbd_al_read_tr(struct drbd_conf *mdev,
/* Dont process error normally, /* Dont process error normally,
* as this is done before disk is attached! */ * as this is done before disk is attached! */
if (!drbd_md_sync_page_io(mdev, bdev, sector, READ)) if (drbd_md_sync_page_io(mdev, bdev, sector, READ))
return -1; return -1;
if (!expect(b->magic == cpu_to_be32(DRBD_AL_MAGIC))) if (!expect(b->magic == cpu_to_be32(DRBD_AL_MAGIC)))
......
...@@ -2637,7 +2637,7 @@ void drbd_md_sync(struct drbd_conf *mdev) ...@@ -2637,7 +2637,7 @@ void drbd_md_sync(struct drbd_conf *mdev)
D_ASSERT(drbd_md_ss__(mdev, mdev->ldev) == mdev->ldev->md.md_offset); D_ASSERT(drbd_md_ss__(mdev, mdev->ldev) == mdev->ldev->md.md_offset);
sector = mdev->ldev->md.md_offset; sector = mdev->ldev->md.md_offset;
if (!drbd_md_sync_page_io(mdev, mdev->ldev, sector, WRITE)) { if (drbd_md_sync_page_io(mdev, mdev->ldev, sector, WRITE)) {
/* this was a try anyways ... */ /* this was a try anyways ... */
dev_err(DEV, "meta data update failed!\n"); dev_err(DEV, "meta data update failed!\n");
drbd_chk_io_error(mdev, 1, true); drbd_chk_io_error(mdev, 1, true);
...@@ -2670,7 +2670,7 @@ int drbd_md_read(struct drbd_conf *mdev, struct drbd_backing_dev *bdev) ...@@ -2670,7 +2670,7 @@ int drbd_md_read(struct drbd_conf *mdev, struct drbd_backing_dev *bdev)
mutex_lock(&mdev->md_io_mutex); mutex_lock(&mdev->md_io_mutex);
buffer = (struct meta_data_on_disk *)page_address(mdev->md_io_page); buffer = (struct meta_data_on_disk *)page_address(mdev->md_io_page);
if (!drbd_md_sync_page_io(mdev, bdev, bdev->md.md_offset, READ)) { if (drbd_md_sync_page_io(mdev, bdev, bdev->md.md_offset, READ)) {
/* NOTE: can't do normal error processing here as this is /* NOTE: can't do normal error processing here as this is
called BEFORE disk is attached */ called BEFORE disk is attached */
dev_err(DEV, "Error while reading metadata.\n"); dev_err(DEV, "Error while reading metadata.\n");
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment