static int r5l_recovery_flush_one_stripe(struct r5l_log *log,
struct r5l_recovery_ctx *ctx,
sector_t stripe_sect,
- int *offset, sector_t *log_offset)
+ int *offset)
{
struct r5conf *conf = log->rdev->mddev->private;
struct stripe_head *sh;
sh = raid5_get_active_stripe(conf, stripe_sect, 0, 0, 0);
while (1) {
+ sector_t log_offset = r5l_ring_add(log, ctx->pos,
+ ctx->meta_total_blocks);
payload = page_address(ctx->meta_page) + *offset;
if (le16_to_cpu(payload->header.type) == R5LOG_PAYLOAD_DATA) {
le64_to_cpu(payload->location), 0,
&disk_index, sh);
- sync_page_io(log->rdev, *log_offset, PAGE_SIZE,
+ sync_page_io(log->rdev, log_offset, PAGE_SIZE,
sh->dev[disk_index].page, REQ_OP_READ, 0,
false);
sh->dev[disk_index].log_checksum =
le32_to_cpu(payload->checksum[0]);
set_bit(R5_Wantwrite, &sh->dev[disk_index].flags);
- ctx->meta_total_blocks += BLOCK_SECTORS;
} else {
disk_index = sh->pd_idx;
- sync_page_io(log->rdev, *log_offset, PAGE_SIZE,
+ sync_page_io(log->rdev, log_offset, PAGE_SIZE,
sh->dev[disk_index].page, REQ_OP_READ, 0,
false);
sh->dev[disk_index].log_checksum =
if (sh->qd_idx >= 0) {
disk_index = sh->qd_idx;
sync_page_io(log->rdev,
- r5l_ring_add(log, *log_offset, BLOCK_SECTORS),
+ r5l_ring_add(log, log_offset, BLOCK_SECTORS),
PAGE_SIZE, sh->dev[disk_index].page,
REQ_OP_READ, 0, false);
sh->dev[disk_index].log_checksum =
set_bit(R5_Wantwrite,
&sh->dev[disk_index].flags);
}
- ctx->meta_total_blocks += BLOCK_SECTORS * conf->max_degraded;
}
- *log_offset = r5l_ring_add(log, *log_offset,
- le32_to_cpu(payload->size));
+ ctx->meta_total_blocks += le32_to_cpu(payload->size);
*offset += sizeof(struct r5l_payload_data_parity) +
sizeof(__le32) *
(le32_to_cpu(payload->size) >> (PAGE_SHIFT - 9));
struct r5l_payload_data_parity *payload;
struct r5l_meta_block *mb;
int offset;
- sector_t log_offset;
sector_t stripe_sector;
mb = page_address(ctx->meta_page);
offset = sizeof(struct r5l_meta_block);
- log_offset = r5l_ring_add(log, ctx->pos, BLOCK_SECTORS);
while (offset < le32_to_cpu(mb->meta_size)) {
int dd;
stripe_sector = raid5_compute_sector(conf,
le64_to_cpu(payload->location), 0, &dd, NULL);
if (r5l_recovery_flush_one_stripe(log, ctx, stripe_sector,
- &offset, &log_offset))
+ &offset))
return -EINVAL;
}
return 0;