blk-cgroup.c (9c3a985f88fa4de82bf4bda906095ce6444e9039) blk-cgroup.c (a13bd91be22318768d55470cbc0b0f4488ef9edf)
1// SPDX-License-Identifier: GPL-2.0
2/*
3 * Common Block IO controller cgroup interface
4 *
5 * Based on ideas and code from CFQ, CFS and BFQ:
6 * Copyright (C) 2003 Jens Axboe <axboe@kernel.dk>
7 *
8 * Copyright (C) 2008 Fabio Checconi <fabio@gandalf.sssup.it>

--- 734 unchanged lines hidden (view full) ---

743 bdev = blkdev_get_no_open(MKDEV(major, minor));
744 if (!bdev)
745 return -ENODEV;
746 if (bdev_is_partition(bdev)) {
747 blkdev_put_no_open(bdev);
748 return -ENODEV;
749 }
750
1// SPDX-License-Identifier: GPL-2.0
2/*
3 * Common Block IO controller cgroup interface
4 *
5 * Based on ideas and code from CFQ, CFS and BFQ:
6 * Copyright (C) 2003 Jens Axboe <axboe@kernel.dk>
7 *
8 * Copyright (C) 2008 Fabio Checconi <fabio@gandalf.sssup.it>

--- 734 unchanged lines hidden (view full) ---

743 bdev = blkdev_get_no_open(MKDEV(major, minor));
744 if (!bdev)
745 return -ENODEV;
746 if (bdev_is_partition(bdev)) {
747 blkdev_put_no_open(bdev);
748 return -ENODEV;
749 }
750
751 mutex_lock(&bdev->bd_queue->rq_qos_mutex);
752 if (!disk_live(bdev->bd_disk)) {
753 blkdev_put_no_open(bdev);
754 mutex_unlock(&bdev->bd_queue->rq_qos_mutex);
755 return -ENODEV;
756 }
757
751 ctx->body = input;
752 ctx->bdev = bdev;
753 return 0;
754}
755
756/**
757 * blkg_conf_prep - parse and prepare for per-blkg config update
758 * @blkcg: target block cgroup

--- 128 unchanged lines hidden (view full) ---

887 * blkg_conf_exit - clean up per-blkg config update
888 * @ctx: blkg_conf_ctx initialized with blkg_conf_init()
889 *
890 * Clean up after per-blkg config update. This function must be called on all
891 * blkg_conf_ctx's initialized with blkg_conf_init().
892 */
893void blkg_conf_exit(struct blkg_conf_ctx *ctx)
894 __releases(&ctx->bdev->bd_queue->queue_lock)
758 ctx->body = input;
759 ctx->bdev = bdev;
760 return 0;
761}
762
763/**
764 * blkg_conf_prep - parse and prepare for per-blkg config update
765 * @blkcg: target block cgroup

--- 128 unchanged lines hidden (view full) ---

894 * blkg_conf_exit - clean up per-blkg config update
895 * @ctx: blkg_conf_ctx initialized with blkg_conf_init()
896 *
897 * Clean up after per-blkg config update. This function must be called on all
898 * blkg_conf_ctx's initialized with blkg_conf_init().
899 */
900void blkg_conf_exit(struct blkg_conf_ctx *ctx)
901 __releases(&ctx->bdev->bd_queue->queue_lock)
902 __releases(&ctx->bdev->bd_queue->rq_qos_mutex)
895{
896 if (ctx->blkg) {
897 spin_unlock_irq(&bdev_get_queue(ctx->bdev)->queue_lock);
898 ctx->blkg = NULL;
899 }
900
901 if (ctx->bdev) {
903{
904 if (ctx->blkg) {
905 spin_unlock_irq(&bdev_get_queue(ctx->bdev)->queue_lock);
906 ctx->blkg = NULL;
907 }
908
909 if (ctx->bdev) {
910 mutex_unlock(&ctx->bdev->bd_queue->rq_qos_mutex);
902 blkdev_put_no_open(ctx->bdev);
903 ctx->body = NULL;
904 ctx->bdev = NULL;
905 }
906}
907EXPORT_SYMBOL_GPL(blkg_conf_exit);
908
909static void blkg_iostat_set(struct blkg_iostat *dst, struct blkg_iostat *src)

--- 1195 unchanged lines hidden ---
911 blkdev_put_no_open(ctx->bdev);
912 ctx->body = NULL;
913 ctx->bdev = NULL;
914 }
915}
916EXPORT_SYMBOL_GPL(blkg_conf_exit);
917
918static void blkg_iostat_set(struct blkg_iostat *dst, struct blkg_iostat *src)

--- 1195 unchanged lines hidden ---