linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH 2/3] block cleanups: Add kconfig default iosched submenu
@ 2005-09-27 22:20 Nate Diller
  2005-09-27 22:41 ` Jens Axboe
  0 siblings, 1 reply; 4+ messages in thread
From: Nate Diller @ 2005-09-27 22:20 UTC (permalink / raw)
  To: axboe, akpm; +Cc: linux-kernel

Add a kconfig submenu to select the default I/O scheduler, in case anticipatory is not compiled 
in or another default is preferred.  Also, since no-op is always available, we should use it 
whenever the selected default is not.

I saw a patch recently to add this option, and I don't think it got picked up.  This version is 
cleaner, since it eliminates all the #ifdef's in the code itself.

Thanks

NATE

Signed-off-by: Nate Diller <nate@namesys.com>

---

  Kconfig.iosched |   28 ++++++++++++++++++++++++++++
  elevator.c      |   24 +++++++++---------------
  2 files changed, 37 insertions(+), 15 deletions(-)

diff -urpN a/drivers/block/elevator.c b/drivers/block/elevator.c
--- a/drivers/block/elevator.c	2005-09-26 19:17:59.000000000 -0700
+++ b/drivers/block/elevator.c	2005-09-27 11:05:15.000000000 -0700
@@ -153,23 +153,17 @@ static char chosen_elevator[16];

  static void elevator_setup_default(void)
  {
-	/*
-	 * check if default is set and exists
+	/*
+	 * If default has not been set, use the compiled-in selection.
  	 */
-	if (chosen_elevator[0] && elevator_find(chosen_elevator))
-		return;
+	if (!chosen_elevator[0])
+		strcpy(chosen_elevator, CONFIG_DEFAULT_IOSCHED);

-#if defined(CONFIG_IOSCHED_AS)
-	strcpy(chosen_elevator, "anticipatory");
-#elif defined(CONFIG_IOSCHED_DEADLINE)
-	strcpy(chosen_elevator, "deadline");
-#elif defined(CONFIG_IOSCHED_CFQ)
-	strcpy(chosen_elevator, "cfq");
-#elif defined(CONFIG_IOSCHED_NOOP)
-	strcpy(chosen_elevator, "noop");
-#else
-#error "You must build at least 1 IO scheduler into the kernel"
-#endif
+	/*
+	 * If the given scheduler is not available, fall back to no-op.
+	 */
+	if (!elevator_find(chosen_elevator))
+		strcpy(chosen_elevator, "noop");
  }

  static int __init elevator_setup(char *str)
diff -urpN a/drivers/block/Kconfig.iosched b/drivers/block/Kconfig.iosched
--- a/drivers/block/Kconfig.iosched	2005-08-28 16:41:01.000000000 -0700
+++ b/drivers/block/Kconfig.iosched	2005-09-26 20:14:06.000000000 -0700
@@ -38,4 +28,32 @@ config IOSCHED_CFQ
  	  among all processes in the system. It should provide a fair
  	  working environment, suitable for desktop systems.

+choice
+	prompt "Default I/O scheduler"
+	default DEFAULT_AS
+	help
+	  Select the I/O scheduler which will be used by default for all
+	  block devices.
+
+	config DEFAULT_AS
+		bool "Anticipatory" if IOSCHED_AS
+
+	config DEFAULT_DEADLINE
+		bool "Deadline" if IOSCHED_DEADLINE
+
+	config DEFAULT_CFQ
+		bool "CFQ" if IOSCHED_CFQ
+
+	config DEFAULT_NOOP
+		bool "No-op"
+
+endchoice
+
+config DEFAULT_IOSCHED
+	string
+	default "anticipatory" if DEFAULT_AS
+	default "deadline" if DEFAULT_DEADLINE
+	default "cfq" if DEFAULT_CFQ
+	default "noop" if DEFAULT_NOOP
+
  endmenu

^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: [PATCH 2/3] block cleanups: Add kconfig default iosched submenu
  2005-09-27 22:20 [PATCH 2/3] block cleanups: Add kconfig default iosched submenu Nate Diller
@ 2005-09-27 22:41 ` Jens Axboe
  2005-09-28  0:25   ` Nate Diller
  0 siblings, 1 reply; 4+ messages in thread
From: Jens Axboe @ 2005-09-27 22:41 UTC (permalink / raw)
  To: Nate Diller; +Cc: akpm, linux-kernel

On Tue, Sep 27 2005, Nate Diller wrote:
> Add a kconfig submenu to select the default I/O scheduler, in case 
> anticipatory is not compiled in or another default is preferred.  Also, 
> since no-op is always available, we should use it whenever the selected 
> default is not.
> 
> I saw a patch recently to add this option, and I don't think it got picked 
> up.  This version is cleaner, since it eliminates all the #ifdef's in the 
> code itself.

Can you rebase this against latest -mm, it has the other patch you
mentioned applied (in a more cleaned up version)? Thanks.

-- 
Jens Axboe


^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: [PATCH 2/3] block cleanups: Add kconfig default iosched submenu
  2005-09-27 22:41 ` Jens Axboe
