public inbox for linux-scsi@vger.kernel.org
 help / color / mirror / Atom feed
From: Tejun Heo <htejun@gmail.com>
To: FUJITA Tomonori <fujita.tomonori@lab.ntt.co.jp>
Cc: linux-scsi@vger.kernel.org, tomof@acm.org,
	James Bottomley <James.Bottomley@HansenPartnership.com>,
	Jens Axboe <jens.axboe@oracle.com>
Subject: Re: [PATCH 1/2] block: move the padding adjustment to blk_rq_map_sg
Date: Thu, 03 Apr 2008 12:34:13 +0900	[thread overview]
Message-ID: <47F45035.8060003@gmail.com> (raw)
In-Reply-To: <1207155180-8069-2-git-send-email-fujita.tomonori@lab.ntt.co.jp>

Hello,

FUJITA Tomonori wrote:
> -	/*
> -	 * __blk_rq_map_user() copies the buffers if starting address
> -	 * or length isn't aligned to dma_pad_mask.  As the copied
> -	 * buffer is always page aligned, we know that there's enough
> -	 * room for padding.  Extend the last bio and update
> -	 * rq->data_len accordingly.
> -	 *
> -	 * On unmap, bio_uncopy_user() will use unmodified
> -	 * bio_map_data pointed to by bio->bi_private.
> -	 */
> -	if (len & q->dma_pad_mask) {
> -		unsigned int pad_len = (q->dma_pad_mask & ~len) + 1;
> -		struct bio *tail = rq->biotail;
> -
> -		tail->bi_io_vec[tail->bi_vcnt - 1].bv_len += pad_len;
> -		tail->bi_size += pad_len;
> -
> -		rq->extra_len += pad_len;
> -	}
> -
>  	rq->buffer = rq->data = NULL;
>  	return 0;
>  unmap_rq:
> diff --git a/block/blk-merge.c b/block/blk-merge.c
> index 0f58616..2a81c87 100644
> --- a/block/blk-merge.c
> +++ b/block/blk-merge.c
> @@ -220,6 +220,13 @@ new_segment:
>  		bvprv = bvec;
>  	} /* segments in rq */
>  
> +	if (sg && (q->dma_pad_mask & rq->data_len)) {
> +		unsigned int pad_len = (q->dma_pad_mask & ~rq->data_len) + 1;
> +
> +		sg->length += pad_len;
> +		rq->extra_len += pad_len;
> +	}
> +

We're not sure it will always have the extra room.  For example, 
map_user_iov doesn't do it and there can be in-kernel issuers.  Maybe we 
need yet another flag indicating padding space availability?

-- 
tejun

  parent reply	other threads:[~2008-04-03  3:34 UTC|newest]

Thread overview: 12+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2008-04-02 16:52 [PATCH 0/2] block: blk_rq_map/unamp patches FUJITA Tomonori
2008-04-02 16:52 ` [PATCH 1/2] block: move the padding adjustment to blk_rq_map_sg FUJITA Tomonori
2008-04-02 16:53   ` [PATCH 2/2] block: change blk_rq_unmap_user to take a request instead of a bio FUJITA Tomonori
2008-04-03  3:34   ` Tejun Heo [this message]
2008-04-07 11:07     ` [PATCH 1/2] block: move the padding adjustment to blk_rq_map_sg FUJITA Tomonori
2008-04-07 11:31       ` Tejun Heo
2008-04-07 13:11         ` FUJITA Tomonori
2008-04-07 13:24           ` Tejun Heo
2008-04-07 23:35             ` FUJITA Tomonori
2008-04-08  1:49               ` Tejun Heo
2008-04-08  2:37                 ` FUJITA Tomonori
2008-04-10  1:54                   ` 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=47F45035.8060003@gmail.com \
    --to=htejun@gmail.com \
    --cc=James.Bottomley@HansenPartnership.com \
    --cc=fujita.tomonori@lab.ntt.co.jp \
    --cc=jens.axboe@oracle.com \
    --cc=linux-scsi@vger.kernel.org \
    --cc=tomof@acm.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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox