diff mbox series

[3/7] block: Fix get_task_ioprio() default return value

Message ID 20181119035131.11255-4-damien.lemoal@wdc.com (mailing list archive)
State New, archived
Headers show
Series Improve I/O priority handling | expand

Commit Message

Damien Le Moal Nov. 19, 2018, 3:51 a.m. UTC
As explained in ioprio_get() and ionice man pages, the default I/O
priority class for processes which have not set an I/O priority using
ioprio_set() is IOPRIO_CLASS_BE and not IOPRIO_CLASS_NONE.

Signed-off-by: Damien Le Moal <damien.lemoal@wdc.com>
---
 block/ioprio.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

Comments

Christoph Hellwig Nov. 19, 2018, 8:16 a.m. UTC | #1
On Mon, Nov 19, 2018 at 12:51:27PM +0900, Damien Le Moal wrote:
> As explained in ioprio_get() and ionice man pages, the default I/O
> priority class for processes which have not set an I/O priority using
> ioprio_set() is IOPRIO_CLASS_BE and not IOPRIO_CLASS_NONE.

While this matches the documentation, we've returned the current
values for 10 years, and before that plain 0 without any ioprio
magic.  It might be safer to just fix the documentation.
Damien Le Moal Nov. 20, 2018, 1:47 a.m. UTC | #2
On Mon, 2018-11-19 at 00:16 -0800, Christoph Hellwig wrote:
> On Mon, Nov 19, 2018 at 12:51:27PM +0900, Damien Le Moal wrote:
> > As explained in ioprio_get() and ionice man pages, the default I/O
> > priority class for processes which have not set an I/O priority
> > using
> > ioprio_set() is IOPRIO_CLASS_BE and not IOPRIO_CLASS_NONE.
> 
> While this matches the documentation, we've returned the current
> values for 10 years, and before that plain 0 without any ioprio
> magic.  It might be safer to just fix the documentation.

OK. Will send a patch to fix the man pages.
diff mbox series

Patch

diff --git a/block/ioprio.c b/block/ioprio.c
index f9821080c92c..ea5be206eb26 100644
--- a/block/ioprio.c
+++ b/block/ioprio.c
@@ -163,7 +163,7 @@  static int get_task_ioprio(struct task_struct *p)
 	ret = security_task_getioprio(p);
 	if (ret)
 		goto out;
-	ret = IOPRIO_PRIO_VALUE(IOPRIO_CLASS_NONE, IOPRIO_NORM);
+	ret = IOPRIO_PRIO_VALUE(IOPRIO_CLASS_BE, IOPRIO_NORM);
 	task_lock(p);
 	if (p->io_context)
 		ret = p->io_context->ioprio;