linux-nvme.lists.infradead.org archive mirror
 help / color / mirror / Atom feed
From: axboe@kernel.dk (Jens Axboe)
Subject: [PATCH 3/3] block: Refuse adding appending a gapped integrity page to a bio
Date: Wed, 15 Jul 2015 09:28:23 -0600	[thread overview]
Message-ID: <55A67C17.4080706@kernel.dk> (raw)
In-Reply-To: <1436966356-8979-4-git-send-email-sagig@mellanox.com>

On 07/15/2015 07:19 AM, Sagi Grimberg wrote:
> This is only theoretical at the moment given that the only
> subsystems that generate integrity payloads are the block layer
> itself and the scsi target. But when we will expose integrity
> meta-data to user-space, we'll need to refuse appending a page
> with a gap when QUEUE_FLAG_SG_GAPS flag is on.
>
> Signed-off-by: Sagi Grimberg <sagig at mellanox.com>
> ---
>   block/bio-integrity.c | 9 +++++++++
>   1 file changed, 9 insertions(+)
>
> diff --git a/block/bio-integrity.c b/block/bio-integrity.c
> index 5cbd5d9..a18edb8 100644
> --- a/block/bio-integrity.c
> +++ b/block/bio-integrity.c
> @@ -140,6 +140,15 @@ int bio_integrity_add_page(struct bio *bio, struct page *page,
>
>   	iv = bip->bip_vec + bip->bip_vcnt;
>
> +	if (bip->bip_vcnt) {
> +		struct request_queue *q = bdev_get_queue(bio->bi_bdev);
> +		struct bio_vec *iv_prev = &bip->bip_vec[bip->bip_vcnt - 1];
> +
> +		if (q->queue_flags & (1 << QUEUE_FLAG_SG_GAPS) &&
> +		    bvec_gap_to_prev(iv_prev, offset))
> +			return 0;
> +	}

This chunk of code largely ends up being duplicated in several places 
with your patches, might be a good idea to pull that into a helper 
function. Then you can add the comment in one place as well :-)

-- 
Jens Axboe

  reply	other threads:[~2015-07-15 15:28 UTC|newest]

Thread overview: 29+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2015-07-15 13:19 [PATCH 0/3] Fixes for gapped scatters Sagi Grimberg
2015-07-15 13:19 ` [PATCH 1/3] block: copy multi iovec user mappings if QUEUE_FLAG_SG_GAPS is set Sagi Grimberg
2015-07-16 16:47   ` Keith Busch
2015-07-16 16:49     ` Jens Axboe
2015-07-16 19:47       ` Matthew Wilcox
2015-07-17 15:26         ` Jens Axboe
2015-07-17  7:44       ` Christoph Hellwig
2015-07-17  7:43     ` Christoph Hellwig
2015-07-15 13:19 ` [PATCH 2/3] block: Refuse request/bio merges with gaps in the integrity payload Sagi Grimberg
2015-07-15 13:19 ` [PATCH 3/3] block: Refuse adding appending a gapped integrity page to a bio Sagi Grimberg
2015-07-15 15:28   ` Jens Axboe [this message]
2015-07-16  9:26     ` Christoph Hellwig
2015-07-16 15:58       ` Jens Axboe
2015-07-19 15:18         ` Sagi Grimberg
2015-08-19  9:40           ` Christoph Hellwig
2015-08-19 10:30             ` Sagi Grimberg
2015-08-19 10:42               ` Christoph Hellwig
2015-09-02  8:04                 ` Sagi Grimberg
2015-09-02 14:37                   ` Jens Axboe
2015-09-02 17:30                     ` Sagi Grimberg
2015-09-02 18:03                       ` Jens Axboe
2015-09-02 19:18                       ` Jens Axboe
2015-09-03  9:07                         ` Sagi Grimberg
2015-09-03 14:53                           ` Jens Axboe
2015-09-03 15:04                           ` Jens Axboe
2015-09-03 15:41                             ` Sagi Grimberg
2015-09-03 15:52                               ` Jens Axboe
2015-07-17  1:50       ` Martin K. Petersen
2015-07-17  1:39 ` [PATCH 0/3] Fixes for gapped scatters Martin K. Petersen

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=55A67C17.4080706@kernel.dk \
    --to=axboe@kernel.dk \
    /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).