Skip to content

Commit

Permalink
md: use stripe_head_state in ops_run_io()
Browse files Browse the repository at this point in the history
From: Dan Williams <dan.j.williams@intel.com>

In handle_stripe after taking sh->lock we sample some bits into 's' (struct
stripe_head_state):

	s.syncing = test_bit(STRIPE_SYNCING, &sh->state);
	s.expanding = test_bit(STRIPE_EXPAND_SOURCE, &sh->state);
	s.expanded = test_bit(STRIPE_EXPAND_READY, &sh->state);

Use these values from 's' in ops_run_io() rather than re-sampling the bits.
This ensures a consistent snapshot (as seen under sh->lock) is used.

Signed-off-by: Dan Williams <dan.j.williams@intel.com>
Signed-off-by: Neil Brown <neilb@suse.de>
  • Loading branch information
Dan Williams authored and Neil Brown committed Jun 27, 2008
1 parent 2b7497f commit c4e5ac0
Showing 1 changed file with 3 additions and 6 deletions.
9 changes: 3 additions & 6 deletions drivers/md/raid5.c
Original file line number Diff line number Diff line change
Expand Up @@ -390,7 +390,7 @@ raid5_end_read_request(struct bio *bi, int error);
static void
raid5_end_write_request(struct bio *bi, int error);

static void ops_run_io(struct stripe_head *sh)
static void ops_run_io(struct stripe_head *sh, struct stripe_head_state *s)
{
raid5_conf_t *conf = sh->raid_conf;
int i, disks = sh->disks;
Expand Down Expand Up @@ -425,9 +425,7 @@ static void ops_run_io(struct stripe_head *sh)
rcu_read_unlock();

if (rdev) {
if (test_bit(STRIPE_SYNCING, &sh->state) ||
test_bit(STRIPE_EXPAND_SOURCE, &sh->state) ||
test_bit(STRIPE_EXPAND_READY, &sh->state))
if (s->syncing || s->expanding || s->expanded)
md_sync_acct(rdev->bdev, STRIPE_SECTORS);

set_bit(STRIPE_IO_STARTED, &sh->state);
Expand Down Expand Up @@ -2902,10 +2900,9 @@ static void handle_stripe5(struct stripe_head *sh)
if (pending)
raid5_run_ops(sh, pending);

ops_run_io(sh);
ops_run_io(sh, &s);

return_io(return_bi);

}

static void handle_stripe6(struct stripe_head *sh, struct page *tmp_page)
Expand Down

0 comments on commit c4e5ac0

Please sign in to comment.