From mboxrd@z Thu Jan 1 00:00:00 1970 Return-path: Received: from metis.ext.pengutronix.de ([2001:67c:670:201:290:27ff:fe1d:cc33]) by bombadil.infradead.org with esmtps (Exim 4.92.3 #3 (Red Hat Linux)) id 1iPNWS-0008To-BU for barebox@lists.infradead.org; Tue, 29 Oct 2019 09:10:41 +0000 From: Sascha Hauer Date: Tue, 29 Oct 2019 10:10:28 +0100 Message-Id: <20191029091029.22215-4-s.hauer@pengutronix.de> In-Reply-To: <20191029091029.22215-1-s.hauer@pengutronix.de> References: <20191029091029.22215-1-s.hauer@pengutronix.de> MIME-Version: 1.0 List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: base64 Sender: "barebox" Errors-To: barebox-bounces+u.kleine-koenig=pengutronix.de@lists.infradead.org Subject: [PATCH 3/4] fs: ext4: Fix handling of sparse files To: Barebox List QWRvcHRpb24gb2YgVS1Cb290IGNvbW1pdDoKCnwgY29tbWl0IGY4MWRiNTZmMmZkNmRjMTZlZmVh ZWMyOTYxMTIxMjQ0NzY1YTFmMTEKfCBBdXRob3I6IFN0ZWZhbiBCcsO8bnMgPHN0ZWZhbi5icnVl bnNAcnd0aC1hYWNoZW4uZGU+CnwgRGF0ZTogICBTYXQgTm92IDUgMjI6MTc6MTQgMjAxNiArMDEw MAp8CnwgICAgIGV4dDQ6IEZpeCBoYW5kbGluZyBvZiBzcGFyc2UgZmlsZXMKfAp8ICAgICBBIHNw YXJzZSBmaWxlIG1heSBoYXZlIHJlZ2lvbnMgbm90IG1hcHBlZCBieSBhbnkgZXh0ZW50cywgYXQg dGhlIHN0YXJ0CnwgICAgIG9yIGF0IHRoZSBlbmQgb2YgdGhlIGZpbGUsIG9yIGFueXdoZXJlIGJl dHdlZW4sIHRodXMgbm90IGZpbmRpbmcgYQp8ICAgICBtYXRjaGluZyBleHRlbnQgcmVnaW9uIGlz IG5ldmVyIGFuIGVycm9yLgp8CnwgICAgI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