Skip to contentSkip to conversation

nbd: remove PARANOIA and other cleanups

PATCH New Paul Clements 3 participants 5 messages Feb 19, 2004 – Jun 3, 2004

Subsystems (2)
lore
Share & tools
lore
#0 lore raw

PATCH 2/2 nbd: remove PARANOIA and other cleanups

This patch removes the PARANOIA define (it was always defined anyway). It also removes the requests_in/out counters (which weren't always accurate, and are superfluous anyway, since the block layer keeps its own in_flight counter). Also some minor cleanup of comments.

Thanks,
Paul

include/linux/nbd.h renamed from include/linux/nbd.h.PRISTINE +13 -12
@@ -8,6 +8,8 @@
  * 2003/06/24 Louis D. Langholtz <[email protected]>
  *            Removed unneeded blksize_bits field from nbd_device struct.
  *            Cleanup PARANOIA usage & code.
+ * 2004/02/19 Paul Clements
+ *            Removed PARANOIA, plus various cleanup and comments
  */
 
 #ifndef LINUX_NBD_H
@@ -32,22 +34,19 @@ enum {
 #define nbd_cmd(req) ((req)->cmd[0])
 #define MAX_NBD 128
 
-/* Define PARANOIA to include extra sanity checking code in here & driver */
-#define PARANOIA
-
 /* userspace doesn't need the nbd_device structure */
 #ifdef __KERNEL__
 
+/* values for flags field */
+#define NBD_READ_ONLY 0x0001
+#define NBD_WRITE_NOCHK 0x0002
+
 struct nbd_device {
 	int flags;
 	int harderror;		/* Code of hard error			*/
-#define NBD_READ_ONLY 0x0001
-#define NBD_WRITE_NOCHK 0x0002
 	struct socket * sock;
 	struct file * file; 	/* If == NULL, device is not ready, yet	*/
-#ifdef PARANOIA
-	int magic;		/* FIXME: not if debugging is off	*/
-#endif
+	int magic;
 	spinlock_t queue_lock;
 	struct list_head queue_head;/* Requests are added here...	*/
 	struct semaphore tx_lock;
@@ -58,16 +57,14 @@ struct nbd_device {
 
 #endif
 
-/* This now IS in some kind of include file...	*/
-
-/* These are send over network in request/reply magic field */
+/* These are sent over the network in the request/reply magic fields */
 
 #define NBD_REQUEST_MAGIC 0x25609513
 #define NBD_REPLY_MAGIC 0x67446698
 /* Do *not* use magics: 0x12560953 0x96744668. */
 
 /*
- * This is packet used for communication between client and
+ * This is the packet used for communication between client and
  * server. All data are in network byte order.
  */
 struct nbd_request {
@@ -82,6 +79,10 @@ struct nbd_request {
 #endif
 ;
 
+/*
+ * This is the reply packet that nbd-server sends back to the client after
+ * it has completed an I/O request (or an error occurs).
+ */
 struct nbd_reply {
 	u32 magic;
 	u32 error;		/* 0 = ok, else error	*/
drivers/block/nbd.c renamed from drivers/block/nbd.c.PROC_PARTITIONS_FIXES +11 -41

148 lines not on this page · raw message

#1 lore raw

PATCH 1/1 nbd: fix device names

It seems more appropriate to call the devices "nbX" rather than "nbdX", since that's what the device nodes are actually named.

--
Paul

drivers/block/nbd.c Thu Apr 15 13:53:18 2004 renamed from drivers/block/nbd.c.PRISTINE Thu Apr 15 13:40:18 2004 +1 -1
@@ -713,7 +753,7 @@ static int __init nbd_init(void)
 		disk->fops = &nbd_fops;
 		disk->private_data = &nbd_dev[i];
 		disk->flags |= GENHD_FL_SUPPRESS_PARTITION_INFO;
-		sprintf(disk->disk_name, "nbd%d", i);
+		sprintf(disk->disk_name, "nb%d", i);
 		sprintf(disk->devfs_name, "nbd/%d", i);
 		set_capacity(disk, 0x7ffffc00ULL << 1); /* 2 TB */
 		add_disk(disk);
#2 lore raw

Re: [PATCH] nbd: fix device names

Quoted 3 lines · Paul Clements

It seems more appropriate to call the devices "nbX" rather than "nbdX", since that's what the device nodes are actually named.

This affects /proc/partitions, /proc/diskstats, and probably other things. I think it's too late to change it.

#3 lore raw

Re: [PATCH] nbd: fix device names

Quoted 7 lines · Andrew Morton
Quoted 2 lines · Paul Clements

It seems more appropriate to call the devices "nbX" rather than "nbdX", since that's what the device nodes are actually named.

This affects /proc/partitions, /proc/diskstats, and probably other things.

Network block devices don't actually show up in /proc/partitions, but you have a valid point that the other uses would change. Although, I think it's a change for the better.

Quoted 1 line

I think it's too late to change it.

Fair enough. I can live with this discrepancy, although I think nbd is the only block device driver that has this problem. That's the only reason I sent the patch along...just trying to make nbd consistent with all the other device drivers.

Thanks,
Paul

#4 lore raw

Re: [PATCH] nbd: fix device names

In reply to Paul Clements

Hi!

drivers/block/nbd.c Thu Apr 15 13:53:18 2004 static int __init nbd_init(void) · line 757

Quoted 11 lines

It seems more appropriate to call the devices "nbX" rather than "nbdX",
since that's what the device nodes are actually named.

drivers/block/nbd.c Thu Apr 15 13:53:18 2004 renamed from drivers/block/nbd.c.PRISTINE Thu Apr 15 13:40:18 2004 +1 -1
@@ -713,7 +753,7 @@ static int __init nbd_init(void)
 		disk->fops = &nbd_fops;
 		disk->private_data = &nbd_dev[i];
 		disk->flags |= GENHD_FL_SUPPRESS_PARTITION_INFO;
-		sprintf(disk->disk_name, "nbd%d", i);
+		sprintf(disk->disk_name, "nb%d", i);
 		sprintf(disk->devfs_name, "nbd/%d", i);

You might want to fix devfs name, too.

Signature · 1 line
64 bytes from 195.113.31.123: icmp_seq=28 ttl=51 time=448769.1 ms