[Date Prev][Date Next] [Thread Prev][Thread Next] [Date Index] [Thread Index]

Re: [Nbd] [patch] fix "copy on write" wrong code



Wouter Verhelst wrote:

- wrong place for initialisation of diffmaps

Well -- what's "wrong" is just a matter of opinion here, I'd say. It's
both initialization code...

At does not work before you deternine size of exported media/file. So, IMHO it should be moved in separate function and called later.

- some problem with expread (only blocksize = DIFFPAGESIZE is supported with '-c' option)

diff -u nbd-2.8.0/nbd-server.c nbd_fix_copy_on_write/nbd-server.c
--- nbd-2.8.0/nbd-server.c	2005-10-19 16:36:04.858192672 +0400
+++ nbd_fix_copy_on_write/nbd-server.c	2005-10-19 16:38:21.296450904 +0400
@@ -536,7 +536,7 @@
		} else { /* the block is not there */
			DEBUG2("Page %Lu is not here, we read the original one\n",
			       (unsigned long long)mapcnt);
-			return rawexpread(a, buf, rdlen, client);
+			if(rawexpread(a, buf, rdlen, client)) return -1;
		}
		len-=rdlen; a+=rdlen; buf+=rdlen;
	}

Hm. Do you mean that without this change, using nbd-server with -c
doesn't support different blocksizes?

Yes. functuin will return after reading first "page" of block. Other pages are not readed :(.
I've test this patch ;)




Reply to: