public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
From: Sebastian Herbszt <herbszt@gmx.de>
To: linux-kernel@vger.kernel.org
Cc: Jens Axboe <axboe@kernel.dk>, Sebastian Herbszt <herbszt@gmx.de>
Subject: blk-mq: should elv_iosched_store return ENXIO/EINVAL?
Date: Wed, 31 Dec 2014 00:37:26 +0100	[thread overview]
Message-ID: <20141231003726.00002588@localhost> (raw)

Hello,

setting an invalid elevator without blk-mq results in an error:

# cat /sys/block/sda/queue/scheduler
noop deadline [cfq]
# echo foo > /sys/block/sda/queue/scheduler
-bash: echo: write error: Invalid argument
# dmesg
[  328.767088] elevator: type foo not found
[  328.767097] elevator: switch to foo
 failed

With blk-mq no error is returned:

# cat /sys/block/sda/queue/scheduler
none
# echo foo > /sys/block/sda/queue/scheduler
# echo $?
0


block/elevator.c got

 988 ssize_t elv_iosched_store(struct request_queue *q, const char *name,
 989                           size_t count)
 990 {
 991         int ret;
 992
 993         if (!q->elevator)
 994                 return count;
 995
 996         ret = __elevator_change(q, name);

and

 952 static int __elevator_change(struct request_queue *q, const char *name)
 953 {
 954         char elevator_name[ELV_NAME_MAX];
 955         struct elevator_type *e;
 956
 957         if (!q->elevator)
 958                 return -ENXIO;
 959
 960         strlcpy(elevator_name, name, sizeof(elevator_name));
 961         e = elevator_get(strstrip(elevator_name), true);
 962         if (!e) {
 963                 printk(KERN_ERR "elevator: type %s not found\n", elevator_name);
 964                 return -EINVAL;
 965         }


So !q->elevator is checked in elv_iosched_store and __elevator_change.

Should elv_iosched_store return ENXIO or EINVAL or should __elevator_change
handle this?

Sebastian

             reply	other threads:[~2014-12-30 23:37 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2014-12-30 23:37 Sebastian Herbszt [this message]
2014-12-31  1:49 ` blk-mq: should elv_iosched_store return ENXIO/EINVAL? Jens Axboe

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20141231003726.00002588@localhost \
    --to=herbszt@gmx.de \
    --cc=axboe@kernel.dk \
    --cc=linux-kernel@vger.kernel.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox