/* Returns -1 on IO error, 0 on checksum error and 1 upon success.  */
static int drbd_al_read_tr(struct drbd_conf *mdev, struct drbd_backing_dev *bdev, struct al_transaction *b, int index)
/* Returns -1 on IO error, 0 on checksum error and 1 upon success.  */
static int drbd_al_read_tr(struct drbd_conf *mdev, struct drbd_backing_dev *bdev, struct al_transaction *b, int index)
{
	sector_t sector;
	int rv, i;
	u32 xor_sum = 0;
	sector = bdev->md.md_offset + bdev->md.al_offset + index;
	if (!drbd_md_sync_page_io(mdev, bdev, sector, READ))
		return -1;
	rv = (be32_to_cpu(b->magic) == DRBD_MAGIC);
	for (i = 0; i < AL_EXTENTS_PT + 1; i++)
		xor_sum ^= be32_to_cpu(b->updates[i].extent);
	rv &= (xor_sum == be32_to_cpu(b->xor_sum));
	return rv;
}