mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
* Patch against ll_rw_blk and blkdev.h in 2.2
@ 2001-05-31 15:04 COTTE
  0 siblings, 0 replies; only message in thread
From: COTTE @ 2001-05-31 15:04 UTC (permalink / raw)
  To: alan, linux-kernel

[-- Attachment #1: Type: text/plain, Size: 2015 bytes --]




Hello Alan, Hi list-readers!

I'd like to suggest a change to ll_rw_blk and blkdev.h in the 2.2-Kernel:

rational
-----
On mainframe architectures, we're running a large number of disks on a
System. Our disk-device-driver (dasd) has a static major number for the
first 64 disks and uses dynamicaly allocated ones for the rest.
In ll_rw_blk there are static allocated lists (CASE_COALESCE*) for majors
that support merging requests (including our static one DASD_MAJOR).
For the dynamic allocated majors, our requests do not get clustered which
leads to a major performance drop.

the patch
-------
I added a global int field named blk_merge_rule to blkdev.h, which contains
the device driver's  rule about merging. I did three definitions for this
variable: do not merge (the default), do merge, and merge but not the first
request (like for the static majors).
The device driver has to set this field for a major it uses and reset it
to BLK_MERGE_NEVER when freeing the major.
In ll_rw_blk I invented a case, which is taken if there is no static
setting
for the major. It then processes like set in blk_merge_rule.
If the device driver has a static setting for its major, it does'nt have to
care
about blk_merge_rule. If the device driverhas no static setting and does
not
set blk_merge_rule, the requests do not get merged (same as before).

I attached the patch (sorry, notes messes up white-spaces when embedding
stuff), it applies against 2.2.19. (See attached file: dyn_majors.diff)

What is your opinion about including it into the standard brach?
Why not change all block-dev-drivers so that they set blk_merge_rule and
throw out the CASE_COALESCE* stuff and simplify the code again?

mit freundlichem Gruß / with kind regards
Carsten Otte

IBM Deutschland Entwicklung GmbH
Linux for 390/zSeries Development - Device Driver Team
Phone: +49/07031/16-4076
IBM internal phone: *120-4076
--
We are Linux.
Resistance indicates that you're missing the point!

[-- Attachment #2: dyn_majors.diff --]
[-- Type: application/octet-stream, Size: 3207 bytes --]

Index: drivers/block/ll_rw_blk.c
===================================================================
RCS file: /home/cvs/linux/drivers/block/ll_rw_blk.c,v
retrieving revision 1.15
retrieving revision 1.17
diff -u -w -r1.15 -r1.17
--- drivers/block/ll_rw_blk.c	2001/03/28 11:38:49	1.15
+++ drivers/block/ll_rw_blk.c	2001/05/31 14:16:20	1.17
@@ -4,6 +4,7 @@
  * Copyright (C) 1991, 1992 Linus Torvalds
  * Copyright (C) 1994,      Karl Keyte: Added support for disk statistics
  * Elevator latency, (C) 2000  Andrea Arcangeli <andrea@suse.de> SuSE
+ * Merging for dyn. allocated majors, (C) 2001  Carsten Otte <cotte@de.ibm.com> IBM
  */
 
 /*
@@ -119,6 +120,12 @@
  */
 int * max_segments[MAX_BLKDEV];
 
+/*
+ * rule to merge requests for major
+ *
+ */
+int blk_merge_rule[MAX_BLKDEV];
+
 static inline int get_max_sectors(kdev_t dev)
 {
 	if (!max_sectors[MAJOR(dev)])
@@ -578,6 +585,7 @@
 	int rw_ahead, max_req, max_sectors, max_segments;
 	unsigned long flags;
 	int back, front;
+	int skip_first_req;
 
 	count = bh->b_size >> 9;
 	sector = bh->b_rsector;
@@ -660,12 +668,29 @@
 	 */
 	spin_lock_irqsave(&io_request_lock,flags);
 	req = *get_queue(bh->b_rdev);
+        /*
+	 * Do not skip merging first request in queue 
+	 */
+	skip_first_req = 0;
 	if (!req) {
 		/* MD and loop can't handle plugging without deadlocking */
 		if (major != MD_MAJOR && major != LOOP_MAJOR && 
 		    major != DDV_MAJOR && major != NBD_MAJOR)
 			plug_device(blk_dev + major); /* is atomic */
 	} else switch (major) {
+	     default:
+		/*
+		 * For dynamicaly allocated majors, that are not defined in 
+		 * CASE_COALESCE_BUT_FIRST_REQUEST_MAYBE_BUSY or
+		 * CASE_COALESCE_ALSO_FIRST_REQUEST have a look at blk_merge_rule
+		 * to determine whether requests may be merged 
+		 */
+		if ((blk_merge_rule[major] != BLK_MERGE_BUT_FIRST_REQUEST_MAY_BE_BUSY) &&
+                    (blk_merge_rule[major] != BLK_MERGE_ALSO_FIRST_REQUEST))
+		        break;
+		if (blk_merge_rule[major] == BLK_MERGE_ALSO_FIRST_REQUEST)
+		        skip_first_req = 1;
+		/* fall through */
 	     CASE_COALESCE_BUT_FIRST_REQUEST_MAYBE_BUSY
 		/*
 		 * The scsi disk and cdrom drivers completely remove the request
@@ -676,7 +701,7 @@
 		 * All other drivers need to jump over the first entry, as that
 		 * entry may be busy being processed and we thus can't change it.
 		 */
-		if (req == blk_dev[major].current_request)
+		if (req == blk_dev[major].current_request && skip_first_req == 0)
 	        	if (!(req = req->next))
 				break;
 		/* fall through */
Index: include/linux/blkdev.h
===================================================================
RCS file: /home/cvs/linux/include/linux/blkdev.h,v
retrieving revision 1.4
retrieving revision 1.5
diff -u -w -r1.4 -r1.5
--- include/linux/blkdev.h	2001/01/18 13:05:12	1.4
+++ include/linux/blkdev.h	2001/05/31 14:10:53	1.5
@@ -107,6 +107,15 @@
 
 extern int * max_segments[MAX_BLKDEV];
 
+extern int blk_merge_rule[MAX_BLKDEV];
+
+/*
+ * definitions which can be set into blk_merge_rule 
+ */
+#define BLK_MERGE_NEVER 0 
+#define BLK_MERGE_BUT_FIRST_REQUEST_MAY_BE_BUSY 1
+#define BLK_MERGE_ALSO_FIRST_REQUEST 2
+
 #define MAX_SECTORS 128
 
 #define MAX_SEGMENTS MAX_SECTORS

^ permalink raw reply	[flat|nested] only message in thread

only message in thread, other threads:[~2001-05-31 15:07 UTC | newest]

Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2001-05-31 15:04 Patch against ll_rw_blk and blkdev.h in 2.2 COTTE

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox

all inboxes | Powered by JetHome®