Skip to content

Commit

Permalink
---
Browse files Browse the repository at this point in the history
yaml
---
r: 98883
b: refs/heads/master
c: 863fddc
h: refs/heads/master
i:
  98881: 2f9712f
  98879: f08a50b
v: v3
  • Loading branch information
Jens Axboe committed Jul 3, 2008
1 parent dd6429d commit df39ddd
Show file tree
Hide file tree
Showing 2 changed files with 16 additions and 4 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: 9a11b4ed0e7c44bca7c939aa544c3c47aae40c12
refs/heads/master: 863fddcb4b0caee4c2d5bd6e3b28779920516db3
18 changes: 15 additions & 3 deletions trunk/block/as-iosched.c
Original file line number Diff line number Diff line change
Expand Up @@ -151,6 +151,7 @@ enum arq_state {

static DEFINE_PER_CPU(unsigned long, ioc_count);
static struct completion *ioc_gone;
static DEFINE_SPINLOCK(ioc_gone_lock);

static void as_move_to_dispatch(struct as_data *ad, struct request *rq);
static void as_antic_stop(struct as_data *ad);
Expand All @@ -164,8 +165,19 @@ static void free_as_io_context(struct as_io_context *aic)
{
kfree(aic);
elv_ioc_count_dec(ioc_count);
if (ioc_gone && !elv_ioc_count_read(ioc_count))
complete(ioc_gone);
if (ioc_gone) {
/*
* AS scheduler is exiting, grab exit lock and check
* the pending io context count. If it hits zero,
* complete ioc_gone and set it back to NULL.
*/
spin_lock(&ioc_gone_lock);
if (ioc_gone && !elv_ioc_count_read(ioc_count)) {
complete(ioc_gone);
ioc_gone = NULL;
}
spin_unlock(&ioc_gone_lock);
}
}

static void as_trim(struct io_context *ioc)
Expand Down Expand Up @@ -1493,7 +1505,7 @@ static void __exit as_exit(void)
/* ioc_gone's update must be visible before reading ioc_count */
smp_wmb();
if (elv_ioc_count_read(ioc_count))
wait_for_completion(ioc_gone);
wait_for_completion(&all_gone);
synchronize_rcu();
}

Expand Down

0 comments on commit df39ddd

Please sign in to comment.