|
From: | Vladimir Sementsov-Ogievskiy |
Subject: | Re: [Qemu-block] [PATCH 3/9] nbd: BLOCK_STATUS for standard get_block_status function: server part |
Date: | Fri, 2 Mar 2018 18:07:43 +0300 |
User-agent: | Mozilla/5.0 (X11; Linux x86_64; rv:52.0) Gecko/20100101 Thunderbird/52.6.0 |
16.02.2018 16:21, Eric Blake wrote:
On 02/15/2018 07:51 AM, Vladimir Sementsov-Ogievskiy wrote:Minimal realization: only one extent in server answer is supported. Signed-off-by: Vladimir Sementsov-Ogievskiy <address@hidden> ---
[...]
+ meta = &local_meta; + } + + memset(meta, 0, sizeof(*meta)); + + ret = nbd_read_size_string(client, meta->export_name, + NBD_MAX_NAME_SIZE, errp);Revisiting a question I raised in my first half review - you saved the name as part of the struct because we have to later compare that the final OPT_SET export name matches the request during OPT_GO (if they don't match, then we have no contexts to serve after all). So a 'const char *' won't work, but maybe the struct could use a 'char *' pointing to malloc'd storage rather than char[MAX_NAME] that reserves array space that is mostly unused for the typical name that is much shorter than the maximum name length.
Do these 256 bytes worth creating nbd_clear_meta function, to call it from client_put and on NBD_OPT_SET_META_CONTEXT, to clear previous meta? If yes, I'd prefer to postpone it to continuation about BLOCKSTATUS for dirty bitmaps, when I'll have to upgrade meta structure, to maintain dirty bitmaps.
+ if (ret <= 0) { + return ret; + } + + exp = nbd_export_find(meta->export_name); + if (exp == NULL) { + return nbd_opt_invalid(client, errp,+ "export '%s' not present", meta->export_name);
-- Best regards, Vladimir
[Prev in Thread] | Current Thread | [Next in Thread] |