-
Notifications
You must be signed in to change notification settings - Fork 0
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Qcow2 support #1
base: master
Are you sure you want to change the base?
Conversation
Errors come from -Wstringop-truncation with gcc-8 and above. Signed-off-by: Anthoine Bourgeois <[email protected]>
Signed-off-by: Anthoine Bourgeois <[email protected]>
Signed-off-by: Anthoine Bourgeois <[email protected]>
Signed-off-by: Anthoine Bourgeois <[email protected]>
Signed-off-by: Anthoine Bourgeois <[email protected]>
Function tapdisk_xenblkif_make_vbd_request will release tapreq->msg and reinsert it in the reqs_free array if the request is a BLKIF_OP_WRITE_BARRIER without any segment. But tapdisk_xenblkif_queue_request will use it to check if it must send the request to VBD layer. This bug triggers a crash when DEBUG is defined in td-reqs.c because DEBUG will poison the msg memory. Without DEBUG, the code reads freed memory that still contains unchanged data. Signed-off-by: Anthoine Bourgeois <[email protected]>
fail label already set vreq->error with err, so remove the first assignment in both paths that lead to fail label. Signed-off-by: Anthoine Bourgeois <[email protected]>
Signed-off-by: Anthoine Bourgeois <[email protected]>
This commit includes a list of files imported from qemu to build the qcow2 library for tapdisk. A small script helps to import files and diff them to ease the sources management. Signed-off-by: Anthoine Bourgeois <[email protected]>
Signed-off-by: Anthoine Bourgeois <[email protected]>
This commit modify sources from qemu to disable some features unneeded for tapdisk. Signed-off-by: Anthoine Bourgeois <[email protected]>
XCP-ng-8.3 doesn't have components recent enough for qemu sources. Fix a few things to support old tools. Signed-off-by: Anthoine Bourgeois <[email protected]>
Add a mutex to protect vbd structure from qcow2 concurrency. Signed-off-by: Anthoine Bourgeois <[email protected]>
Add a mutex to protect blktap structure from qcow2 concurrency. Signed-off-by: Anthoine Bourgeois <[email protected]>
Add a mutex to protect blkif structure from qcow2 concurrency. Signed-off-by: Anthoine Bourgeois <[email protected]>
Signed-off-by: Anthoine Bourgeois <[email protected]>
Signed-off-by: Anthoine Bourgeois <[email protected]>
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Did a quick review of this PR if I see things to improve.
Aside this review, I am not completely convinced of directly picking a large part of QEMU code.
I think it would be better to maintain a set of patches for QEMU code and fetching a specific (working) QEMU version on what we apply the patches. It will make maintenance easier in the long term.
#define QCOW2_OP_READ 1 | ||
#define QCOW2_OP_WRITE 2 | ||
|
||
#define QCOW2_FLAG_OPEN_RDONLY 1 |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Using 1 << 0
, 1 << 1
, ... style would be preferable than raw decimals.
For reference, Xen headers uses a variant of it with a intermediate macro
e.g
/* xen_pci_sharedinfo flags */
#define _XEN_PCIF_active (0)
#define XEN_PCIF_active (1<<_XEN_PCIF_active)
#define _XEN_PCIB_AERHANDLER (1)
#define XEN_PCIB_AERHANDLER (1<<_XEN_PCIB_AERHANDLER)
#define _XEN_PCIB_active (2)
#define XEN_PCIB_active (1<<_XEN_PCIB_active)
|
||
struct qcow2_request { | ||
int error; | ||
uint8_t op; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Is there a reason to use uint8_t here specifically ?
I think unsigned int would fit better to make the structure layout less complex and potentially more efficient.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I don't see anything objectionable about using a signed integer of explicit size here. Generally it's even good for storing constants and operations. And regarding performance, I doubt it will help anything regarding buffer reads/writes or writing data to disk.
Error *local_err = NULL; | ||
BlockConf *conf = NULL; | ||
bool writethrough; | ||
#define AIO_NATIVE |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
These macros will always be defined (is it temporary ?).
(#else part will never be compiled)
.disk_type = "tapdisk_qcow2", | ||
.flags = 0, | ||
.private_data_size = sizeof(struct qcow2_state), | ||
.td_open = _qcow2_open, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
assuming that this can be called multiples times, static variables are going to be overwritten, causing potentially various tricky issues
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
What can be called multiple times? And what could overwrite these fields? They are normally set only one time.
I don't see any other changes to these fields in the blktap code.
bql_unlock(); | ||
} | ||
|
||
static pthread_t thread; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
You probably want to ensure that these variables don't get overwritten (see .td_open = _qcow2_open
) comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Same questions here. What's the issue?
This PR contains different parts: