diff options
Diffstat (limited to 'drivers/block/drbd/drbd_actlog.c')
| -rw-r--r-- | drivers/block/drbd/drbd_actlog.c | 21 |
1 files changed, 21 insertions, 0 deletions
diff --git a/drivers/block/drbd/drbd_actlog.c b/drivers/block/drbd/drbd_actlog.c index 6608076dc39e..28c73ca320a8 100644 --- a/drivers/block/drbd/drbd_actlog.c +++ b/drivers/block/drbd/drbd_actlog.c | |||
| @@ -659,6 +659,27 @@ void drbd_al_shrink(struct drbd_conf *mdev) | |||
| 659 | wake_up(&mdev->al_wait); | 659 | wake_up(&mdev->al_wait); |
| 660 | } | 660 | } |
| 661 | 661 | ||
| 662 | int drbd_initialize_al(struct drbd_conf *mdev, void *buffer) | ||
| 663 | { | ||
| 664 | struct al_transaction_on_disk *al = buffer; | ||
| 665 | struct drbd_md *md = &mdev->ldev->md; | ||
| 666 | sector_t al_base = md->md_offset + md->al_offset; | ||
| 667 | int al_size_4k = md->al_stripes * md->al_stripe_size_4k; | ||
| 668 | int i; | ||
| 669 | |||
| 670 | memset(al, 0, 4096); | ||
| 671 | al->magic = cpu_to_be32(DRBD_AL_MAGIC); | ||
| 672 | al->transaction_type = cpu_to_be16(AL_TR_INITIALIZED); | ||
| 673 | al->crc32c = cpu_to_be32(crc32c(0, al, 4096)); | ||
| 674 | |||
| 675 | for (i = 0; i < al_size_4k; i++) { | ||
| 676 | int err = drbd_md_sync_page_io(mdev, mdev->ldev, al_base + i * 8, WRITE); | ||
| 677 | if (err) | ||
| 678 | return err; | ||
| 679 | } | ||
| 680 | return 0; | ||
| 681 | } | ||
| 682 | |||
| 662 | static int w_update_odbm(struct drbd_work *w, int unused) | 683 | static int w_update_odbm(struct drbd_work *w, int unused) |
| 663 | { | 684 | { |
| 664 | struct update_odbm_work *udw = container_of(w, struct update_odbm_work, w); | 685 | struct update_odbm_work *udw = container_of(w, struct update_odbm_work, w); |
