提交 cc94c650 编写于 作者: P Philipp Reisner

drbd: moved md_io into mdev

Signed-off-by: NPhilipp Reisner <philipp.reisner@linbit.com>
Signed-off-by: NLars Ellenberg <lars.ellenberg@linbit.com>
上级 2b4dd36f
...@@ -71,12 +71,10 @@ static int _drbd_md_sync_page_io(struct drbd_conf *mdev, ...@@ -71,12 +71,10 @@ static int _drbd_md_sync_page_io(struct drbd_conf *mdev,
int rw, int size) int rw, int size)
{ {
struct bio *bio; struct bio *bio;
struct drbd_md_io md_io;
int ok; int ok;
md_io.mdev = mdev; init_completion(&mdev->md_io.event);
init_completion(&md_io.event); mdev->md_io.error = 0;
md_io.error = 0;
if ((rw & WRITE) && !test_bit(MD_NO_FUA, &mdev->flags)) if ((rw & WRITE) && !test_bit(MD_NO_FUA, &mdev->flags))
rw |= REQ_FUA | REQ_FLUSH; rw |= REQ_FUA | REQ_FLUSH;
...@@ -88,7 +86,7 @@ static int _drbd_md_sync_page_io(struct drbd_conf *mdev, ...@@ -88,7 +86,7 @@ static int _drbd_md_sync_page_io(struct drbd_conf *mdev,
ok = (bio_add_page(bio, page, size, 0) == size); ok = (bio_add_page(bio, page, size, 0) == size);
if (!ok) if (!ok)
goto out; goto out;
bio->bi_private = &md_io; bio->bi_private = &mdev->md_io;
bio->bi_end_io = drbd_md_io_complete; bio->bi_end_io = drbd_md_io_complete;
bio->bi_rw = rw; bio->bi_rw = rw;
...@@ -96,8 +94,8 @@ static int _drbd_md_sync_page_io(struct drbd_conf *mdev, ...@@ -96,8 +94,8 @@ static int _drbd_md_sync_page_io(struct drbd_conf *mdev,
bio_endio(bio, -EIO); bio_endio(bio, -EIO);
else else
submit_bio(rw, bio); submit_bio(rw, bio);
wait_for_completion(&md_io.event); wait_for_completion(&mdev->md_io.event);
ok = bio_flagged(bio, BIO_UPTODATE) && md_io.error == 0; ok = bio_flagged(bio, BIO_UPTODATE) && mdev->md_io.error == 0;
out: out:
bio_put(bio); bio_put(bio);
......
...@@ -938,7 +938,6 @@ struct drbd_backing_dev { ...@@ -938,7 +938,6 @@ struct drbd_backing_dev {
}; };
struct drbd_md_io { struct drbd_md_io {
struct drbd_conf *mdev;
struct completion event; struct completion event;
int error; int error;
}; };
...@@ -1095,7 +1094,8 @@ struct drbd_conf { ...@@ -1095,7 +1094,8 @@ struct drbd_conf {
wait_queue_head_t ee_wait; wait_queue_head_t ee_wait;
struct page *md_io_page; /* one page buffer for md_io */ struct page *md_io_page; /* one page buffer for md_io */
struct page *md_io_tmpp; /* for logical_block_size != 512 */ 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; spinlock_t al_lock;
wait_queue_head_t al_wait; wait_queue_head_t al_wait;
struct lru_cache *act_log; /* activity log */ struct lru_cache *act_log; /* activity log */
......
...@@ -70,8 +70,11 @@ rwlock_t global_state_lock; ...@@ -70,8 +70,11 @@ rwlock_t global_state_lock;
void drbd_md_io_complete(struct bio *bio, int error) void drbd_md_io_complete(struct bio *bio, int error)
{ {
struct drbd_md_io *md_io; struct drbd_md_io *md_io;
struct drbd_conf *mdev;
md_io = (struct drbd_md_io *)bio->bi_private; md_io = (struct drbd_md_io *)bio->bi_private;
mdev = container_of(md_io, struct drbd_conf, md_io);
md_io->error = error; md_io->error = error;
complete(&md_io->event); complete(&md_io->event);
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册