patch-2.3.51 linux/include/linux/nbd.h

Next file: linux/include/linux/nfsd/export.h
Previous file: linux/include/linux/msdos_fs_sb.h
Back to the patch index
Back to the overall index

diff -u --recursive --new-file v2.3.50/linux/include/linux/nbd.h linux/include/linux/nbd.h
@@ -30,22 +30,35 @@
 extern int requests_out;
 #endif
 
-static void 
+static int 
 nbd_end_request(struct request *req)
 {
 	unsigned long flags;
+	int ret = 0;
 
 #ifdef PARANOIA
 	requests_out++;
 #endif
+	/*
+	 * This is a very dirty hack that we have to do to handle
+	 * merged requests because end_request stuff is a bit
+	 * broken. The fact we have to do this only if there
+	 * aren't errors looks even more silly.
+	 */
+	if (!req->errors) {
+		req->sector += req->current_nr_sectors;
+		req->nr_sectors -= req->current_nr_sectors;
+	}
+
 	spin_lock_irqsave(&io_request_lock, flags);
 	if (end_that_request_first( req, !req->errors, "nbd" ))
 		goto out;
+	ret = 1;
 	end_that_request_last( req );
 
 out:
 	spin_unlock_irqrestore(&io_request_lock, flags);
-	return;
+	return ret;
 }
 
 #define MAX_NBD 128
@@ -56,7 +69,6 @@
 	int harderror;		/* Code of hard error			*/
 #define NBD_READ_ONLY 0x0001
 #define NBD_WRITE_NOCHK 0x0002
-#define NBD_INITIALISED 0x0004
 	struct socket * sock;
 	struct file * file; 		/* If == NULL, device is not ready, yet	*/
 	int magic;			/* FIXME: not if debugging is off	*/

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