Lines Matching refs:bdev
146 static bool scm_permit_request(struct scm_blk_dev *bdev, struct request *req) in scm_permit_request() argument
148 return rq_data_dir(req) != WRITE || bdev->state != SCM_WR_PROHIBIT; in scm_permit_request()
181 struct scm_blk_dev *bdev = scmrq->bdev; in scm_request_prepare() local
182 struct scm_device *scmdev = bdev->gendisk->private_data; in scm_request_prepare()
218 static inline void scm_request_init(struct scm_blk_dev *bdev, in scm_request_init() argument
227 aobrq->scmdev = bdev->scmdev; in scm_request_init()
230 scmrq->bdev = bdev; in scm_request_init()
239 struct scm_blk_dev *bdev = scmrq->bdev; in scm_request_requeue() local
245 atomic_dec(&bdev->queued_reqs); in scm_request_requeue()
247 blk_mq_kick_requeue_list(bdev->rq); in scm_request_requeue()
252 struct scm_blk_dev *bdev = scmrq->bdev; in scm_request_finish() local
263 atomic_dec(&bdev->queued_reqs); in scm_request_finish()
269 struct scm_blk_dev *bdev = scmrq->bdev; in scm_request_start() local
271 atomic_inc(&bdev->queued_reqs); in scm_request_start()
287 struct scm_blk_dev *bdev = dev_get_drvdata(&scmdev->dev); in scm_blk_request() local
293 if (!scm_permit_request(bdev, req)) { in scm_blk_request()
306 scm_request_init(bdev, scmrq); in scm_blk_request()
374 struct scm_blk_dev *bdev = scmrq->bdev; in scm_blk_handle_error() local
383 spin_lock_irqsave(&bdev->lock, flags); in scm_blk_handle_error()
384 if (bdev->state != SCM_WR_PROHIBIT) in scm_blk_handle_error()
386 (unsigned long) bdev->scmdev->address); in scm_blk_handle_error()
387 bdev->state = SCM_WR_PROHIBIT; in scm_blk_handle_error()
388 spin_unlock_irqrestore(&bdev->lock, flags); in scm_blk_handle_error()
436 int scm_blk_dev_setup(struct scm_blk_dev *bdev, struct scm_device *scmdev) in scm_blk_dev_setup() argument
449 bdev->scmdev = scmdev; in scm_blk_dev_setup()
450 bdev->state = SCM_OPER; in scm_blk_dev_setup()
451 spin_lock_init(&bdev->lock); in scm_blk_dev_setup()
452 atomic_set(&bdev->queued_reqs, 0); in scm_blk_dev_setup()
454 bdev->tag_set.ops = &scm_mq_ops; in scm_blk_dev_setup()
455 bdev->tag_set.cmd_size = sizeof(blk_status_t); in scm_blk_dev_setup()
456 bdev->tag_set.nr_hw_queues = nr_requests; in scm_blk_dev_setup()
457 bdev->tag_set.queue_depth = nr_requests_per_io * nr_requests; in scm_blk_dev_setup()
458 bdev->tag_set.flags = BLK_MQ_F_SHOULD_MERGE; in scm_blk_dev_setup()
459 bdev->tag_set.numa_node = NUMA_NO_NODE; in scm_blk_dev_setup()
461 ret = blk_mq_alloc_tag_set(&bdev->tag_set); in scm_blk_dev_setup()
465 bdev->gendisk = blk_mq_alloc_disk(&bdev->tag_set, scmdev); in scm_blk_dev_setup()
466 if (IS_ERR(bdev->gendisk)) { in scm_blk_dev_setup()
467 ret = PTR_ERR(bdev->gendisk); in scm_blk_dev_setup()
470 rq = bdev->rq = bdev->gendisk->queue; in scm_blk_dev_setup()
480 bdev->gendisk->private_data = scmdev; in scm_blk_dev_setup()
481 bdev->gendisk->fops = &scm_blk_devops; in scm_blk_dev_setup()
482 bdev->gendisk->major = scm_major; in scm_blk_dev_setup()
483 bdev->gendisk->first_minor = devindex * SCM_NR_PARTS; in scm_blk_dev_setup()
484 bdev->gendisk->minors = SCM_NR_PARTS; in scm_blk_dev_setup()
486 len = snprintf(bdev->gendisk->disk_name, DISK_NAME_LEN, "scm"); in scm_blk_dev_setup()
488 len += snprintf(bdev->gendisk->disk_name + len, in scm_blk_dev_setup()
493 snprintf(bdev->gendisk->disk_name + len, DISK_NAME_LEN - len, "%c", in scm_blk_dev_setup()
497 set_capacity(bdev->gendisk, scmdev->size >> 9); in scm_blk_dev_setup()
498 ret = device_add_disk(&scmdev->dev, bdev->gendisk, NULL); in scm_blk_dev_setup()
505 put_disk(bdev->gendisk); in scm_blk_dev_setup()
507 blk_mq_free_tag_set(&bdev->tag_set); in scm_blk_dev_setup()
513 void scm_blk_dev_cleanup(struct scm_blk_dev *bdev) in scm_blk_dev_cleanup() argument
515 del_gendisk(bdev->gendisk); in scm_blk_dev_cleanup()
516 put_disk(bdev->gendisk); in scm_blk_dev_cleanup()
517 blk_mq_free_tag_set(&bdev->tag_set); in scm_blk_dev_cleanup()
520 void scm_blk_set_available(struct scm_blk_dev *bdev) in scm_blk_set_available() argument
524 spin_lock_irqsave(&bdev->lock, flags); in scm_blk_set_available()
525 if (bdev->state == SCM_WR_PROHIBIT) in scm_blk_set_available()
527 (unsigned long) bdev->scmdev->address); in scm_blk_set_available()
528 bdev->state = SCM_OPER; in scm_blk_set_available()
529 spin_unlock_irqrestore(&bdev->lock, flags); in scm_blk_set_available()