mirror of
https://github.com/edk2-porting/linux-next.git
synced 2024-12-22 12:14:01 +08:00
block: introduce blk_req_zone_write_trylock
Introduce blk_req_zone_write_trylock(), which either grabs the write-lock for a sequential zone or returns false, if the zone is already locked. Signed-off-by: Johannes Thumshirn <johannes.thumshirn@wdc.com> Reviewed-by: Christoph Hellwig <hch@lst.de> Reviewed-by: Hannes Reinecke <hare@suse.de> Reviewed-by: Martin K. Petersen <martin.petersen@oracle.com> Signed-off-by: Jens Axboe <axboe@kernel.dk>
This commit is contained in:
parent
0512a75b98
commit
1392d37018
@ -82,6 +82,20 @@ bool blk_req_needs_zone_write_lock(struct request *rq)
|
||||
}
|
||||
EXPORT_SYMBOL_GPL(blk_req_needs_zone_write_lock);
|
||||
|
||||
bool blk_req_zone_write_trylock(struct request *rq)
|
||||
{
|
||||
unsigned int zno = blk_rq_zone_no(rq);
|
||||
|
||||
if (test_and_set_bit(zno, rq->q->seq_zones_wlock))
|
||||
return false;
|
||||
|
||||
WARN_ON_ONCE(rq->rq_flags & RQF_ZONE_WRITE_LOCKED);
|
||||
rq->rq_flags |= RQF_ZONE_WRITE_LOCKED;
|
||||
|
||||
return true;
|
||||
}
|
||||
EXPORT_SYMBOL_GPL(blk_req_zone_write_trylock);
|
||||
|
||||
void __blk_req_zone_write_lock(struct request *rq)
|
||||
{
|
||||
if (WARN_ON_ONCE(test_and_set_bit(blk_rq_zone_no(rq),
|
||||
|
@ -1738,6 +1738,7 @@ extern int bdev_write_page(struct block_device *, sector_t, struct page *,
|
||||
|
||||
#ifdef CONFIG_BLK_DEV_ZONED
|
||||
bool blk_req_needs_zone_write_lock(struct request *rq);
|
||||
bool blk_req_zone_write_trylock(struct request *rq);
|
||||
void __blk_req_zone_write_lock(struct request *rq);
|
||||
void __blk_req_zone_write_unlock(struct request *rq);
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user