All of lore.kernel.org
 help / color / mirror / Atom feed
From: Kiyoshi Ueda <k-ueda@ct.jp.nec.com>
To: Boaz Harrosh <bharrosh@panasas.com>
Cc: k-ueda@ct.jp.nec.com, linux-kernel@vger.kernel.org,
	Jun'ichi Nomura <j-nomura@ce.jp.nec.com>,
	device-mapper development <dm-devel@redhat.com>,
	Jens Axboe <jens.axboe@oracle.com>, Tejun Heo <tj@kernel.org>
Subject: Re: [PATCH block#for-2.6.31] block: add request clone interface
Date: Thu, 11 Jun 2009 12:18:09 +0900	[thread overview]
Message-ID: <4A307771.10303@ct.jp.nec.com> (raw)
In-Reply-To: <4A2F66ED.80206@panasas.com>

Hi Boaz,

On 06/10/2009 04:55 PM +0900, Boaz Harrosh wrote:
> On 06/10/2009 05:15 AM, Kiyoshi Ueda wrote:
>> On 06/10/2009 03:03 AM +0900, Jens Axboe wrote:
>>> On Tue, Jun 09 2009, Kiyoshi Ueda wrote:
>>>> Hi Jens,
>>>>
>>>> +/*
>>>> + * Copy request information of the original request to the clone request.
>>>> + */
>>>> +static void __blk_rq_prep_clone(struct request *dst, struct request *src)
>>>> +{
>>>> +	dst->cpu = src->cpu;
>>>> +	dst->cmd_flags = (rq_data_dir(src) | REQ_NOMERGE);
>>>> +	dst->cmd_type = src->cmd_type;
>>>> +	dst->__sector = blk_rq_pos(src);
>>>> +	dst->__data_len = blk_rq_bytes(src);
>>>> +	dst->nr_phys_segments = src->nr_phys_segments;
>>>> +	dst->ioprio = src->ioprio;
>>>> +	dst->buffer = src->buffer;
>>>> +	dst->cmd_len = src->cmd_len;
>>>> +	dst->cmd = src->cmd;
>>> Are you making sure that 'src' always exists while 'dst' is alive?
>> Yes.
>> Request-based dm is the owner of 'src' (original) and
>> it never frees 'src' until the 'dst' (clone) are completed.
>>
>> I avoided deep-copying __cmd/buffer/sense as it's costly
>> (additional allocation and memcpy).
> 
> For my needs for example dst->cmd will be different then
> src->cmd. Could be untouched. The caller will set what he
> needs.
> 
> dst->sense should be untouched, caller can set to src->sense
> if he wants to. Or like me he already have another buffer.
> 
> dst->buffer is always NULL in my path so I don't know
> what that is. Tejun?
> 
> It should only be about bios and lengths.
> 
> And a big fat comment about what it does and what it
> does not.

OK, I removed ->cmd, ->sense and ->buffer from __blk_rq_prep_clone()
and added some documents.
Please see the updated patch:
    http://marc.info/?l=dm-devel&m=124468991432260&w=2

Thanks,
Kiyoshi Ueda

WARNING: multiple messages have this Message-ID (diff)
From: Kiyoshi Ueda <k-ueda@ct.jp.nec.com>
To: Boaz Harrosh <bharrosh@panasas.com>
Cc: Tejun Heo <tj@kernel.org>, Jens Axboe <jens.axboe@oracle.com>,
	linux-kernel@vger.kernel.org,
	device-mapper development <dm-devel@redhat.com>,
	"Jun'ichi Nomura" <j-nomura@ce.jp.nec.com>,
	k-ueda@ct.jp.nec.com
Subject: Re: [PATCH block#for-2.6.31] block: add request clone interface
Date: Thu, 11 Jun 2009 12:18:09 +0900	[thread overview]
Message-ID: <4A307771.10303@ct.jp.nec.com> (raw)
In-Reply-To: <4A2F66ED.80206@panasas.com>

Hi Boaz,

On 06/10/2009 04:55 PM +0900, Boaz Harrosh wrote:
> On 06/10/2009 05:15 AM, Kiyoshi Ueda wrote:
>> On 06/10/2009 03:03 AM +0900, Jens Axboe wrote:
>>> On Tue, Jun 09 2009, Kiyoshi Ueda wrote:
>>>> Hi Jens,
>>>>
>>>> +/*
>>>> + * Copy request information of the original request to the clone request.
>>>> + */
>>>> +static void __blk_rq_prep_clone(struct request *dst, struct request *src)
>>>> +{
>>>> +	dst->cpu = src->cpu;
>>>> +	dst->cmd_flags = (rq_data_dir(src) | REQ_NOMERGE);
>>>> +	dst->cmd_type = src->cmd_type;
>>>> +	dst->__sector = blk_rq_pos(src);
>>>> +	dst->__data_len = blk_rq_bytes(src);
>>>> +	dst->nr_phys_segments = src->nr_phys_segments;
>>>> +	dst->ioprio = src->ioprio;
>>>> +	dst->buffer = src->buffer;
>>>> +	dst->cmd_len = src->cmd_len;
>>>> +	dst->cmd = src->cmd;
>>> Are you making sure that 'src' always exists while 'dst' is alive?
>> Yes.
>> Request-based dm is the owner of 'src' (original) and
>> it never frees 'src' until the 'dst' (clone) are completed.
>>
>> I avoided deep-copying __cmd/buffer/sense as it's costly
>> (additional allocation and memcpy).
> 
> For my needs for example dst->cmd will be different then
> src->cmd. Could be untouched. The caller will set what he
> needs.
> 
> dst->sense should be untouched, caller can set to src->sense
> if he wants to. Or like me he already have another buffer.
> 
> dst->buffer is always NULL in my path so I don't know
> what that is. Tejun?
> 
> It should only be about bios and lengths.
> 
> And a big fat comment about what it does and what it
> does not.

OK, I removed ->cmd, ->sense and ->buffer from __blk_rq_prep_clone()
and added some documents.
Please see the updated patch:
    http://marc.info/?l=dm-devel&m=124468991432260&w=2

Thanks,
Kiyoshi Ueda

  reply	other threads:[~2009-06-11  3:18 UTC|newest]

Thread overview: 18+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2009-06-09  7:51 [PATCH block#for-2.6.31] block: add request clone interface Kiyoshi Ueda
2009-06-09  7:51 ` Kiyoshi Ueda
2009-06-09 13:49 ` Boaz Harrosh
2009-06-09 13:49   ` Boaz Harrosh
2009-06-09 18:03 ` Jens Axboe
2009-06-10  2:15   ` Kiyoshi Ueda
2009-06-10  2:15     ` Kiyoshi Ueda
2009-06-10  4:30     ` Jens Axboe
2009-06-10  4:30       ` Jens Axboe
2009-06-11  3:17       ` Kiyoshi Ueda
2009-06-11  3:17         ` Kiyoshi Ueda
2009-06-11  9:20         ` Jens Axboe
2009-06-10  7:55     ` Boaz Harrosh
2009-06-10  7:55       ` Boaz Harrosh
2009-06-11  3:18       ` Kiyoshi Ueda [this message]
2009-06-11  3:18         ` Kiyoshi Ueda
2009-06-17  9:19       ` Tejun Heo
2009-06-17  9:19         ` Tejun Heo

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=4A307771.10303@ct.jp.nec.com \
    --to=k-ueda@ct.jp.nec.com \
    --cc=bharrosh@panasas.com \
    --cc=dm-devel@redhat.com \
    --cc=j-nomura@ce.jp.nec.com \
    --cc=jens.axboe@oracle.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=tj@kernel.org \
    /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.