X-Git-Url: https://gerrit.opnfv.org/gerrit/gitweb?a=blobdiff_plain;f=kernel%2Fdrivers%2Fmd%2Fdm-bio-prison.h;fp=kernel%2Fdrivers%2Fmd%2Fdm-bio-prison.h;h=54352f009bfd5ad3cf011896536c4aa5baee18c6;hb=e09b41010ba33a20a87472ee821fa407a5b8da36;hp=74cf01144b1fc9c12777f669e1cf6e5e23422d44;hpb=f93b97fd65072de626c074dbe099a1fff05ce060;p=kvmfornfv.git diff --git a/kernel/drivers/md/dm-bio-prison.h b/kernel/drivers/md/dm-bio-prison.h index 74cf01144..54352f009 100644 --- a/kernel/drivers/md/dm-bio-prison.h +++ b/kernel/drivers/md/dm-bio-prison.h @@ -101,6 +101,19 @@ 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); +/* + * Rather than always releasing the prisoners in a cell, the client may + * want to promote one of them to be the new holder. There is a race here + * though between releasing an empty cell, and other threads adding new + * inmates. So this function makes the decision with its lock held. + * + * This function can have two outcomes: + * i) An inmate is promoted to be the holder of the cell (return value of 0). + * ii) The cell has no inmate for promotion and is released (return value of 1). + */ +int dm_cell_promote_or_release(struct dm_bio_prison *prison, + struct dm_bio_prison_cell *cell); + /*----------------------------------------------------------------*/ /*