Received: from list by lists.gnu.org with archive (Exim 4.90_1) id 1iWyxC-0007RO-A7 for mharc-grub-devel@gnu.org; Tue, 19 Nov 2019 03:33:44 -0500 Received: from eggs.gnu.org ([2001:470:142:3::10]:51892) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1iWyx6-0007PY-6U for grub-devel@gnu.org; Tue, 19 Nov 2019 03:33:37 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1iWyx3-0000wi-AH for grub-devel@gnu.org; Tue, 19 Nov 2019 03:33:34 -0500 Received: from m9a0001g.houston.softwaregrp.com ([15.124.64.66]:36521) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1iWyx3-0000cm-3v for grub-devel@gnu.org; Tue, 19 Nov 2019 03:33:33 -0500 Received: FROM m9a0001g.houston.softwaregrp.com (15.121.0.191) BY m9a0001g.houston.softwaregrp.com WITH ESMTP FOR grub-devel@gnu.org; Tue, 19 Nov 2019 08:32:53 +0000 Received: from M4W0335.microfocus.com (2002:f78:1193::f78:1193) by M9W0068.microfocus.com (2002:f79:bf::f79:bf) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_CBC_SHA256_P256) id 15.1.1591.10; Tue, 19 Nov 2019 08:31:23 +0000 Received: from NAM03-CO1-obe.outbound.protection.outlook.com (15.124.8.14) by M4W0335.microfocus.com (15.120.17.147) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_CBC_SHA256_P256) id 15.1.1591.10 via Frontend Transport; Tue, 19 Nov 2019 08:31:23 +0000 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=P/LWro1IfbKpRHizHQd/1TpEfFsgGG4uTxkgHQO80bQIZr66IwGVyiI9MnaldprultumV7ZV4w5LqVlLhOoCyZc9qnYzSJcOELV9XM5API8SmIQB2UcUfbmMPoe3L88usIVdzGwVK4MaQTd2yWhUmbpvtMlcV33TNndqh3Sb8fn/2igZNvMBz8U1hYZtZYB1zKE1b80a+nsmPpfdFRca5ctt3eUU9ClD8sT1frSH4X71QmKxhvQKjbGRy40j6MF2CKO7A0dZlCYDLPHQZJqyRh3KOtbfMR/R7GNnwla0PdWJiImBBgkj5F8GHVyYKsSqEjG+0lvsRioLUohVpsF2pQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=microsoft.com; s=arcselector9901; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=IzaAr73GsVwzjUO65D+TRtiw0STZxLYF91lvG1IwlmE=; b=hXEN9yMtS2/Ug5lYxqtXON8erFYQ2yvT6TP5duapuj/Jj3526xM3bJTYqjJe+M3nwzdCtInuA7yG38+X2xBYPh7G43IDH6WZfJFQUK66vtGzmSV9cY0iFE1L6rSz9FPqAUIhRxhRLXpQwtfYVFHlNDQH5ccUpwhhNjDbxWBvqrvpF2Mm0Bm380YkGinCR7rz1ZyW5CwlSOY/N3eWGacy9zzKzMrjy36qsVJ5fPXF7IHIGltfHUwIhSaj2SGxe8oOEXqrQPd4Qa+grz9pdP8AnVET3lS6OtOFXpsO92HcWo6ihWZMLTIGg6UaLc/PZCCcIFL4qhLXSVKq+lkuERks7w== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass smtp.mailfrom=suse.com; dmarc=pass action=none header.from=suse.com; dkim=pass header.d=suse.com; arc=none Received: from BY5PR18MB3122.namprd18.prod.outlook.com (10.255.139.11) by BY5PR18MB3425.namprd18.prod.outlook.com (10.255.139.15) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.2451.29; Tue, 19 Nov 2019 08:31:22 +0000 Received: from BY5PR18MB3122.namprd18.prod.outlook.com ([fe80::297d:fc41:ae2a:13d9]) by BY5PR18MB3122.namprd18.prod.outlook.com ([fe80::297d:fc41:ae2a:13d9%5]) with mapi id 15.20.2451.031; Tue, 19 Nov 2019 08:31:22 +0000 From: Michael Chang To: The development of GNU GRUB Subject: Re: [PATCH] lvm: add lvm cache logical volume handling Thread-Topic: [PATCH] lvm: add lvm cache logical volume handling Thread-Index: AQHVg+kcyQnYrvfSdkigs0DupfD//KdoFvWAgAEsfICAALIJAIAm0IWAgABENoCAAVVhAA== Date: Tue, 19 Nov 2019 08:31:21 +0000 Message-ID: <20191119083114.GB3134@mazu> References: <20191016061516.32129-1-mchang@suse.com> <20191023104823.uxaqf5uxkr6jr3lx@tomti.i.net-space.pl> <20191024044351.GA8270@mazu> <20191024152104.u3uywhpknw2sjwmi@tomti.i.net-space.pl> <20191118080515.GA22406@mazu> <20191118120923.7x4yr2hdt4jpgpoa@tomti.i.net-space.pl> In-Reply-To: <20191118120923.7x4yr2hdt4jpgpoa@tomti.i.net-space.pl> Accept-Language: zh-TW, en-US Content-Language: en-US X-MS-Has-Attach: X-MS-TNEF-Correlator: x-clientproxiedby: HK2PR0302CA0012.apcprd03.prod.outlook.com (2603:1096:202::22) To BY5PR18MB3122.namprd18.prod.outlook.com (2603:10b6:a03:1af::11) authentication-results: spf=none (sender IP is ) smtp.mailfrom=MChang@suse.com; x-ms-exchange-messagesentrepresentingtype: 1 x-originating-ip: [60.251.47.116] x-ms-publictraffictype: Email x-ms-office365-filtering-correlation-id: 6679b5e1-2f49-4c1e-addb-08d76ccadb64 x-ms-traffictypediagnostic: BY5PR18MB3425: x-ms-exchange-purlcount: 1 x-ms-exchange-transport-forked: True x-microsoft-antispam-prvs: x-ms-oob-tlc-oobclassifiers: OLM:8273; x-forefront-prvs: 022649CC2C x-forefront-antispam-report: SFV:NSPM; SFS:(10019020)(4636009)(7916004)(366004)(396003)(39860400002)(346002)(136003)(376002)(199004)(189003)(51444003)(6916009)(478600001)(66946007)(14454004)(66446008)(966005)(64756008)(66476007)(99286004)(66556008)(316002)(8936002)(81156014)(1076003)(5660300002)(25786009)(80792005)(8676002)(81166006)(33656002)(305945005)(186003)(386003)(6506007)(55236004)(26005)(7736002)(486006)(476003)(3846002)(6116002)(33716001)(66066001)(86362001)(6246003)(2906002)(229853002)(71200400001)(6436002)(9686003)(6306002)(6512007)(14444005)(256004)(6486002)(71190400001)(76176011)(52116002)(446003)(11346002)(102836004); DIR:OUT; SFP:1102; SCL:1; SRVR:BY5PR18MB3425; H:BY5PR18MB3122.namprd18.prod.outlook.com; FPR:; SPF:None; LANG:en; PTR:InfoNoRecords; A:1; MX:1; received-spf: None (protection.outlook.com: suse.com does not designate permitted sender hosts) x-ms-exchange-senderadcheck: 1 x-microsoft-antispam: BCL:0; x-microsoft-antispam-message-info: 4WhwhW6g+J/tAqJHbpduoflYO/OaBhJZ0ACRKWdifzU9tJvTySenKx7yWG7WZDObp6JNVzRIXbNh/wLqhmE1BZv/ReYG8Dt+9bSZMJb4NdvokXfjqv0+13Ry6hbGp1bAemk9uJyF+XaOvzOqXsHrTNWhfuAAO1mWRpcXHHF922WYjRIjnWihqc8rzrEi76BLiUEVtxforf/X38pzaiVde9YxE3PvDitG6gvheCdm5CVcbzjfP2/NK9bpD/yqIszDsmnEXMgk0vVuCIpo5cdCaixeWNbQObszQoKOJ4d5LZgId6HVlI16lB9Sprq8QvkAIfpIw4qDfR9kx2ORaniQdOXtf7obPVwl3Xa5I1z3aVxAEJGeMbTcIk3osEA08IVS1kGHxVgZxaGJr+BBxRmXy0j2nQvTSy3Ip2MdYQPKvWssNZCNUFcurL+H9mZAdBoxftn12yku1208U3vgdgWoR0lpr88yDBnnV/fBkrNhwb0= Content-Type: text/plain; charset="us-ascii" Content-ID: Content-Transfer-Encoding: quoted-printable MIME-Version: 1.0 X-MS-Exchange-CrossTenant-Network-Message-Id: 6679b5e1-2f49-4c1e-addb-08d76ccadb64 X-MS-Exchange-CrossTenant-originalarrivaltime: 19 Nov 2019 08:31:21.8795 (UTC) X-MS-Exchange-CrossTenant-fromentityheader: Hosted X-MS-Exchange-CrossTenant-id: 856b813c-16e5-49a5-85ec-6f081e13b527 X-MS-Exchange-CrossTenant-mailboxtype: HOSTED X-MS-Exchange-CrossTenant-userprincipalname: 6BgWQSZlrgcFh9V5PAWJAY/jGxtCcPxnkGLKqDHIMCnjKcc8yw3KdGm4SEQrlX75 X-MS-Exchange-Transport-CrossTenantHeadersStamped: BY5PR18MB3425 X-OriginatorOrg: suse.com X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.2.x-3.x [generic] [fuzzy] X-Received-From: 15.124.64.66 X-BeenThere: grub-devel@gnu.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: The development of GNU GRUB List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 19 Nov 2019 08:33:37 -0000 On Mon, Nov 18, 2019 at 01:09:23PM +0100, Daniel Kiper wrote: > On Mon, Nov 18, 2019 at 08:05:22AM +0000, Michael Chang wrote: > > On Thu, Oct 24, 2019 at 05:21:04PM +0200, Daniel Kiper wrote: > > > On Thu, Oct 24, 2019 at 04:43:58AM +0000, Michael Chang wrote: > > > > On Wed, Oct 23, 2019 at 12:48:23PM +0200, Daniel Kiper wrote: > > > > > On Wed, Oct 16, 2019 at 06:15:30AM +0000, Michael Chang wrote: > > > > > > The lvm cache logical volume is the logical volume consisting o= f the > > > > > > original and the cache pool logical volume. The original is usu= ally on a > > > > > > larger and slower storage device while the cache pool is on a s= maller > > > > > > and faster one. The performance of the original volume can be i= mproved > > > > > > by storing the frequently used data on the cache pool to utiliz= e the > > > > > > greater performance of faster device. > > > > > > > > > > > > The default cache mode "writethrough" ensures that any data wri= tten will > > > > > > be stored both in the cache and on the origin LV, therefore gru= b can go > > > > > > straight to read the original lv as no data loss is guarenteed. > > > > > > > > > > > > The second cache mode is "writeback", which delays writing from= the > > > > > > cache pool back to the origin LV to have increased performance.= The > > > > > > drawback is potential data loss if losing the associated cache = device. > > > > > > > > > > > > During the boot time grub reads the LVM offline i.e. LVM volume= s are not > > > > > > activated and mounted, IMHO it should be fine to read directly = from > > > > > > original lv since all cached data should have been flushed back= in the > > > > > > process of taking it offline. > > > > > > > > > > Is it possible to enforce all GRUB writes to the original device = instead > > > > > of cache during installation process? > > > > > > > > I couldn't give concrete answer whether it is possible, but it soun= ds to > > > > me not good idea because in general bypassing the cache could > > > > potentially break the consistency of data and the data being cached= . > > > > > > > > Perhaps some system calls could help to sync the data out of the lv= m > > > > cache to the original LV during installation process. It seems fsyn= c > > > > does it for us, but I didn't have good idea either if it is enough. > > > > > > May I ask you to investigate that and if it is needed add required > > > install code. I mean fsync(), etc. > > > > As far as what I learned, the fsync did not write back dirty cache to > > the orginal device, instead it would update associated cache metadata t= o > > complete the write transaction with the cache device and then having th= e > > write cache up to date. Without the operation, metadata is commited > > every second and data would be completely lost/evaporated if power > > failure happened in between. > > > > To write back dirty cache, as lvm cache did not support dirty cache > > flush per block range, there'no way to do it for file. Instead the > > "cleaner" policy is implemented and can be used to write back "all" > > dirty blocks in a cache, which effectively drain all dirty cache > > gradually to attain and last in the "clean" state, which can be useful > > for shrinking or decommissioning a cache. The result and effect is not > > what we are looking for here. > > > > In conclusion, it seems no way to enforce all grub writes to the > > original device. That means grub may suffer from power failure that > > leads to dirty cache not being flushed and is inept reading data flagge= d > > as dirty in cache. But even though, as long as such case is only > > subjected to writeback mode that is generally difficult to deal with > > data lost whenever accident comes up, I'd still like to propose my > > (relatively simple) patch and treat reading dirty data in cache as an > > enhancement to be more resilience to potential data loss. >=20 > I would like to see more or less this description in the commit message. > And I think that you should add similar paragraph to the GRUB manual too. OK. I will add description to the commit message and manual in next version sent here for review. Regards, Michael >=20 > Daniel >=20 > _______________________________________________ > Grub-devel mailing list > Grub-devel@gnu.org > https://lists.gnu.org/mailman/listinfo/grub-devel