@ 2005-09-28  0:25   ` Nate Diller
  2005-09-28  0:30     ` Andrew Morton
  0 siblings, 1 reply; 4+ messages in thread
From: Nate Diller @ 2005-09-28  0:25 UTC (permalink / raw)
  To: Jens Axboe; +Cc: akpm, linux-kernel

Jens Axboe wrote:
> On Tue, Sep 27 2005, Nate Diller wrote:
> 
>>Add a kconfig submenu to select the default I/O scheduler, in case 
>>anticipatory is not compiled in or another default is preferred.  Also, 
>>since no-op is always available, we should use it whenever the selected 
>>default is not.
>>
>>I saw a patch recently to add this option, and I don't think it got picked 
>>up.  This version is cleaner, since it eliminates all the #ifdef's in the 
>>code itself.
> 
> 
> Can you rebase this against latest -mm, it has the other patch you
> mentioned applied (in a more cleaned up version)? Thanks.
> 
The latest -mm on kernel.org seems to be 2.6.14-rc2-mm1, and the other patch does not seem to be 
included in that.  Is there a git tree I should be patching against?

Thanks

NATE

^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: [PATCH 2/3] block cleanups: Add kconfig default iosched submenu
  2005-09-28  0:25   ` Nate Diller
@ 2005-09-28  0:30     ` Andrew Morton
  0 siblings, 0 replies; 4+ messages in thread
From: Andrew Morton @ 2005-09-28  0:30 UTC (permalink / raw)
  To: Nate Diller; +Cc: axboe, linux-kernel

Nate Diller <nate@namesys.com> wrote:
>
> Jens Axboe wrote:
> > On Tue, Sep 27 2005, Nate Diller wrote:
> > 
> >>Add a kconfig submenu to select the default I/O scheduler, in case 
> >>anticipatory is not compiled in or another default is preferred.  Also, 
> >>since no-op is always available, we should use it whenever the selected 
> >>default is not.
> >>
> >>I saw a patch recently to add this option, and I don't think it got picked 
> >>up.  This version is cleaner, since it eliminates all the #ifdef's in the 
> >>code itself.
> > 
> > 
> > Can you rebase this against latest -mm, it has the other patch you
> > mentioned applied (in a more cleaned up version)? Thanks.
> > 
> The latest -mm on kernel.org seems to be 2.6.14-rc2-mm1, and the other patch does not seem to be 
> included in that.  Is there a git tree I should be patching against?
> 

I'll sort it out.

^ permalink raw reply	[flat|nested] 4+ messages in thread

end of thread, other threads:[~2005-09-28  0:31 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2005-09-27 22:20 [PATCH 2/3] block cleanups: Add kconfig default iosched submenu Nate Diller
2005-09-27 22:41 ` Jens Axboe
2005-09-28  0:25   ` Nate Diller
2005-09-28  0:30     ` Andrew Morton

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).