Thread (14 messages) 14 messages, 4 authors, 2023-03-30

Re: [PATCH 2/9] null_blk: check for valid submit_queue value

From: Chaitanya Kulkarni <hidden>
Date: 2023-03-30 19:02:03

I would do this:

+#define NULL_PARAM(_name, _min, _max)                                  \
+static int null_param_##_name##_set(const char *s,                     \
+                                   const struct kernel_param *kp)      \
+{                                                                      \
+       return null_param_store_int(s, kp->arg, _min, _max);            \
+}                                                                      \
+                                                                       \
+static const struct kernel_param_ops null_##_name##_param_ops = {      \
+       .set    = null_param_##_name##_set,                             \
+       .get    = param_get_int,                                        \
+}
+

And then have:

+NULL_PARAM(submit_queues, 1, INT_MAX);
+NULL_PARAM(poll_queues, 1, num_online_cpus());
+NULL_PARAM(queue_mode, NULL_Q_BIO, NULL_Q_MQ);
+NULL_PARAM(gb, 1, INT_MAX);
+NULL_PARAM(bs, 512, 4096);
+NULL_PARAM(max_sectors, 1, INT_MAX);
+NULL_PARAM(irqmode, NULL_IRQ_NONE, NULL_IRQ_TIMER);
+NULL_PARAM(hw_qdepth, 1, INT_MAX);

That can be done in a single patch and is overall a lot less code.
I did the same thing at first, however it doesn't allow us to print
the right module parameter specific error message which I
to add in this series especially for  where this patch limits it
nr_online_cpu().

let me send out V2 with right error messages ...

-ck

Keyboard shortcuts
hback out one level
jnext message in thread
kprevious message in thread
ldrill in
Escclose help / fold thread tree
?toggle this help