Skip to contentSkip to conversation

Synchronize blktap with citrix blktap2.

PATCH Ben Guthro 2 participants 5 messages Apr 3, 2009 – Apr 4, 2009 Kbuild

lore
Share & tools
lore

Ben Guthro

author
#0 lore raw

I started to look into these patches, to try to evaluate how much performance improvement this re-write gives, but have a problem with the way this works.

As I understand the patch set in userspace you:
1. move the old blktap dir to blktap_old
2. introduce the new blktap2 code in blktap

However, these changes that you are making to qemu merely link against the old libraries, rather than adjusting the include paths to include the new headers, and compile/link against the new blktap2?

Won't this cause problems when you actually go to use tapdisk?

Am I missing something here?

Ben

I've been reminded that the ioemu patch to update the blktap dependencies in that repo is still necessary. It is available here:
http://www.cs.ubc.ca/~dmeyer/blktap2/tools_ioemu_dir_use_blktap_old.patch

--Dutch

#1 lore raw

You've got the right idea, but it's no problem. If you're using blktap2 (eg tap:tapdisk:aio:...) the usermode scripts will create a new udev device for the guest to mount. This is entirely orthogonal to qemu, so there's no problem.

If the qemu folks wanted to use blktap2 they could have the guest mount a blktap2 disk like it was any other raw device. However, they've decided to instead replicate the original blktap functionality in their own code base. So if you're using qemu's blktap you're not using blktap2. Again, not a problem.

--Dutch

Quoted 25 lines · Ben Guthro

I started to look into these patches, to try to evaluate how much performance improvement this re-write gives, but have a problem with the way this works.

As I understand the patch set in userspace you:
1. move the old blktap dir to blktap_old
2. introduce the new blktap2 code in blktap

However, these changes that you are making to qemu merely link against the old libraries, rather than adjusting the include paths to include the new headers, and compile/link against the new blktap2?

Won't this cause problems when you actually go to use tapdisk?

Am I missing something here?

Ben

I've been reminded that the ioemu patch to update the blktap dependencies in that repo is still necessary. It is available here:
http://www.cs.ubc.ca/~dmeyer/blktap2/tools_ioemu_dir_use_blktap_old.patch

--Dutch

author
#2 lore raw
In reply to Ben Guthro

This patch compiles against the new blktap...but not really knowing much about the code, I can't tell you if I have broken something or not. It remains untested, for now because of this.

It seems that the "readonly" flag was removed...but I can't seem to find much documentation, or examples on how this might be used, so I might be way off base here

The introduction of the new blktaplib.h does introduce a significant number of new warnings to the qemu build though.

Quoted 16 lines · Ben Guthro

I started to look into these patches, to try to evaluate how much performance improvement this re-write gives, but have a problem with the way this works.

As I understand the patch set in userspace you:
1. move the old blktap dir to blktap_old
2. introduce the new blktap2 code in blktap

However, these changes that you are making to qemu merely link against the old libraries, rather than adjusting the include paths to include the new headers, and compile/link against the new blktap2?

Won't this cause problems when you actually go to use tapdisk?

Am I missing something here?

Quoted 8 lines

Ben

I've been reminded that the ioemu patch to update the blktap dependencies in that repo is still necessary. It is available here:
http://www.cs.ubc.ca/~dmeyer/blktap2/tools_ioemu_dir_use_blktap_old.patch

--Dutch

Makefile +1 -1
index c395e77..51221f7 100644
@@ -47,7 +47,7 @@ $(filter %-user,$(SUBDIR_RULES)): libqemu_user.a
 recurse-all: $(SUBDIR_RULES)
 
 tapdisk-ioemu: CPPFLAGS += -I$(XEN_ROOT)/tools/libxc
-tapdisk-ioemu: CPPFLAGS += -I$(XEN_ROOT)/tools/blktap/lib
+tapdisk-ioemu: CPPFLAGS += -I$(XEN_ROOT)/tools/blktap/include
 tapdisk-ioemu: CPPFLAGS += -I$(XEN_ROOT)/tools/xenstore
 tapdisk-ioemu: CPPFLAGS += -I$(XEN_ROOT)/tools/include
 tapdisk-ioemu: tapdisk-ioemu.c cutils.c block.c block-raw.c block-cow.c block-qcow.c aes.c block-vmdk.c block-cloop.c block-dmg.c block-bochs.c block-vpc.c block-vvfat.c block-qcow2.c hw/xen_blktap.c osdep.c
