diff options
author | Joe Thornber <ejt@redhat.com> | 2014-10-10 15:27:16 +0100 |
---|---|---|
committer | Mike Snitzer <snitzer@redhat.com> | 2014-11-10 15:25:28 -0500 |
commit | 2d759a46b4d65e1392843cf9df7101897af87008 (patch) | |
tree | 7cca57c04d5d8e29ca7ae232fa52f2e8fa6883c3 /drivers/md/dm-bio-prison.c | |
parent | a374bb217b449a00eb96d0584bb833a8b62b672a (diff) | |
download | op-kernel-dev-2d759a46b4d65e1392843cf9df7101897af87008.zip op-kernel-dev-2d759a46b4d65e1392843cf9df7101897af87008.tar.gz |
dm thin: remap the bios in a cell immediately
This use of direct submission in process_prepared_mapping() reduces
latency for submitting bios in a cell by avoiding adding those bios to
the deferred list and waiting for the next iteration of the worker.
But this direct submission exposes the potential for a race between
releasing a cell and incrementing deferred set. Fix this by introducing
dm_cell_visit_release() and refactoring inc_remap_and_issue_cell()
accordingly.
Signed-off-by: Joe Thornber <ejt@redhat.com>
Signed-off-by: Mike Snitzer <snitzer@redhat.com>
Diffstat (limited to 'drivers/md/dm-bio-prison.c')
-rw-r--r-- | drivers/md/dm-bio-prison.c | 14 |
1 files changed, 14 insertions, 0 deletions
diff --git a/drivers/md/dm-bio-prison.c b/drivers/md/dm-bio-prison.c index 90a5662..bbe22a5 100644 --- a/drivers/md/dm-bio-prison.c +++ b/drivers/md/dm-bio-prison.c @@ -241,6 +241,20 @@ void dm_cell_error(struct dm_bio_prison *prison, } EXPORT_SYMBOL_GPL(dm_cell_error); +void dm_cell_visit_release(struct dm_bio_prison *prison, + void (*visit_fn)(void *, struct dm_bio_prison_cell *), + void *context, + struct dm_bio_prison_cell *cell) +{ + unsigned long flags; + + spin_lock_irqsave(&prison->lock, flags); + visit_fn(context, cell); + rb_erase(&cell->node, &prison->cells); + spin_unlock_irqrestore(&prison->lock, flags); +} +EXPORT_SYMBOL_GPL(dm_cell_visit_release); + /*----------------------------------------------------------------*/ #define DEFERRED_SET_SIZE 64 |