Skip to content

Commit

Permalink
---
Browse files Browse the repository at this point in the history
yaml
---
r: 1029
b: refs/heads/master
c: c557308
h: refs/heads/master
i:
  1027: 1e42914
v: v3
  • Loading branch information
Alasdair G Kergon authored and Linus Torvalds committed May 5, 2005
1 parent fdc3e70 commit 159f9c6
Show file tree
Hide file tree
Showing 2 changed files with 23 additions and 11 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: b84b0287a8ba618568a8bc9ac8847ac332abe90d
refs/heads/master: c557308e1f4b6f7d6144a06e8f98c467814f3aed
32 changes: 22 additions & 10 deletions trunk/drivers/md/dm-mpath.c
Original file line number Diff line number Diff line change
Expand Up @@ -101,6 +101,7 @@ typedef int (*action_fn) (struct pgpath *pgpath);

static kmem_cache_t *_mpio_cache;

struct workqueue_struct *kmultipathd;
static void process_queued_ios(void *data);
static void trigger_event(void *data);

Expand Down Expand Up @@ -308,7 +309,7 @@ static int map_io(struct multipath *m, struct bio *bio, struct mpath_io *mpio,
bio_list_add(&m->queued_ios, bio);
m->queue_size++;
if (m->pg_init_required || !m->queue_io)
schedule_work(&m->process_queued_ios);
queue_work(kmultipathd, &m->process_queued_ios);
pgpath = NULL;
r = 0;
} else if (!pgpath)
Expand All @@ -334,7 +335,7 @@ static int queue_if_no_path(struct multipath *m, unsigned queue_if_no_path)

m->queue_if_no_path = queue_if_no_path;
if (!m->queue_if_no_path)
schedule_work(&m->process_queued_ios);
queue_work(kmultipathd, &m->process_queued_ios);

spin_unlock_irqrestore(&m->lock, flags);

Expand Down Expand Up @@ -800,7 +801,7 @@ static int fail_path(struct pgpath *pgpath)
if (pgpath == m->current_pgpath)
m->current_pgpath = NULL;

schedule_work(&m->trigger_event);
queue_work(kmultipathd, &m->trigger_event);

out:
spin_unlock_irqrestore(&m->lock, flags);
Expand Down Expand Up @@ -837,9 +838,9 @@ static int reinstate_path(struct pgpath *pgpath)

m->current_pgpath = NULL;
if (!m->nr_valid_paths++)
schedule_work(&m->process_queued_ios);
queue_work(kmultipathd, &m->process_queued_ios);

schedule_work(&m->trigger_event);
queue_work(kmultipathd, &m->trigger_event);

out:
spin_unlock_irqrestore(&m->lock, flags);
Expand Down Expand Up @@ -883,7 +884,7 @@ static void bypass_pg(struct multipath *m, struct priority_group *pg,

spin_unlock_irqrestore(&m->lock, flags);

schedule_work(&m->trigger_event);
queue_work(kmultipathd, &m->trigger_event);
}

/*
Expand Down Expand Up @@ -913,7 +914,7 @@ static int switch_pg_num(struct multipath *m, const char *pgstr)
}
spin_unlock_irqrestore(&m->lock, flags);

schedule_work(&m->trigger_event);
queue_work(kmultipathd, &m->trigger_event);
return 0;
}

Expand Down Expand Up @@ -968,7 +969,7 @@ void dm_pg_init_complete(struct path *path, unsigned err_flags)
m->current_pgpath = NULL;
m->current_pg = NULL;
}
schedule_work(&m->process_queued_ios);
queue_work(kmultipathd, &m->process_queued_ios);
spin_unlock_irqrestore(&m->lock, flags);
}

Expand Down Expand Up @@ -1018,7 +1019,7 @@ static int do_end_io(struct multipath *m, struct bio *bio,
bio_list_add(&m->queued_ios, bio);
m->queue_size++;
if (!m->queue_io)
schedule_work(&m->process_queued_ios);
queue_work(kmultipathd, &m->process_queued_ios);
spin_unlock(&m->lock);

return 1; /* io not complete */
Expand Down Expand Up @@ -1057,7 +1058,7 @@ static void multipath_presuspend(struct dm_target *ti)
spin_lock_irqsave(&m->lock, flags);
m->suspended = 1;
if (m->queue_if_no_path)
schedule_work(&m->process_queued_ios);
queue_work(kmultipathd, &m->process_queued_ios);
spin_unlock_irqrestore(&m->lock, flags);
}

Expand Down Expand Up @@ -1274,6 +1275,15 @@ static int __init dm_multipath_init(void)
return -EINVAL;
}

kmultipathd = create_workqueue("kmpathd");
if (!kmultipathd) {
DMERR("%s: failed to create workqueue kmpathd",
multipath_target.name);
dm_unregister_target(&multipath_target);
kmem_cache_destroy(_mpio_cache);
return -ENOMEM;
}

DMINFO("dm-multipath version %u.%u.%u loaded",
multipath_target.version[0], multipath_target.version[1],
multipath_target.version[2]);
Expand All @@ -1285,6 +1295,8 @@ static void __exit dm_multipath_exit(void)
{
int r;

destroy_workqueue(kmultipathd);

r = dm_unregister_target(&multipath_target);
if (r < 0)
DMERR("%s: target unregister failed %d",
Expand Down

0 comments on commit 159f9c6

Please sign in to comment.