hw/xen_blktap.c +2 -3
index 24d10a3..7fdeaa7 100644
@@ -218,7 +218,7 @@ static int map_new_dev(struct td_state *s, int minor)
 	return -1;
 }
 
-static int open_disk(struct td_state *s, char *path, int readonly)
+static int open_disk(struct td_state *s, char *path)
 {
 	BlockDriverState* bs;
 	char* devname;
@@ -236,7 +236,6 @@ static int open_disk(struct td_state *s, char *path, int readonly)
 	}
 
 	s->bs = bs;
-	s->flags = readonly ? TD_RDONLY : 0;
 	s->size = bs->total_sectors;
 	s->sector_size = 512;
 
@@ -521,7 +520,7 @@ static void handle_blktap_ctrlmsg(void* private)
 			s = state_init();
 
 			/*Open file*/
-			if (s == NULL || open_disk(s, path, msg->readonly)) {
+			if (s == NULL || open_disk(s, path)) {
 				msglen = sizeof(msg_hdr_t);
 				msg->type = CTLMSG_IMG_FAIL;
 				msg->len = msglen;
xen-hooks.mak +1 -2
index c6b4f8c..108d2fb 100644
@@ -43,8 +43,7 @@ CONFIG_SDL=
 CONFIG_AUDIO=
 OBJS += xenfbfront.o
 else
-CPPFLAGS+= -I$(XEN_ROOT)/tools/blktap/lib
-LIBS += -L$(XEN_ROOT)/tools/blktap/lib -lblktap
+CPPFLAGS+= -I$(XEN_ROOT)/tools/blktap/include
 OBJS += xen_blktap.o
 OBJS += tpm_tis.o
 endif

_______________________________________________
Xen-devel mailing list
[email protected]
http://lists.xensource.com/xen-devel

#3 lore raw
Quoted 3 lines

It seems that the "readonly" flag was removed...but I can't seem to find much documentation, or examples on how this might be used, so I might be way off base here

Internally, the flag changed to TD_OPEN_RDONLY, but that shouldn't have any effect from a user perspective. Normal usage shouldn't be changed from the original blktap, you should be able to boot tap disks just as before.

Internally, the other tap drivers have all been updated to take advantage of the new (and simplified) API. If you take a look there you'll see the updates.

Quoted 2 lines

The introduction of the new blktaplib.h does introduce a significant number of new warnings to the qemu build though.

This is unexpected, but I see now how it could happen under certain conditions. I will fix this today by NOT installing the "new" blktaplib.h into /usr/include. This will ensure that anyone who has build anything with #include <blktaplib.h> dependencies will continue to see the old version, which should be appropriate until the old blktap is fully removed.

--Dutch

#4 lore raw

The build system update I promised is here:
http://www.cs.ubc.ca/~dmeyer/blktap2/userspace_patches.tgz

This removes the blktap2's blktaplib.h from /usr/include so that code with blktap dependencies doesn't get confused.

Other patches listed below remain unchanged:
http://www.cs.ubc.ca/~dmeyer/blktap2/kernel_patches.tgz
http://www.cs.ubc.ca/~dmeyer/blktap2/tools_ioemu_dir_use_blktap_old.patch

--Dutch

Quoted 20 lines · Dutch Meyer
Quoted 3 lines

It seems that the "readonly" flag was removed...but I can't seem to find much documentation, or examples on how this might be used, so I might be way off base here

Internally, the flag changed to TD_OPEN_RDONLY, but that shouldn't have any effect from a user perspective. Normal usage shouldn't be changed from the original blktap, you should be able to boot tap disks just as before.

Internally, the other tap drivers have all been updated to take advantage of the new (and simplified) API. If you take a look there you'll see the updates.

Quoted 2 lines

The introduction of the new blktaplib.h does introduce a significant number of new warnings to the qemu build though.

This is unexpected, but I see now how it could happen under certain conditions. I will fix this today by NOT installing the "new" blktaplib.h into /usr/include. This will ensure that anyone who has build anything with #include <blktaplib.h> dependencies will continue to see the old version, which should be appropriate until the old blktap is fully removed.

--Dutch

_______________________________________________
Xen-devel mailing list
[email protected]
http://lists.xensource.com/xen-devel