Lines Matching defs:holder

464  * @holder: holder trying to claim @bdev
465 * @hops: holder ops
467 * Test whether @bdev can be claimed by @holder.
472 static bool bd_may_claim(struct block_device *bdev, void *holder,
481 * The same holder can always re-claim.
483 if (bdev->bd_holder == holder) {
492 * If the whole devices holder is set to bd_may_claim, a partition on
504 * @holder: holder trying to claim @bdev
505 * @hops: holder ops.
508 * holder and waits if another claiming is in progress. return, the caller
514 int bd_prepare_to_claim(struct block_device *bdev, void *holder,
519 if (WARN_ON_ONCE(!holder))
524 if (!bd_may_claim(bdev, holder, hops)) {
542 whole->bd_claiming = holder;
548 static void bd_clear_claiming(struct block_device *whole, void *holder)
552 BUG_ON(whole->bd_claiming != holder);
560 * @holder: holder that has claimed @bdev
561 * @hops: block device holder operations
564 * open by the holder and wake up all waiters for exclusive open to finish.
566 static void bd_finish_claiming(struct block_device *bdev, void *holder,
572 BUG_ON(!bd_may_claim(bdev, holder, hops));
575 * and bd_holder will be set to bd_may_claim before being set to holder
581 bdev->bd_holder = holder;
584 bd_clear_claiming(whole, holder);
591 * @holder: holder that has claimed @bdev
597 void bd_abort_claiming(struct block_device *bdev, void *holder)
600 bd_clear_claiming(bdev_whole(bdev), holder);
605 static void bd_end_claim(struct block_device *bdev, void *holder)
611 * Release a claim on the device. The holder fields are protected with
615 WARN_ON_ONCE(bdev->bd_holder != holder);
631 * If this was the last claim, remove holder link and unblock evpoll if
632 * it was a write holder.
714 int bdev_permission(dev_t dev, blk_mode_t mode, void *holder)
726 if (mode & BLK_OPEN_RESTRICT_WRITES && !holder)
733 if (WARN_ON_ONCE(IS_ERR(holder)))
845 * @holder: exclusive holder identifier
846 * @hops: holder operations
849 * Open the block device. If @holder is not %NULL, the block device is opened
850 * with exclusive access. Exclusive opens may nest for the same @holder.
858 int bdev_open(struct block_device *bdev, blk_mode_t mode, void *holder,
865 if (holder) {
867 ret = bd_prepare_to_claim(bdev, holder, hops);
893 if (holder) {
894 bd_finish_claiming(bdev, holder, hops);
898 * holder makes the write_holder state stick until all are
922 bdev_file->private_data = holder;
928 if (holder)
929 bd_abort_claiming(bdev, holder);
965 struct file *bdev_file_open_by_dev(dev_t dev, blk_mode_t mode, void *holder,
973 ret = bdev_permission(dev, mode, holder);
990 ret = bdev_open(bdev, mode, holder, hops, bdev_file);
1002 void *holder,
1013 file = bdev_file_open_by_dev(dev, mode, holder, hops);
1028 void *holder = bdev_file->private_data;
1032 if (WARN_ON_ONCE(IS_ERR_OR_NULL(holder)))
1036 bd_end_claim(bdev, holder);
1042 void *holder = bdev_file->private_data;
1046 if (IS_ERR(holder))
1062 if (holder)