From: Kiyoshi Ueda <k-ueda@ct.jp.nec.com>
To: Nikanth Karthikesan <knikanth@suse.de>
Cc: Mike Snitzer <snitzer@redhat.com>,
linux-kernel@vger.kernel.org, dm-devel@redhat.com,
Jens Axboe <jens.axboe@oracle.com>,
Alasdair G Kergon <agk@redhat.com>
Subject: Re: [PATCH-v2 2/2] Initialize mempool and elevator only for request-based dm devices
Date: Wed, 12 Aug 2009 11:15:56 +0900 [thread overview]
Message-ID: <4A8225DC.1060200@ct.jp.nec.com> (raw)
In-Reply-To: <200908111435.12020.knikanth@suse.de>
Hi Nikanth,
On 08/11/2009 06:05 PM +0900, Nikanth Karthikesan wrote:
> On Tuesday 11 August 2009 13:36:24 Kiyoshi Ueda wrote:
>> On 08/10/2009 07:48 PM +0900, Nikanth Karthikesan wrote:
>>> +
>>> + /*
>>> + * reinitialize make_request_fn as it was reset to the
>>> + * default __make_request by blk_init_allocate_queue
>>> + */
>>> + md->saved_make_request_fn = md->queue->make_request_fn;
>>> + blk_queue_make_request(md->queue, dm_request);
>>> +
>>> + blk_queue_softirq_done(md->queue, dm_softirq_done);
>>> + blk_queue_prep_rq(md->queue, dm_prep_fn);
>>> + blk_queue_lld_busy(md->queue, dm_lld_busy);
>>> + }
>>> +
>>> __unbind(md);
>>> r = __bind(md, table, &limits);
>> The queue has been registered at the device creation time by
>> add_disk() in alloc_dev().
>> Since the queue is reconfigured (elevator is attached), you have to
>> update the queue registration (e.g. unregister, then re-register).
>> But it may not be easy. At least, there is no exported interface to
>> unregister/re-register queue.
>
> Ah, yes. The scheduler attributes will not be exported in
> /sys/block/dm*/queue/iosched. Exporting elv_register_queue() and calling it
> here solves it. Something like..
>
> @@ -2203,6 +2199,29 @@ int dm_swap_table(struct mapped_device *md, struct
> dm_table *table)
> goto out;
> }
>
> + /* new device is being marked as request-based */
> + if (!md->map && dm_table_request_based(table)) {
> + /* initialize queue for request-based dm */
> + r = blk_init_allocated_queue(md->queue, dm_request_fn, NULL);
> + if (r)
> + goto out;
> +
> + r = elv_register_queue(md->queue);
> + /* if (r)
> + * goto out; Better to ignore, just like add_disk does ;-)
> + */
> + /*
> + * reinitialize make_request_fn as it was reset to the
> + * default __make_request by blk_init_allocate_queue
> + */
> + md->saved_make_request_fn = md->queue->make_request_fn;
> + blk_queue_make_request(md->queue, dm_request);
> +
> + blk_queue_softirq_done(md->queue, dm_softirq_done);
> + blk_queue_prep_rq(md->queue, dm_prep_fn);
> + blk_queue_lld_busy(md->queue, dm_lld_busy);
> + }
> +
> __unbind(md);
> r = __bind(md, table, &limits);
>
> I would post the v3 of the patches with this change. Do you see any problems
> in this?
Humm, it might work for now, but I disagree with that.
Since elevator is block internal and dm doesn't really care
(its initialization is actually hidden in blk_init_allocated_queue()),
directly calling elv_register_queue() from dm seems not right.
It will likely introduce a bug by future changes in block layer.
I think the right approach is to define a proper block layer interface
to reflect the queue configuration change.
That's why I said "Updating the queue registration may not be easy".
Thanks,
Kiyoshi Ueda
WARNING: multiple messages have this Message-ID (diff)
From: Kiyoshi Ueda <k-ueda@ct.jp.nec.com>
To: Nikanth Karthikesan <knikanth@suse.de>
Cc: Alasdair G Kergon <agk@redhat.com>,
Mike Snitzer <snitzer@redhat.com>,
Jens Axboe <jens.axboe@oracle.com>,
dm-devel@redhat.com, linux-kernel@vger.kernel.org,
Hannes Reinecke <hare@suse.de>
Subject: Re: [PATCH-v2 2/2] Initialize mempool and elevator only for request-based dm devices
Date: Wed, 12 Aug 2009 11:15:56 +0900 [thread overview]
Message-ID: <4A8225DC.1060200@ct.jp.nec.com> (raw)
In-Reply-To: <200908111435.12020.knikanth@suse.de>
Hi Nikanth,
On 08/11/2009 06:05 PM +0900, Nikanth Karthikesan wrote:
> On Tuesday 11 August 2009 13:36:24 Kiyoshi Ueda wrote:
>> On 08/10/2009 07:48 PM +0900, Nikanth Karthikesan wrote:
>>> +
>>> + /*
>>> + * reinitialize make_request_fn as it was reset to the
>>> + * default __make_request by blk_init_allocate_queue
>>> + */
>>> + md->saved_make_request_fn = md->queue->make_request_fn;
>>> + blk_queue_make_request(md->queue, dm_request);
>>> +
>>> + blk_queue_softirq_done(md->queue, dm_softirq_done);
>>> + blk_queue_prep_rq(md->queue, dm_prep_fn);
>>> + blk_queue_lld_busy(md->queue, dm_lld_busy);
>>> + }
>>> +
>>> __unbind(md);
>>> r = __bind(md, table, &limits);
>> The queue has been registered at the device creation time by
>> add_disk() in alloc_dev().
>> Since the queue is reconfigured (elevator is attached), you have to
>> update the queue registration (e.g. unregister, then re-register).
>> But it may not be easy. At least, there is no exported interface to
>> unregister/re-register queue.
>
> Ah, yes. The scheduler attributes will not be exported in
> /sys/block/dm*/queue/iosched. Exporting elv_register_queue() and calling it
> here solves it. Something like..
>
> @@ -2203,6 +2199,29 @@ int dm_swap_table(struct mapped_device *md, struct
> dm_table *table)
> goto out;
> }
>
> + /* new device is being marked as request-based */
> + if (!md->map && dm_table_request_based(table)) {
> + /* initialize queue for request-based dm */
> + r = blk_init_allocated_queue(md->queue, dm_request_fn, NULL);
> + if (r)
> + goto out;
> +
> + r = elv_register_queue(md->queue);
> + /* if (r)
> + * goto out; Better to ignore, just like add_disk does ;-)
> + */
> + /*
> + * reinitialize make_request_fn as it was reset to the
> + * default __make_request by blk_init_allocate_queue
> + */
> + md->saved_make_request_fn = md->queue->make_request_fn;
> + blk_queue_make_request(md->queue, dm_request);
> +
> + blk_queue_softirq_done(md->queue, dm_softirq_done);
> + blk_queue_prep_rq(md->queue, dm_prep_fn);
> + blk_queue_lld_busy(md->queue, dm_lld_busy);
> + }
> +
> __unbind(md);
> r = __bind(md, table, &limits);
>
> I would post the v3 of the patches with this change. Do you see any problems
> in this?
Humm, it might work for now, but I disagree with that.
Since elevator is block internal and dm doesn't really care
(its initialization is actually hidden in blk_init_allocated_queue()),
directly calling elv_register_queue() from dm seems not right.
It will likely introduce a bug by future changes in block layer.
I think the right approach is to define a proper block layer interface
to reflect the queue configuration change.
That's why I said "Updating the queue registration may not be easy".
Thanks,
Kiyoshi Ueda
next prev parent reply other threads:[~2009-08-12 2:15 UTC|newest]
Thread overview: 19+ messages / expand[flat|nested] mbox.gz Atom feed top
2009-08-08 4:56 [PATCH 2/2] Initialize mempool and elevator only for request-based dm devices Nikanth Karthikesan
2009-08-08 4:56 ` Nikanth Karthikesan
2009-08-08 16:21 ` Mike Snitzer
2009-08-08 16:21 ` Mike Snitzer
2009-08-10 10:21 ` Nikanth Karthikesan
2009-08-10 10:48 ` [PATCH-v2 " Nikanth Karthikesan
2009-08-11 8:06 ` Kiyoshi Ueda
2009-08-11 8:06 ` Kiyoshi Ueda
2009-08-11 9:05 ` Nikanth Karthikesan
2009-08-11 9:05 ` Nikanth Karthikesan
2009-08-11 9:32 ` [PATCH-v3 " Nikanth Karthikesan
2009-08-11 9:32 ` Nikanth Karthikesan
2009-08-12 2:15 ` Kiyoshi Ueda [this message]
2009-08-12 2:15 ` [PATCH-v2 " Kiyoshi Ueda
2009-08-12 8:47 ` Nikanth Karthikesan
2009-08-12 8:47 ` Nikanth Karthikesan
2009-08-14 7:01 ` Kiyoshi Ueda
2009-08-14 7:01 ` Kiyoshi Ueda
2010-05-11 16:23 ` Mike Snitzer
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=4A8225DC.1060200@ct.jp.nec.com \
--to=k-ueda@ct.jp.nec.com \
--cc=agk@redhat.com \
--cc=dm-devel@redhat.com \
--cc=jens.axboe@oracle.com \
--cc=knikanth@suse.de \
--cc=linux-kernel@vger.kernel.org \
--cc=snitzer@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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.