From: Manos Pitsidianakis <el13635@mail.ntua.gr>
To: Alberto Garcia <berto@igalia.com>
Cc: qemu-devel <qemu-devel@nongnu.org>,
qemu-block <qemu-block@nongnu.org>,
Stefan Hajnoczi <stefanha@redhat.com>,
Kevin Wolf <kwolf@redhat.com>
Subject: Re: [Qemu-devel] [PATCH v2 3/6] block: require job-id when device is a node name
Date: Tue, 22 Aug 2017 13:31:26 +0300 [thread overview]
Message-ID: <20170822103126.3aeusdpvr55iwhym@postretch> (raw)
In-Reply-To: <w51bmn7hqlz.fsf@maestria.local.igalia.com>
[-- Attachment #1: Type: text/plain, Size: 2755 bytes --]
On Tue, Aug 22, 2017 at 11:57:28AM +0200, Alberto Garcia wrote:
>On Mon 21 Aug 2017 05:39:48 PM CEST, Manos Pitsidianakis wrote:
>>>> - if (job_id == NULL && !(flags & BLOCK_JOB_INTERNAL)) {
>>>> - job_id = bdrv_get_device_name(bs);
>>>> - if (!*job_id) {
>>>> - error_setg(errp, "An explicit job ID is required for this node");
>>>> - return NULL;
>>>> - }
>>>> - }
>>>> -
>>>> - if (job_id) {
>>>> - if (flags & BLOCK_JOB_INTERNAL) {
>>>> + if (flags & BLOCK_JOB_INTERNAL) {
>>>> + if (job_id) {
>>>> error_setg(errp, "Cannot specify job ID for internal block job");
>>>> return NULL;
>>>> }
>>>
>>>When BLOCK_JOB_INTERNAL is set, then job_id must be NULL...
>>>
>>>> -
>>>> + } else {
>>>> + /* Require job-id. */
>>>> + assert(job_id);
>>>> if (!id_wellformed(job_id)) {
>>>> error_setg(errp, "Invalid job ID '%s'", job_id);
>>>> return NULL;
>>>> diff --git a/include/block/blockjob_int.h b/include/block/blockjob_int.h
>>>> index f13ad05c0d..ff906808a6 100644
>>>> --- a/include/block/blockjob_int.h
>>>> +++ b/include/block/blockjob_int.h
>>>> @@ -112,8 +112,7 @@ struct BlockJobDriver {
>>>>
>>>> /**
>>>> * block_job_create:
>>>> - * @job_id: The id of the newly-created job, or %NULL to have one
>>>> - * generated automatically.
>>>> + * @job_id: The id of the newly-created job, must be non %NULL.
>>>
>>>...but here you say that it must not be NULL.
>>>
>>>And since job_id can be NULL in some cases I think I'd replace the
>>>assert(job_id) that you added to block_job_create() with a normal
>>>pointer check + error_setg().
>>>
>>>> @@ -93,9 +93,6 @@ static void test_job_ids(void)
>>>> blk[1] = create_blk("drive1");
>>>> blk[2] = create_blk("drive2");
>>>>
>>>> - /* No job ID provided and the block backend has no name */
>>>> - job[0] = do_test_id(blk[0], NULL, false);
>>>> -
>>>
>>>If you decide to handle NULL ids by returning and error instead of
>>>asserting, we should keep a couple of tests for that scenario.
>>>
>>>Berto
>>>
>>
>> Thanks, I will change that. What cases are you thinking of besides
>> internal jobs though?
>
>Both cases (external job with a NULL id and internal job with non-NULL
>id), checking that block_job_create() does return an error.
I thought we handled the external job case by requiring job_id is set
before calling block_job_create(). I will check my patch again.
>
>> And should documentation of block_job_create reflect that internal
>> jobs have job_id == NULL?
>
>Yes, it should document the restrictions of the job_id parameter.
>
>Berto
>
[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 833 bytes --]
next prev parent reply other threads:[~2017-08-22 10:33 UTC|newest]
Thread overview: 20+ messages / expand[flat|nested] mbox.gz Atom feed top
2017-08-09 14:02 [Qemu-devel] [PATCH v2 0/6] block: remove legacy I/O throttling Manos Pitsidianakis
2017-08-09 14:02 ` [Qemu-devel] [PATCH v2 1/6] block: skip implicit nodes in snapshots, blockjobs Manos Pitsidianakis
2017-08-15 13:24 ` Alberto Garcia
2017-08-15 13:50 ` Manos Pitsidianakis
2017-08-21 14:44 ` Alberto Garcia
2017-08-09 14:02 ` [Qemu-devel] [PATCH v2 2/6] block: add options parameter to bdrv_new_open_driver() Manos Pitsidianakis
2017-08-15 14:21 ` Alberto Garcia
2017-08-09 14:02 ` [Qemu-devel] [PATCH v2 3/6] block: require job-id when device is a node name Manos Pitsidianakis
2017-08-21 15:05 ` Alberto Garcia
2017-08-21 15:39 ` Manos Pitsidianakis
2017-08-22 9:57 ` Alberto Garcia
2017-08-22 10:31 ` Manos Pitsidianakis [this message]
2017-08-22 10:58 ` Alberto Garcia
2017-08-09 14:02 ` [Qemu-devel] [PATCH v2 4/6] block: remove legacy I/O throttling Manos Pitsidianakis
2017-08-22 11:49 ` Alberto Garcia
2017-08-09 14:02 ` [Qemu-devel] [PATCH v2 5/6] block: add iotest 191 for legacy throttling interface Manos Pitsidianakis
2017-08-23 12:46 ` Alberto Garcia
2017-08-09 14:02 ` [Qemu-devel] [PATCH v2 6/6] block: remove BlockBackendPublic Manos Pitsidianakis
2017-08-22 12:17 ` Alberto Garcia
2017-08-09 14:44 ` [Qemu-devel] [PATCH v2 0/6] block: remove legacy I/O throttling Eric Blake
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20170822103126.3aeusdpvr55iwhym@postretch \
--to=el13635@mail.ntua.gr \
--cc=berto@igalia.com \
--cc=kwolf@redhat.com \
--cc=qemu-block@nongnu.org \
--cc=qemu-devel@nongnu.org \
--cc=stefanha@redhat.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).