Skip to content

Commit

Permalink
drbd: moved md_io into mdev
Browse files Browse the repository at this point in the history
Signed-off-by: Philipp Reisner <[email protected]>
Signed-off-by: Lars Ellenberg <[email protected]>
  • Loading branch information
Philipp-Reisner committed May 9, 2012
1 parent 2b4dd36 commit cc94c65
Show file tree
Hide file tree
Showing 3 changed files with 10 additions and 9 deletions.
12 changes: 5 additions & 7 deletions drivers/block/drbd/drbd_actlog.c
Original file line number Diff line number Diff line change
Expand Up @@ -71,12 +71,10 @@ static int _drbd_md_sync_page_io(struct drbd_conf *mdev,
int rw, int size)
{
struct bio *bio;
struct drbd_md_io md_io;
int ok;

md_io.mdev = mdev;
init_completion(&md_io.event);
md_io.error = 0;
init_completion(&mdev->md_io.event);
mdev->md_io.error = 0;

if ((rw & WRITE) && !test_bit(MD_NO_FUA, &mdev->flags))
rw |= REQ_FUA | REQ_FLUSH;
Expand All @@ -88,16 +86,16 @@ static int _drbd_md_sync_page_io(struct drbd_conf *mdev,
ok = (bio_add_page(bio, page, size, 0) == size);
if (!ok)
goto out;
bio->bi_private = &md_io;
bio->bi_private = &mdev->md_io;
bio->bi_end_io = drbd_md_io_complete;
bio->bi_rw = rw;

if (drbd_insert_fault(mdev, (rw & WRITE) ? DRBD_FAULT_MD_WR : DRBD_FAULT_MD_RD))
bio_endio(bio, -EIO);
else
submit_bio(rw, bio);
wait_for_completion(&md_io.event);
ok = bio_flagged(bio, BIO_UPTODATE) && md_io.error == 0;
wait_for_completion(&mdev->md_io.event);
ok = bio_flagged(bio, BIO_UPTODATE) && mdev->md_io.error == 0;

out:
bio_put(bio);
Expand Down
4 changes: 2 additions & 2 deletions drivers/block/drbd/drbd_int.h
Original file line number Diff line number Diff line change
Expand Up @@ -938,7 +938,6 @@ struct drbd_backing_dev {
};

struct drbd_md_io {
struct drbd_conf *mdev;
struct completion event;
int error;
};
Expand Down Expand Up @@ -1095,7 +1094,8 @@ struct drbd_conf {
wait_queue_head_t ee_wait;
struct page *md_io_page; /* one page buffer for md_io */
struct page *md_io_tmpp; /* for logical_block_size != 512 */
struct mutex md_io_mutex; /* protects the md_io_buffer */
struct drbd_md_io md_io;
struct mutex md_io_mutex; /* protects the md_io, md_io_page and md_io_tmpp */
spinlock_t al_lock;
wait_queue_head_t al_wait;
struct lru_cache *act_log; /* activity log */
Expand Down
3 changes: 3 additions & 0 deletions drivers/block/drbd/drbd_worker.c
Original file line number Diff line number Diff line change
Expand Up @@ -70,8 +70,11 @@ rwlock_t global_state_lock;
void drbd_md_io_complete(struct bio *bio, int error)
{
struct drbd_md_io *md_io;
struct drbd_conf *mdev;

md_io = (struct drbd_md_io *)bio->bi_private;
mdev = container_of(md_io, struct drbd_conf, md_io);

md_io->error = error;

complete(&md_io->event);
Expand Down

0 comments on commit cc94c65

Please sign in to comment.