summaryrefslogtreecommitdiff
path: root/block/ioprio.c
diff options
context:
space:
mode:
authorChristoph Hellwig <hch@lst.de>2021-12-09 09:31:27 +0300
committerJens Axboe <axboe@kernel.dk>2021-12-16 20:59:01 +0300
commita411cd3cfdc5bbd1329d5b33dbf39e2b5213969d (patch)
tree19551602102daac1d756a057a77a5ffc9d685574 /block/ioprio.c
parent091abcb3efd71cb18e80c8f040d9e4a634d8906d (diff)
downloadlinux-a411cd3cfdc5bbd1329d5b33dbf39e2b5213969d.tar.xz
block: move set_task_ioprio to blk-ioc.c
Keep set_task_ioprio with the other low-level code that accesses the io_context structure. Signed-off-by: Christoph Hellwig <hch@lst.de> Reviewed-by: Jan Kara <jack@suse.cz> Link: https://lore.kernel.org/r/20211209063131.18537-8-hch@lst.de Signed-off-by: Jens Axboe <axboe@kernel.dk>
Diffstat (limited to 'block/ioprio.c')
-rw-r--r--block/ioprio.c32
1 files changed, 0 insertions, 32 deletions
diff --git a/block/ioprio.c b/block/ioprio.c
index 313c14a70bbd..e118f4bf2dc6 100644
--- a/block/ioprio.c
+++ b/block/ioprio.c
@@ -22,46 +22,14 @@
*/
#include <linux/gfp.h>
#include <linux/kernel.h>
-#include <linux/export.h>
#include <linux/ioprio.h>
#include <linux/cred.h>
#include <linux/blkdev.h>
#include <linux/capability.h>
-#include <linux/sched/user.h>
-#include <linux/sched/task.h>
#include <linux/syscalls.h>
#include <linux/security.h>
#include <linux/pid_namespace.h>
-int set_task_ioprio(struct task_struct *task, int ioprio)
-{
- int err;
- struct io_context *ioc;
- const struct cred *cred = current_cred(), *tcred;
-
- rcu_read_lock();
- tcred = __task_cred(task);
- if (!uid_eq(tcred->uid, cred->euid) &&
- !uid_eq(tcred->uid, cred->uid) && !capable(CAP_SYS_NICE)) {
- rcu_read_unlock();
- return -EPERM;
- }
- rcu_read_unlock();
-
- err = security_task_setioprio(task, ioprio);
- if (err)
- return err;
-
- ioc = get_task_io_context(task, GFP_ATOMIC, NUMA_NO_NODE);
- if (ioc) {
- ioc->ioprio = ioprio;
- put_io_context(ioc);
- }
-
- return err;
-}
-EXPORT_SYMBOL_GPL(set_task_ioprio);
-
int ioprio_check_cap(int ioprio)
{
int class = IOPRIO_PRIO_CLASS(ioprio);