/* Clears all bits in the bitmap and writes the whole bitmap to stable storage.  */
int drbd_bmio_clear_n_write(struct drbd_conf *mdev)
/* Clears all bits in the bitmap and writes the whole bitmap to stable storage.  */
int drbd_bmio_clear_n_write(struct drbd_conf *mdev)
{
	int rv = -EIO;
	if (get_ldev_if_state(mdev, D_ATTACHING)) {
		drbd_bm_clear_all(mdev);
		rv = drbd_bm_write(mdev);
		put_ldev(mdev);
	}
	return rv;
}