md: req/comp logic for async expand operations
PATCH 9/12 md: req/comp logic for async expand operations
Support for expanding RAID-6 stripes asynchronously.
By setting STRIPE_OP_POSTXOR without setting STRIPE_OP_BIODRAIN the
completion path in handle stripe can differentiate expand operations from normal write operations.
Signed-off-by Yuri Tikhonov <[email protected]>
Signed-off-by Mikhail Cherkashin <[email protected]>
--
drivers/md/raid5.c +22 -9
@@ -4024,19 +4024,32 @@ static void handle_stripe6(struct stripe_head *sh) } } -if (s.expanded &&test_bit (STRIPE_QUEUE_EXPANDING , &sq->state)) { +/* Finish postxor operations initiated by the expansion +* process +*/ +if (test_bit (STRIPE_OP_POSTXOR , &sh->ops.complete) && + !test_bit (STRIPE_OP_BIODRAIN , &sh->ops.pending)) { +clear_bit (STRIPE_QUEUE_EXPANDING , &sq->state); +clear_bit (STRIPE_OP_POSTXOR , &sh->ops.pending); +clear_bit (STRIPE_OP_POSTXOR , &sh->ops.ack); +clear_bit (STRIPE_OP_POSTXOR , &sh->ops.complete); + +for (i = conf->raid_disks; i--; ) { +set_bit (R5_Wantwrite, &sh->dev[i].flags); +if (!test_and_set_bit (STRIPE_OP_IO , &sh->ops.pending)) + sh->ops.count++; + } + } + +if (s.expanded &&test_bit (STRIPE_QUEUE_EXPANDING , &sq->state) && + !test_bit (STRIPE_OP_POSTXOR , &sh->ops.pending)) {/* Need to write out all blocks after computing P&Q */ sq->disks = conf->raid_disks; sq->pd_idx =stripe_to_pdidx (sh->sector, conf, conf->raid_disks); -compute_parity6 (sh,RECONSTRUCT_WRITE ); -for (i = conf->raid_disks ; i-- ; ) { -set_bit (R5_LOCKED , &sh->dev[i].flags); - s.locked++; -set_bit (R5_Wantwrite, &sh->dev[i].flags); - } -clear_bit (STRIPE_QUEUE_EXPANDING , &sq->state); - }else if (s.expanded) { + s.locked +=handle_write_operations (sh,0 ,1 ); + }else if (s.expanded && + !test_bit (STRIPE_OP_POSTXOR , &sh->ops.pending)) {clear_bit (STRIPE_EXPAND_READY , &sh->state);atomic_dec (&conf->reshape_stripes);wake_up (&conf->wait_for_overlap);
Signature · 2 lines
Yuri Tikhonov, Senior Software Engineer Emcraft Systems, www.emcraft.com