linux-raid.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [md-raid6-accel PATCH 09/12] md: req/comp logic for async expand operations
@ 2007-12-04 11:36 Yuri Tikhonov
  0 siblings, 0 replies; only message in thread
From: Yuri Tikhonov @ 2007-12-04 11:36 UTC (permalink / raw)
  To: Williams, Dan J; +Cc: Neil Brown, Wolfgang Denk, Detlev Zundel, linux-raid

 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 <yur@emcraft.com>
 Signed-off-by: Mikhail Cherkashin <mike@emcraft.com>
--
diff --git a/drivers/md/raid5.c b/drivers/md/raid5.c
index 88f7e06..9b4db93 100644
--- a/drivers/md/raid5.c
+++ b/drivers/md/raid5.c
@@ -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);

-- 
Yuri Tikhonov, Senior Software Engineer
Emcraft Systems, www.emcraft.com

^ permalink raw reply related	[flat|nested] only message in thread

only message in thread, other threads:[~2007-12-04 11:36 UTC | newest]

Thread overview: (only message) (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2007-12-04 11:36 [md-raid6-accel PATCH 09/12] md: req/comp logic for async expand operations Yuri Tikhonov

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).