Skip to content

Commit

Permalink
---
Browse files Browse the repository at this point in the history
yaml
---
r: 230681
b: refs/heads/master
c: f521f07
h: refs/heads/master
i:
  230679: 037cf60
v: v3
  • Loading branch information
Tejun Heo authored and Alasdair G Kergon committed Jan 13, 2011
1 parent 8c45d78 commit 6c21fac
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 21 deletions.
2 changes: 1 addition & 1 deletion [refs]
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
---
refs/heads/master: d5ffa387e24646cb1cb55d80fd0f182a00e0edb7
refs/heads/master: f521f074abe7b3990f5df65482cdc3d851b80665
27 changes: 7 additions & 20 deletions trunk/drivers/md/dm-stripe.c
Original file line number Diff line number Diff line change
Expand Up @@ -39,23 +39,20 @@ struct stripe_c {
struct dm_target *ti;

/* Work struct used for triggering events*/
struct work_struct kstriped_ws;
struct work_struct trigger_event;

struct stripe stripe[0];
};

static struct workqueue_struct *kstriped;

/*
* An event is triggered whenever a drive
* drops out of a stripe volume.
*/
static void trigger_event(struct work_struct *work)
{
struct stripe_c *sc = container_of(work, struct stripe_c, kstriped_ws);

struct stripe_c *sc = container_of(work, struct stripe_c,
trigger_event);
dm_table_event(sc->ti->table);

}

static inline struct stripe_c *alloc_context(unsigned int stripes)
Expand Down Expand Up @@ -160,7 +157,7 @@ static int stripe_ctr(struct dm_target *ti, unsigned int argc, char **argv)
return -ENOMEM;
}

INIT_WORK(&sc->kstriped_ws, trigger_event);
INIT_WORK(&sc->trigger_event, trigger_event);

/* Set pointer to dm target; used in trigger_event */
sc->ti = ti;
Expand Down Expand Up @@ -211,7 +208,7 @@ static void stripe_dtr(struct dm_target *ti)
for (i = 0; i < sc->stripes; i++)
dm_put_device(ti, sc->stripe[i].dev);

flush_workqueue(kstriped);
flush_work_sync(&sc->trigger_event);
kfree(sc);
}

Expand Down Expand Up @@ -367,7 +364,7 @@ static int stripe_end_io(struct dm_target *ti, struct bio *bio,
atomic_inc(&(sc->stripe[i].error_count));
if (atomic_read(&(sc->stripe[i].error_count)) <
DM_IO_ERROR_THRESHOLD)
queue_work(kstriped, &sc->kstriped_ws);
schedule_work(&sc->trigger_event);
}

return error;
Expand Down Expand Up @@ -401,7 +398,7 @@ static void stripe_io_hints(struct dm_target *ti,

static struct target_type stripe_target = {
.name = "striped",
.version = {1, 3, 0},
.version = {1, 3, 1},
.module = THIS_MODULE,
.ctr = stripe_ctr,
.dtr = stripe_dtr,
Expand All @@ -422,20 +419,10 @@ int __init dm_stripe_init(void)
return r;
}

kstriped = create_singlethread_workqueue("kstriped");
if (!kstriped) {
DMERR("failed to create workqueue kstriped");
dm_unregister_target(&stripe_target);
return -ENOMEM;
}

return r;
}

void dm_stripe_exit(void)
{
dm_unregister_target(&stripe_target);
destroy_workqueue(kstriped);

return;
}

0 comments on commit 6c21fac

Please sign in to comment.