In userspace I can just echo noop > /sys/block/sda/queue/scheduler
.
How to do the same inside a kernel module?
I expect something like this (pseudocode):
struct dentry* e = sysfs_get_root();
vfs_path_lookup(e, ????, "block/sda/queue/scheduler", ???);
????;
struct something* q = ????;
????->store(q, "noop", 1);
/* some cleanup */
How to implement it properly?
My kernel module just registers SysRQ handler and should configure the io scheduler when that SysRQ is triggered (userspace programs can be hung at that time because of the bad io-scheduler)