From patchwork Wed Jan 4 19:23:51 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Milan Broz X-Patchwork-Id: 9497267 X-Patchwork-Delegate: snitzer@redhat.com Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork.web.codeaurora.org (Postfix) with ESMTP id 6CE9060413 for ; Wed, 4 Jan 2017 19:25:50 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 5C4B328174 for ; Wed, 4 Jan 2017 19:25:50 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 4C50D2824F; Wed, 4 Jan 2017 19:25:50 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on pdx-wl-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-6.3 required=2.0 tests=BAYES_00, DKIM_ADSP_CUSTOM_MED, DKIM_SIGNED, FREEMAIL_FROM, RCVD_IN_DNSWL_HI, RCVD_IN_SORBS_SPAM, T_DKIM_INVALID autolearn=ham version=3.3.1 Received: from mx3-phx2.redhat.com (mx3-phx2.redhat.com [209.132.183.24]) (using TLSv1 with cipher DHE-RSA-AES256-SHA (256/256 bits)) (No client certificate requested) by mail.wl.linuxfoundation.org (Postfix) with ESMTPS id D0B5628174 for ; Wed, 4 Jan 2017 19:25:49 +0000 (UTC) Received: from lists01.pubmisc.prod.ext.phx2.redhat.com (lists01.pubmisc.prod.ext.phx2.redhat.com [10.5.19.33]) by mx3-phx2.redhat.com (8.13.8/8.13.8) with ESMTP id v04JOGrg003784; Wed, 4 Jan 2017 14:24:17 -0500 Received: from int-mx13.intmail.prod.int.phx2.redhat.com (int-mx13.intmail.prod.int.phx2.redhat.com [10.5.11.26]) by lists01.pubmisc.prod.ext.phx2.redhat.com (8.13.8/8.13.8) with ESMTP id v04JOGak029923 for ; Wed, 4 Jan 2017 14:24:16 -0500 Received: from mx1.redhat.com (ext-mx02.extmail.prod.ext.phx2.redhat.com [10.5.110.26]) by int-mx13.intmail.prod.int.phx2.redhat.com (8.14.4/8.14.4) with ESMTP id v04JOGTv007318 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-GCM-SHA384 bits=256 verify=NO) for ; Wed, 4 Jan 2017 14:24:16 -0500 Received: from mail-wm0-f66.google.com (mail-wm0-f66.google.com [74.125.82.66]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by mx1.redhat.com (Postfix) with ESMTPS id BC8135455F for ; Wed, 4 Jan 2017 19:24:15 +0000 (UTC) Received: by mail-wm0-f66.google.com with SMTP id l2so67628039wml.2 for ; Wed, 04 Jan 2017 11:24:14 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=from:to:cc:subject:date:message-id:in-reply-to:references :in-reply-to:references; bh=T4A5kRSPgdE/UoPJpTgY/lqw28vQND8HKNjcRfY4jZ8=; b=bcl5yUNFpwuGI5ajWWCkjS8VliL/+8JL4xpI2okqwzrcIRHSkXZknE/Dol/LHhQNg/ rpNReyx6zQiKe94zjUZl00DaAzq6dqJxNRMEh4YPRQcr9Ripmr8rlttF637AWVvXfyit rZxeIC5q7lm2UekyBR4w1Eo67tPaJDJOpyQodY0K9sTY8ldjlk2F01sWFqbST06paYJx FPWxYbcSz1jDZd3JaKf9lxVATH+l4mliD3tfxNnWXrs5Bk0Y5b6dm9xcVwEuKC5J631X L0MuRSRPflhZUeHpLja7Jy1L6DDnvNym77JOlWrdMMfPBCB9y1Le+e2vUhy7zYV4Xpuz ATCg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:in-reply-to:references; bh=T4A5kRSPgdE/UoPJpTgY/lqw28vQND8HKNjcRfY4jZ8=; b=as/V3OmzK3Yc7XhcnTO+Kdh6NxvJiD0XoC3TPSfTcPKjjTkls9T0bqsLEGCbwSe+dz pHGepr9prLcPL9AMG2AWcz03I8ZMOdLSCL6vpJX2qHI2r/Kq0ggP9eB+0A80IL9iwwzg 8dF5ZDxYRm6XJoEufb/hkx78E5GuqdyC6AZAo5bp2zXBIiLmwYUB4B10/YrXNogsWNTd OflnYBp2itFA8ybqgbkSt2V4aaAOcZYbhbb2a9N/VmAiIbQX4eshVVxDBHfPmD0IE7Xg fFMNzF40cOkf3xAGju4n7zz9YWpJvoLjCJcKRAxcsQFhrtC04b6HV52dmYIt+3gKlk/Z hHGw== X-Gm-Message-State: AIkVDXLqlLIDbsCyZ3SqhEav08vMHpcgxUUBzp/jkppi3S4lKShFMWjckR4Sz7l47d5+MQ== X-Received: by 10.28.94.205 with SMTP id s196mr55911777wmb.1.1483557853200; Wed, 04 Jan 2017 11:24:13 -0800 (PST) Received: from merlot.mazyland.net (dynamic-2a00-1028-96c1-4f6a-31f0-04a9-8629-703a.ipv6.broadband.iol.cz. [2a00:1028:96c1:4f6a:31f0:4a9:8629:703a]) by smtp.googlemail.com with ESMTPSA id f126sm96173092wme.22.2017.01.04.11.24.12 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Wed, 04 Jan 2017 11:24:12 -0800 (PST) From: Milan Broz To: dm-devel@redhat.com Date: Wed, 4 Jan 2017 20:23:51 +0100 Message-Id: In-Reply-To: References: In-Reply-To: References: X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.26]); Wed, 04 Jan 2017 19:24:16 +0000 (UTC) X-Greylist: inspected by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.26]); Wed, 04 Jan 2017 19:24:16 +0000 (UTC) for IP:'74.125.82.66' DOMAIN:'mail-wm0-f66.google.com' HELO:'mail-wm0-f66.google.com' FROM:'gmazyland@gmail.com' RCPT:'' X-RedHat-Spam-Score: 1.17 * (BAYES_50, DKIM_SIGNED, DKIM_VALID, DKIM_VALID_AU, FREEMAIL_FROM, RCVD_IN_DNSWL_NONE, RCVD_IN_MSPIKE_H3, RCVD_IN_MSPIKE_WL, RCVD_IN_SORBS_SPAM, SPF_PASS) 74.125.82.66 mail-wm0-f66.google.com 74.125.82.66 mail-wm0-f66.google.com X-Scanned-By: MIMEDefang 2.68 on 10.5.11.26 X-Scanned-By: MIMEDefang 2.78 on 10.5.110.26 X-loop: dm-devel@redhat.com Cc: Milan Broz Subject: [dm-devel] [RFC PATCH 1/4] dm-table: Add flag to allow own target handling of integrity metadata. X-BeenThere: dm-devel@redhat.com X-Mailman-Version: 2.1.12 Precedence: junk List-Id: device-mapper development List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , MIME-Version: 1.0 Sender: dm-devel-bounces@redhat.com Errors-To: dm-devel-bounces@redhat.com X-Virus-Scanned: ClamAV using ClamSMTP This patch adds DM_TARGET_INTEGRITY flag that specifies that bio integrity metadata is not inherited but implemented in target itself. Signed-off-by: Milan Broz --- drivers/md/dm-table.c | 11 +++++++++++ include/linux/device-mapper.h | 6 ++++++ 2 files changed, 17 insertions(+) diff --git a/drivers/md/dm-table.c b/drivers/md/dm-table.c index 0a427de23ed2..95094c133d6c 100644 --- a/drivers/md/dm-table.c +++ b/drivers/md/dm-table.c @@ -47,6 +47,7 @@ struct dm_table { bool integrity_supported:1; bool singleton:1; bool all_blk_mq:1; + unsigned integrity_added:1; /* * Indicates the rw permissions for the new logical @@ -725,6 +726,9 @@ int dm_table_add_target(struct dm_table *t, const char *type, t->immutable_target_type = tgt->type; } + if (dm_target_has_integrity(tgt->type)) + t->integrity_added = 1; + tgt->table = t; tgt->begin = start; tgt->len = len; @@ -1168,6 +1172,10 @@ static int dm_table_register_integrity(struct dm_table *t) struct mapped_device *md = t->md; struct gendisk *template_disk = NULL; + /* If target handles integrity itself do not register it here. */ + if (t->integrity_added) + return 0; + template_disk = dm_table_get_integrity_disk(t); if (!template_disk) return 0; @@ -1394,6 +1402,9 @@ static void dm_table_verify_integrity(struct dm_table *t) { struct gendisk *template_disk = NULL; + if (t->integrity_added) + return; + if (t->integrity_supported) { /* * Verify that the original integrity profile diff --git a/include/linux/device-mapper.h b/include/linux/device-mapper.h index ef7962e84444..b508e8169133 100644 --- a/include/linux/device-mapper.h +++ b/include/linux/device-mapper.h @@ -224,6 +224,12 @@ struct target_type { */ typedef unsigned (*dm_num_write_bios_fn) (struct dm_target *ti, struct bio *bio); +/* + * A target implements own bio data integrity. + */ +#define DM_TARGET_INTEGRITY 0x00000010 +#define dm_target_has_integrity(type) ((type)->features & DM_TARGET_INTEGRITY) + struct dm_target { struct dm_table *table; struct target_type *type;