patch-2.3.32 linux/include/linux/blkdev.h

Next file: linux/include/linux/cdrom.h
Previous file: linux/include/linux/blk.h
Back to the patch index
Back to the overall index

diff -u --recursive --new-file v2.3.31/linux/include/linux/blkdev.h linux/include/linux/blkdev.h
@@ -27,6 +27,7 @@
 	unsigned long nr_sectors;
 	unsigned long nr_segments;
 	unsigned long current_nr_sectors;
+	void * special;
 	char * buffer;
 	struct semaphore * sem;
 	struct buffer_head * bh;
@@ -34,19 +35,57 @@
 	struct request * next;
 };
 
-typedef void (request_fn_proc) (void);
-typedef struct request ** (queue_proc) (kdev_t dev);
+typedef struct request_queue request_queue_t;
+typedef int (merge_request_fn) (request_queue_t *, 
+				struct request  * req,
+				struct buffer_head *);
+typedef int (merge_requests_fn) (request_queue_t *, 
+				 struct request  * req,
+				 struct request  * req2);
+typedef void (request_fn_proc) (request_queue_t *);
+typedef request_queue_t * (queue_proc) (kdev_t dev);
+
+struct request_queue
+{
+	struct request		* current_request;
+	request_fn_proc		* request_fn;
+	merge_request_fn	* merge_fn;
+	merge_requests_fn	* merge_requests_fn;
+	/*
+	 * The queue owner gets to use this for whatever they like.
+	 * ll_rw_blk doesn't touch it.
+	 */
+	void                    * queuedata;
+
+	/*
+	 * This is used to remove the plug when tq_disk runs.
+	 */
+	struct tq_struct          plug_tq;
+	/*
+	 * Boolean that indicates whether this queue is plugged or not.
+	 */
+	char			  plugged;
+
+	/*
+	 * Boolean that indicates whether current_request is active or
+	 * not.
+	 */
+	char			  head_active;
+
+	/*
+	 * Boolean that indicates whether we should use plugging on
+	 * this queue or not.
+	 */
+	char			  use_plug; 
+};
 
 struct blk_dev_struct {
-	request_fn_proc		*request_fn;
 	/*
 	 * queue_proc has to be atomic
 	 */
+	request_queue_t		request_queue;
 	queue_proc		*queue;
 	void			*data;
-	struct request		*current_request;
-	struct request   plug;
-	struct tq_struct plug_tq;
 };
 
 struct sec_size {
@@ -54,12 +93,28 @@
 	unsigned block_size_bits;
 };
 
+/*
+ * Used to indicate the default queue for drivers that don't bother
+ * to implement multiple queues.  We have this access macro here
+ * so as to eliminate the need for each and every block device
+ * driver to know about the internal structure of blk_dev[].
+ */
+#define BLK_DEFAULT_QUEUE(_MAJOR)  &blk_dev[_MAJOR].request_queue
+
 extern struct sec_size * blk_sec[MAX_BLKDEV];
 extern struct blk_dev_struct blk_dev[MAX_BLKDEV];
 extern wait_queue_head_t wait_for_request;
 extern void resetup_one_dev(struct gendisk *dev, int drive);
 extern void unplug_device(void * data);
 extern void make_request(int major,int rw, struct buffer_head * bh);
+
+/*
+ * Access functions for manipulating queue properties
+ */
+extern void blk_init_queue(request_queue_t *, request_fn_proc *);
+extern void blk_cleanup_queue(request_queue_t *);
+extern void blk_queue_headactive(request_queue_t *, int);
+extern void blk_queue_pluggable(request_queue_t *, int);
 
 /* md needs this function to remap requests */
 extern int md_map (int minor, kdev_t *rdev, unsigned long *rsector, unsigned long size);

FUNET's LINUX-ADM group, linux-adm@nic.funet.fi
TCL-scripts by Sam Shen (who was at: slshen@lbl.gov)