diff options
author | Andreas Gruenbacher <agruen@linbit.com> | 2010-12-12 20:25:41 -0500 |
---|---|---|
committer | Philipp Reisner <philipp.reisner@linbit.com> | 2012-11-08 10:44:48 -0500 |
commit | 3fbf4d21ae9b7a61ce56c80573b64a1cc18c10ce (patch) | |
tree | e6faa8c24a7b41196c6bec749c8336efc9ddc05d /drivers | |
parent | ac29f4039aca8dd98c631c8b5c66f3dd76c2408c (diff) |
drbd: drbd_md_sync_page_io(): Return 0 upon success and an error code otherwise
Signed-off-by: Philipp Reisner <philipp.reisner@linbit.com>
Signed-off-by: Lars Ellenberg <lars.ellenberg@linbit.com>
Diffstat (limited to 'drivers')
-rw-r--r-- | drivers/block/drbd/drbd_actlog.c | 14 | ||||
-rw-r--r-- | drivers/block/drbd/drbd_main.c | 4 |
2 files changed, 8 insertions, 10 deletions
diff --git a/drivers/block/drbd/drbd_actlog.c b/drivers/block/drbd/drbd_actlog.c index 6517c91de4b8..586776195a79 100644 --- a/drivers/block/drbd/drbd_actlog.c +++ b/drivers/block/drbd/drbd_actlog.c | |||
@@ -151,7 +151,7 @@ static int _drbd_md_sync_page_io(struct drbd_conf *mdev, | |||
151 | int drbd_md_sync_page_io(struct drbd_conf *mdev, struct drbd_backing_dev *bdev, | 151 | int drbd_md_sync_page_io(struct drbd_conf *mdev, struct drbd_backing_dev *bdev, |
152 | sector_t sector, int rw) | 152 | sector_t sector, int rw) |
153 | { | 153 | { |
154 | int ok; | 154 | int err; |
155 | struct page *iop = mdev->md_io_page; | 155 | struct page *iop = mdev->md_io_page; |
156 | 156 | ||
157 | D_ASSERT(mutex_is_locked(&mdev->md_io_mutex)); | 157 | 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 | current->comm, current->pid, __func__, | 168 | current->comm, current->pid, __func__, |
169 | (unsigned long long)sector, (rw & WRITE) ? "WRITE" : "READ"); | 169 | (unsigned long long)sector, (rw & WRITE) ? "WRITE" : "READ"); |
170 | 170 | ||
171 | ok = !_drbd_md_sync_page_io(mdev, bdev, iop, sector, rw, MD_BLOCK_SIZE); | 171 | err = _drbd_md_sync_page_io(mdev, bdev, iop, sector, rw, MD_BLOCK_SIZE); |
172 | if (unlikely(!ok)) { | 172 | if (err) { |
173 | dev_err(DEV, "drbd_md_sync_page_io(,%llus,%s) failed!\n", | 173 | dev_err(DEV, "drbd_md_sync_page_io(,%llus,%s) failed!\n", |
174 | (unsigned long long)sector, (rw & WRITE) ? "WRITE" : "READ"); | 174 | (unsigned long long)sector, (rw & WRITE) ? "WRITE" : "READ"); |
175 | return 0; | ||
176 | } | 175 | } |
177 | 176 | return err; | |
178 | return ok; | ||
179 | } | 177 | } |
180 | 178 | ||
181 | static struct lc_element *_al_get(struct drbd_conf *mdev, unsigned int enr) | 179 | 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 | if (drbd_bm_write_hinted(mdev)) | 390 | if (drbd_bm_write_hinted(mdev)) |
393 | aw->err = -EIO; | 391 | aw->err = -EIO; |
394 | /* drbd_chk_io_error done already */ | 392 | /* drbd_chk_io_error done already */ |
395 | else if (!drbd_md_sync_page_io(mdev, mdev->ldev, sector, WRITE)) { | 393 | else if (drbd_md_sync_page_io(mdev, mdev->ldev, sector, WRITE)) { |
396 | aw->err = -EIO; | 394 | aw->err = -EIO; |
397 | drbd_chk_io_error(mdev, 1, true); | 395 | drbd_chk_io_error(mdev, 1, true); |
398 | } else { | 396 | } else { |
@@ -439,7 +437,7 @@ static int drbd_al_read_tr(struct drbd_conf *mdev, | |||
439 | 437 | ||
440 | /* Dont process error normally, | 438 | /* Dont process error normally, |
441 | * as this is done before disk is attached! */ | 439 | * as this is done before disk is attached! */ |
442 | if (!drbd_md_sync_page_io(mdev, bdev, sector, READ)) | 440 | if (drbd_md_sync_page_io(mdev, bdev, sector, READ)) |
443 | return -1; | 441 | return -1; |
444 | 442 | ||
445 | if (!expect(b->magic == cpu_to_be32(DRBD_AL_MAGIC))) | 443 | if (!expect(b->magic == cpu_to_be32(DRBD_AL_MAGIC))) |
diff --git a/drivers/block/drbd/drbd_main.c b/drivers/block/drbd/drbd_main.c index 6c4454c9b4da..43b9b7a067bd 100644 --- a/drivers/block/drbd/drbd_main.c +++ b/drivers/block/drbd/drbd_main.c | |||
@@ -2637,7 +2637,7 @@ void drbd_md_sync(struct drbd_conf *mdev) | |||
2637 | D_ASSERT(drbd_md_ss__(mdev, mdev->ldev) == mdev->ldev->md.md_offset); | 2637 | D_ASSERT(drbd_md_ss__(mdev, mdev->ldev) == mdev->ldev->md.md_offset); |
2638 | sector = mdev->ldev->md.md_offset; | 2638 | sector = mdev->ldev->md.md_offset; |
2639 | 2639 | ||
2640 | if (!drbd_md_sync_page_io(mdev, mdev->ldev, sector, WRITE)) { | 2640 | if (drbd_md_sync_page_io(mdev, mdev->ldev, sector, WRITE)) { |
2641 | /* this was a try anyways ... */ | 2641 | /* this was a try anyways ... */ |
2642 | dev_err(DEV, "meta data update failed!\n"); | 2642 | dev_err(DEV, "meta data update failed!\n"); |
2643 | drbd_chk_io_error(mdev, 1, true); | 2643 | 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 | mutex_lock(&mdev->md_io_mutex); | 2670 | mutex_lock(&mdev->md_io_mutex); |
2671 | buffer = (struct meta_data_on_disk *)page_address(mdev->md_io_page); | 2671 | buffer = (struct meta_data_on_disk *)page_address(mdev->md_io_page); |
2672 | 2672 | ||
2673 | if (!drbd_md_sync_page_io(mdev, bdev, bdev->md.md_offset, READ)) { | 2673 | if (drbd_md_sync_page_io(mdev, bdev, bdev->md.md_offset, READ)) { |
2674 | /* NOTE: can't do normal error processing here as this is | 2674 | /* NOTE: can't do normal error processing here as this is |
2675 | called BEFORE disk is attached */ | 2675 | called BEFORE disk is attached */ |
2676 | dev_err(DEV, "Error while reading metadata.\n"); | 2676 | dev_err(DEV, "Error while reading metadata.\n"); |