From patchwork Wed Apr 13 12:22:10 2016 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Bob Liu X-Patchwork-Id: 8822101 Return-Path: X-Original-To: patchwork-xen-devel@patchwork.kernel.org Delivered-To: patchwork-parsemail@patchwork1.web.kernel.org Received: from mail.kernel.org (mail.kernel.org [198.145.29.136]) by patchwork1.web.kernel.org (Postfix) with ESMTP id 1BC3E9F3D1 for ; Wed, 13 Apr 2016 12:25:18 +0000 (UTC) Received: from mail.kernel.org (localhost [127.0.0.1]) by mail.kernel.org (Postfix) with ESMTP id 2F9982034F for ; Wed, 13 Apr 2016 12:25:17 +0000 (UTC) Received: from lists.xenproject.org (lists.xenproject.org [192.237.175.120]) (using TLSv1.2 with cipher AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPS id 380FF202FE for ; Wed, 13 Apr 2016 12:25:16 +0000 (UTC) Received: from localhost ([127.0.0.1] helo=lists.xenproject.org) by lists.xenproject.org with esmtp (Exim 4.84_2) (envelope-from ) id 1aqJoL-0005NP-K7; Wed, 13 Apr 2016 12:22:21 +0000 Received: from mail6.bemta14.messagelabs.com ([193.109.254.103]) by lists.xenproject.org with esmtp (Exim 4.84_2) (envelope-from ) id 1aqJoK-0005N8-2W for xen-devel@lists.xen.org; Wed, 13 Apr 2016 12:22:20 +0000 Received: from [193.109.254.147] by server-8.bemta-14.messagelabs.com id 56/58-03512-BF93E075; Wed, 13 Apr 2016 12:22:19 +0000 X-Brightmail-Tracker: H4sIAAAAAAAAA+NgFjrEIsWRWlGSWpSXmKPExsXSO6nOVfeXJV+ 4wcoOE4slHxezODB6HN39mymAMYo1My8pvyKBNWPGtXfMBZvFKlZ0rGdrYPws0MXIxSEk0MEk sfRlCxOE84VR4uLVC2xdjJxAzgZGiUObRSESrYwSk/rPsHYxcnDwCmhKLJmaCVLDIqAqcXJaD wtImE1ASWL+/XSQsKhAmMTeC9PAxvAKCEqcnPmEBcQWEVCQeP3pPNguZoEtjBKfFmxgBkkIC7 hLLNrynxFkjpCAk8TWlYUgYU4BZ4mlvZsYQWxmAR2Jd30PmCFseYntb+eA2RICxhJ9s/pYJjA KzkKybhaSlllIWhYwMq9i1ChOLSpLLdI1NNdLKspMzyjJTczM0TU0NNHLTS0uTkxPzUlMKtZL zs/dxAgM23oGBsYdjD9Pex5ilORgUhLlbTPjCxfiS8pPqcxILM6ILyrNSS0+xCjDwaEkwVtnA ZQTLEpNT61Iy8wBRhBMWoKDR0mEdxpImre4IDG3ODMdInWKUVFKnLceJCEAksgozYNrg0XtJU ZZKWFeRgYGBiGegtSi3MwSVPlXjOIcjErCvDNBpvBk5pXATX8FtJgJaHHZO16QxSWJCCmpBsa U/UFek5+5Wk9Pidc9y7Px/3bP/s1xTCmPSqvLtJ1/nHq2aG6a9puHJSb7enYYeoTufzV3zZ3p W9Y0v12cWvNepMrkj+Y+Ca2zatEvLU1eav16Xr07s+VkRM2igzVPMi9/aLw5KdIx8qJ1YvYZw xuJji839Xrnyj86d3anoIp7hlPJBI0nM3SUWIozEg21mIuKEwHDH2Td1QIAAA== X-Env-Sender: bob.liu@oracle.com X-Msg-Ref: server-16.tower-27.messagelabs.com!1460550137!35311923!1 X-Originating-IP: [141.146.126.69] X-SpamReason: No, hits=0.0 required=7.0 tests=sa_preprocessor: VHJ1c3RlZCBJUDogMTQxLjE0Ni4xMjYuNjkgPT4gMjc3MjE4\n X-StarScan-Received: X-StarScan-Version: 8.28; banners=-,-,- X-VirusChecked: Checked Received: (qmail 23840 invoked from network); 13 Apr 2016 12:22:18 -0000 Received: from aserp1040.oracle.com (HELO aserp1040.oracle.com) (141.146.126.69) by server-16.tower-27.messagelabs.com with DHE-RSA-AES256-GCM-SHA384 encrypted SMTP; 13 Apr 2016 12:22:18 -0000 Received: from aserv0021.oracle.com (aserv0021.oracle.com [141.146.126.233]) by aserp1040.oracle.com (Sentrion-MTA-4.3.2/Sentrion-MTA-4.3.2) with ESMTP id u3DCMFOA011110 (version=TLSv1 cipher=DHE-RSA-AES256-SHA bits=256 verify=OK); Wed, 13 Apr 2016 12:22:15 GMT Received: from userv0122.oracle.com (userv0122.oracle.com [156.151.31.75]) by aserv0021.oracle.com (8.13.8/8.13.8) with ESMTP id u3DCMENQ014721 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256 verify=OK); Wed, 13 Apr 2016 12:22:15 GMT Received: from abhmp0001.oracle.com (abhmp0001.oracle.com [141.146.116.7]) by userv0122.oracle.com (8.14.4/8.14.4) with ESMTP id u3DCMEq4023809; Wed, 13 Apr 2016 12:22:14 GMT Received: from [10.191.10.18] (/10.191.10.18) by default (Oracle Beehive Gateway v4.0) with ESMTP ; Wed, 13 Apr 2016 05:22:13 -0700 Message-ID: <570E39F2.2010904@oracle.com> Date: Wed, 13 Apr 2016 20:22:10 +0800 From: Bob Liu User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:17.0) Gecko/20130308 Thunderbird/17.0.4 MIME-Version: 1.0 To: Bob Liu References: <1460023200-20255-1-git-send-email-bob.liu@oracle.com> In-Reply-To: <1460023200-20255-1-git-send-email-bob.liu@oracle.com> X-Source-IP: aserv0021.oracle.com [141.146.126.233] Cc: jgross@suse.com, xen-devel@lists.xen.org, Paul.Durrant@citrix.com, david.vrabel@citrix.com, Ian.Jackson@citrix.com, roger.pau@citrix.com Subject: Re: [Xen-devel] [RFC PATCH] Data integrity extension support for xen-block X-BeenThere: xen-devel@lists.xen.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: Xen developer discussion List-Unsubscribe: , List-Post: List-Help: List-Subscribe: , Errors-To: xen-devel-bounces@lists.xen.org Sender: "Xen-devel" X-Spam-Status: No, score=-4.2 required=5.0 tests=BAYES_00, RCVD_IN_DNSWL_MED, UNPARSEABLE_RELAY autolearn=unavailable version=3.3.1 X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on mail.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP On 04/07/2016 06:00 PM, Bob Liu wrote: > * What's data integrity extension and why? > Modern filesystems feature checksumming of data and metadata to protect against > data corruption. However, the detection of the corruption is done at read time > which could potentially be months after the data was written. At that point the > original data that the application tried to write is most likely lost. > > The solution in Linux is the data integrity framework which enables protection > information to be pinned to I/Os and sent to/received from controllers that > support it. struct bio has been extended with a pointer to a struct bip which > in turn contains the integrity metadata. The bip is essentially a trimmed down > bio with a bio_vec and some housekeeping. > > * Issues when xen-block get involved. > xen-blkfront only transmits the normal data of struct bio while the integrity > metadata buffer(struct bio_integrity_payload in each bio) is ignored. > > * Proposal of transmitting bio integrity payload. > Adding an extra request following the normal data request, this extra request > contains the integrity payload. > The xen-blkback will reconstruct an new bio with both received normal data and > integrity metadata. > > Welcome any better ideas, thank you! > A simpler possible solution: bob@boliuliu:~/xen$ git diff xen/include/public/io/blkif.h diff --git a/xen/include/public/io/blkif.h b/xen/include/public/io/blkif.h index 3d8d39f..34581a5 100644 --- a/xen/include/public/io/blkif.h +++ b/xen/include/public/io/blkif.h @@ -689,6 +689,11 @@ struct blkif_request_segment { struct blkif_request { uint8_t operation; /* BLKIF_OP_??? */ uint8_t nr_segments; /* number of segments */ + /* + * Recording how many segments are data integrity segments. + * raw data_segments + dix_segments = nr_segments + */ + uint8_t dix_segments; blkif_vdev_t handle; /* only for read/write requests */ uint64_t id; /* private guest value, echoed in resp */ blkif_sector_t sector_number;/* start sector idx on disk (r/w only) */ @@ -715,6 +720,11 @@ struct blkif_request_indirect { uint8_t operation; /* BLKIF_OP_INDIRECT */ uint8_t indirect_op; /* BLKIF_OP_{READ/WRITE} */ uint16_t nr_segments; /* number of segments */ + /* + * Recording how many segments are data integrity segments. + * raw data_segments + dix_segments = nr_segments + */ + uint16_t dix_segments; uint64_t id; /* private guest value, echoed in resp */ blkif_sector_t sector_number;/* start sector idx on disk (r/w only) */ blkif_vdev_t handle; /* same as for read/write requests */