From nobody Fri Apr 19 21:46:58 2024 Delivered-To: importer@patchew.org Received-SPF: pass (zohomail.com: domain of groups.io designates 66.175.222.108 as permitted sender) client-ip=66.175.222.108; envelope-from=bounce+27952+83923+1787277+3901457@groups.io; helo=mail02.groups.io; Authentication-Results: mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of groups.io designates 66.175.222.108 as permitted sender) smtp.mailfrom=bounce+27952+83923+1787277+3901457@groups.io ARC-Seal: i=1; a=rsa-sha256; t=1637644514; cv=none; d=zohomail.com; s=zohoarc; b=N0zbLDOtl/m1T307VYwCZpedIyH/ZKjiPQGyBl8K769K03fmpHnFKyaL5HuouuoprZ+P/iGlMbKCW0fD4KM1YiXFkqCq7ipZeJelXA1RJ0/M7upmw4InH4O72l64kvuXj52gabXlMTCdQPZNHi/4yU9VKk2sVo31xEfalR4BzqU= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1637644514; h=Content-Type:Date:From:In-Reply-To:List-Subscribe:List-Id:List-Help:List-Unsubscribe:MIME-Version:Message-ID:Reply-To:References:Sender:Subject:To; bh=g+BG2mAF1h9ntUf/Imf5GZLzb0RECxUTtSjpG1JLktM=; b=erSmPnFh7WLK4kSNmT3d+5udVqNS5LwpB87JPP4uvMBNS+2At1tZlHWxxiT8obb4/4/+CbVCHX7lR3HOufBbgGge7LlbyFDTvsedsD1H5JLdLEYeBBB+WWc1NFfmdX88Nsm/AtmtZvYnDbG2iB396nIrQsGcfIfK9WGS7wAqSCM= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of groups.io designates 66.175.222.108 as permitted sender) smtp.mailfrom=bounce+27952+83923+1787277+3901457@groups.io Received: from mail02.groups.io (mail02.groups.io [66.175.222.108]) by mx.zohomail.com with SMTPS id 1637644514004202.49918769757437; Mon, 22 Nov 2021 21:15:14 -0800 (PST) Return-Path: X-Received: by 127.0.0.2 with SMTP id GSCiYY1788612xqjdR5x0jT8; Mon, 22 Nov 2021 21:15:12 -0800 X-Received: from mail.byosoft.com.cn (mail.byosoft.com.cn [58.240.74.242]) by mx.groups.io with SMTP id smtpd.web12.7491.1637644509572738154 for ; Mon, 22 Nov 2021 21:15:11 -0800 X-Received: from DESKTOPS6D0PVI ([58.246.60.130]) (envelope-sender ) by 192.168.6.13 with ESMTP for ; Tue, 23 Nov 2021 13:15:06 +0800 X-WM-Sender: gaoliming@byosoft.com.cn X-Originating-IP: 58.246.60.130 X-WM-AuthFlag: YES X-WM-AuthUser: gaoliming@byosoft.com.cn From: "gaoliming" To: , References: <16B25AD607AC994B.20978@groups.io> <004a01d7dce5$1fcf9bc0$5f6ed340$@byosoft.com.cn> In-Reply-To: Subject: =?UTF-8?B?5Zue5aSNOiBbZWRrMi1kZXZlbF0gW2VkazItcGxhdGZvcm1zIFBBVENIXSBFeHQ0UGtnOiBBZGQgdW5pbml0aWFsaXplZCBleHRlbnRzIHN1cHBvcnQ=?= Date: Tue, 23 Nov 2021 13:15:07 +0800 Message-ID: <00bb01d7e029$14d0ace0$3e7206a0$@byosoft.com.cn> MIME-Version: 1.0 Thread-Index: AQIl2jZuJP2eVKOy/BCVmUZS01qFsgHKSBmNAcEchJkA/+HEsAGTvrvgq0OlOdA= Precedence: Bulk List-Unsubscribe: List-Subscribe: List-Help: Sender: devel@edk2.groups.io List-Id: Mailing-List: list devel@edk2.groups.io; contact devel+owner@edk2.groups.io Reply-To: devel@edk2.groups.io,gaoliming@byosoft.com.cn X-Gm-Message-State: Naj8mVkYcuYdKvnqBaOpz489x1787277AA= Content-Type: multipart/alternative; boundary="----=_NextPart_000_00BC_01D7E06C.22F5E8B0" Content-Language: zh-cn DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=groups.io; q=dns/txt; s=20140610; t=1637644512; bh=hJDWzPwB/0gC2GNVJMgJ3012WnVca/Lb1e7I6vu5q9s=; h=Content-Type:Date:From:Reply-To:Subject:To; b=LIkVwzcCIbIygwp+DZ64KgcOLdZ73LUUZ13W9tzY6IM7sWsKH7qOaOpZgmNC1xFYatF CI6nrfMibiODuEZtILGZFI07I6PrM6S9t2M30RFQ8KrbYnhXd5YdJRweugYV4H7cVadaX fnKTsNncxFWcbmqyfIRqkRTFpeLoIXj/O1o= X-ZohoMail-DKIM: pass (identity @groups.io) X-ZM-MESSAGEID: 1637644515662100005 ------=_NextPart_000_00BC_01D7E06C.22F5E8B0 Content-Transfer-Encoding: quoted-printable MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Pedro: I submit BZ https://bugzilla.tianocore.org/show_bug.cgi?id=3D3745 to reque= st Ext2/Ext3 file system. =20 Thanks Liming =E5=8F=91=E4=BB=B6=E4=BA=BA: devel@edk2.groups.io = =E4=BB=A3=E8=A1=A8 Pedro Falcato =E5=8F=91=E9=80=81=E6=97=B6=E9=97=B4: 2021=E5=B9=B411=E6=9C=8819=E6=97=A5 1= 1:10 =E6=94=B6=E4=BB=B6=E4=BA=BA: edk2-devel-groups-io ; L= iming Gao =E4=B8=BB=E9=A2=98: Re: [edk2-devel] [edk2-platforms PATCH] Ext4Pkg: Add un= initialized extents support =20 Hi Liming, =20 Thanks for the RB :) I'll be pushing this soon. =20 Ext4Dxe at the moment only supports ext4 due to a lack of need for ext2/3 (= since ext4 itself is already decently old), but with a bit of work it can s= upport all the previous ext's. If you have a need for it, feel free to let = me know and file a bugzilla, and I'll take a stab at it in the future. =20 Best regards, Pedro =20 On Fri, Nov 19, 2021 at 1:31 AM gaoliming > wrote: Pedro=EF=BC=9A I review this patch. This change looks good. Reviewed-by: Liming Gao > =20 Besides, I want to confirm whether Ext4Dxe support Ext2/Ext3/Ext4 file sys= tem or only Ext4 file system. =20 Thanks Liming =E5=8F=91=E4=BB=B6=E4=BA=BA: devel@edk2.groups.io > =E4=BB=A3=E8=A1= =A8 Pedro Falcato =E5=8F=91=E9=80=81=E6=97=B6=E9=97=B4: 2021=E5=B9=B411=E6=9C=8819=E6=97=A5 4= :31 =E6=94=B6=E4=BB=B6=E4=BA=BA: edk2-devel-groups-io >; Pedro Falcato > =E6=8A=84=E9=80=81: Leif Lindholm >; Michael D Kinney > =E4=B8=BB=E9=A2=98: Re: [edk2-devel] [edk2-platforms PATCH] Ext4Pkg: Add un= initialized extents support =20 It's been over two weeks and a quick Rb would be great, since this patch is= relatively trivial and it would fix a bug. Again, if I'm doing anything wr= ong, please let me know. =20 =20 Thanks, Pedro =20 On Mon, Nov 1, 2021 at 9:29 PM Pedro Falcato > wrote: Quick PS: I CC'd the edk2-platforms stewards on the patch because there's n= o co-maintainer, and from what I gathered, that's what I'm supposed to do. = If I'm mistaken, please let me know. =20 Thanks, Pedro =20 On Fri, Oct 29, 2021 at 2:04 AM Pedro Falcato via groups.io > wr= ote: Uninitialized extents are special extents that have blocks allocated, but are specified as uninitialized and therefore, reads behave the same as file holes (reads 0), while writes already have blocks allocated. Cc: Leif Lindholm > Cc: Michael D Kinney > Signed-off-by: Pedro Falcato > --- Features/Ext4Pkg/Ext4Dxe/Ext4Disk.h | 8 ++++++++ Features/Ext4Pkg/Ext4Dxe/Ext4Dxe.h | 21 +++++++++++++++++++++ Features/Ext4Pkg/Ext4Dxe/Extents.c | 24 ++++++++++++++++++++++-- Features/Ext4Pkg/Ext4Dxe/Inode.c | 14 +++++++++++--- 4 files changed, 62 insertions(+), 5 deletions(-) diff --git a/Features/Ext4Pkg/Ext4Dxe/Ext4Disk.h b/Features/Ext4Pkg/Ext4Dxe= /Ext4Disk.h index 070eb5a9c8..756b1bbe10 100644 --- a/Features/Ext4Pkg/Ext4Dxe/Ext4Disk.h +++ b/Features/Ext4Pkg/Ext4Dxe/Ext4Disk.h @@ -448,6 +448,14 @@ typedef struct { UINT32 eb_checksum; } EXT4_EXTENT_TAIL; +/** + * EXT4 has this feature called uninitialized extents: + * An extent has a maximum of 32768 blocks (2^15 or 1 << 15). + * When we find an extent with > 32768 blocks, this extent is called unini= tialized. + * Long story short, it's an extent that behaves as a file hole but has bl= ocks already allocated. + */ +#define EXT4_EXTENT_MAX_INITIALIZED (1 << 15) + typedef UINT64 EXT4_BLOCK_NR; typedef UINT32 EXT4_INO_NR; diff --git a/Features/Ext4Pkg/Ext4Dxe/Ext4Dxe.h b/Features/Ext4Pkg/Ext4Dxe/= Ext4Dxe.h index a9b932ed52..1d9a4ac6ba 100644 --- a/Features/Ext4Pkg/Ext4Dxe/Ext4Dxe.h +++ b/Features/Ext4Pkg/Ext4Dxe/Ext4Dxe.h @@ -1131,4 +1131,25 @@ Ext4SuperblockCheckMagic ( IN EFI_BLOCK_IO_PROTOCOL *BlockIo ); +/** + Check if the extent is uninitialized + + @param[in] Extent Pointer to the EXT4_EXTENT + + @returns True if uninitialized, else false. +**/ +#define EXT4_EXTENT_IS_UNINITIALIZED(Extent) ((Extent)->ee_len > EXT4_EXTE= NT_MAX_INITIALIZED) + +/** + Retrieves the extent's length, dealing with uninitialized extents in th= e process. + + @param[in] Extent Pointer to the EXT4_EXTENT + + @returns Extent's length, in filesystem blocks. +**/ +EXT4_BLOCK_NR +Ext4GetExtentLength ( + IN CONST EXT4_EXTENT *Extent + ); + #endif diff --git a/Features/Ext4Pkg/Ext4Dxe/Extents.c b/Features/Ext4Pkg/Ext4Dxe/= Extents.c index 5fa2fe098d..1ae175f417 100644 --- a/Features/Ext4Pkg/Ext4Dxe/Extents.c +++ b/Features/Ext4Pkg/Ext4Dxe/Extents.c @@ -332,7 +332,7 @@ Ext4GetExtent ( return EFI_NO_MAPPING; } - if (!(LogicalBlock >=3D Ext->ee_block && Ext->ee_block + Ext->ee_len > L= ogicalBlock)) { + if (!(LogicalBlock >=3D Ext->ee_block && Ext->ee_block + Ext4GetExtentLe= ngth (Ext) > LogicalBlock)) { // This extent does not cover the block if (Buffer !=3D NULL) { FreePool (Buffer); @@ -413,7 +413,7 @@ Ext4ExtentsMapKeyCompare ( Extent =3D UserStruct; Block =3D (UINT32)(UINTN)StandaloneKey; - if (Block >=3D Extent->ee_block && Block < Extent->ee_block + Extent->ee= _len) { + if (Block >=3D Extent->ee_block && Block < Extent->ee_block + Ext4GetExt= entLength (Extent)) { return 0; } @@ -593,3 +593,23 @@ Ext4CheckExtentChecksum ( return Tail->eb_checksum =3D=3D Ext4CalculateExtentChecksum (ExtHeader, = File); } + +/** + Retrieves the extent's length, dealing with uninitialized extents in th= e process. + + @param[in] Extent Pointer to the EXT4_EXTENT + + @returns Extent's length, in filesystem blocks. +**/ +EXT4_BLOCK_NR +Ext4GetExtentLength ( + IN CONST EXT4_EXTENT *Extent + ) +{ + // If it's an unintialized extent, the true length is ee_len - 2^15 + if (EXT4_EXTENT_IS_UNINITIALIZED (Extent)) { + return Extent->ee_len - EXT4_EXTENT_MAX_INITIALIZED; + } + + return Extent->ee_len; +} diff --git a/Features/Ext4Pkg/Ext4Dxe/Inode.c b/Features/Ext4Pkg/Ext4Dxe/In= ode.c index 63cecec1f7..48bfe026a3 100644 --- a/Features/Ext4Pkg/Ext4Dxe/Inode.c +++ b/Features/Ext4Pkg/Ext4Dxe/Inode.c @@ -144,11 +144,19 @@ Ext4Read ( HasBackingExtent =3D Status !=3D EFI_NO_MAPPING; - if (!HasBackingExtent) { + if (!HasBackingExtent || EXT4_EXTENT_IS_UNINITIALIZED (&Extent)) { + HoleOff =3D BlockOff; - HoleLen =3D Partition->BlockSize - HoleOff; + + if (!HasBackingExtent) { + HoleLen =3D Partition->BlockSize - HoleOff; + } else { + // Uninitialized extents behave exactly the same as file holes. + HoleLen =3D Ext4GetExtentLength (&Extent) - HoleOff; + } + WasRead =3D HoleLen > RemainingRead ? RemainingRead : HoleLen; - // Potential improvement: In the future, we could get the hole's tota + // Potential improvement: In the future, we could get the file hole'= s total // size and memset all that SetMem (Buffer, WasRead, 0); } else { --=20 2.33.1.windows.1 ------------ Groups.io Links: You receive all messages sent to this group. View/Reply Online (#82879): https://edk2.groups.io/g/devel/message/82879 Mute This Topic: https://groups.io/mt/86667035/5946980 Group Owner: devel+owner@edk2.groups.io =20 Unsubscribe: https://edk2.groups.io/g/devel/unsub [pedro.falcato@gmail.com = ] ------------ =20 --=20 Pedro Falcato --=20 Pedro Falcato --=20 Pedro Falcato -=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D- Groups.io Links: You receive all messages sent to this group. View/Reply Online (#83923): https://edk2.groups.io/g/devel/message/83923 Mute This Topic: https://groups.io/mt/87253296/1787277 Group Owner: devel+owner@edk2.groups.io Unsubscribe: https://edk2.groups.io/g/devel/unsub [importer@patchew.org] -=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D- ------=_NextPart_000_00BC_01D7E06C.22F5E8B0 Content-Type: text/html; charset="UTF-8" Content-Transfer-Encoding: quoted-printable

Pedro:

=C2=A0I submit BZ https://bugzilla.tianocore.org/show_bu= g.cgi?id=3D3745 to request Ext2/Ext3 file system.

=

 

Thanks

Liming

=E5=8F=91=E4=BB=B6=E4=BA=BA: devel@edk2.groups.io <devel@edk2.groups.io> = =E4=BB= =A3=E8=A1=A8 Pedro Falcato
=E5=8F=91=E9=80=81=E6=97=B6=E9=97= =B4: 2021=E5=B9=B411<= /span>=E6=9C=8819=E6=97=A5 11:= 10
=E6=94=B6=E4=BB=B6=E4=BA=BA:<= span lang=3DEN-US> edk2-devel-groups-io <devel@edk2.groups.io>; Limin= g Gao <gaoliming@byosoft.com.cn>
=E4=B8=BB=E9=A2=98:
Re: [edk2-devel] [edk2-platfo= rms PATCH] Ext4Pkg: Add uninitialized extents support

 

Hi Liming,

=  

T= hanks for the RB :) I'll be pushing this soon.

<= div>

 

Ext4Dxe at the moment only = supports ext4 due to a lack of need for ext2/3 (since ext4 itself is alread= y decently old), but with a bit of work it can support all the previous ext= 's. If you have a need for it, feel free to let me know and file a bugzilla= , and I'll take a stab at it in the future.

 

=

Best regards,

Pedro

 

On Fri, Nov = 19, 2021 at 1:31 AM gaoliming <gaoliming@byosoft.com.cn> wrote:

=

Pedro=EF=BC=9A

 I review this patch. This change looks good. Re= viewed-by: Liming Gao <gaoliming@byosoft.com.cn>

 

 Besides, I want to confirm whether Ext4Dxe support E= xt2/Ext3/Ext4 file system or only Ext4 file system.

 

Thanks

=

Liming

=E5=8F=91=E4=BB=B6=E4=BA=BA: devel@edk2.groups.io <devel@edk2.groups.io> =E4=BB=A3=E8=A1=A8 = Pedro Falcato
=E5=8F=91=E9=80=81=E6=97=B6=E9=97=B4: 2021=E5=B9=B411=E6=9C= =8819=E6=97=A5 4:31
= =E6=94=B6=E4=BB=B6=E4=BA=BA: edk2-devel-groups-io <devel@edk2.groups.io>; Pedro Falcato <pedro.falcato@gmail.com= >
=E6=8A=84=E9=80=81: Leif Lindholm <leif@nuviainc.com>; Michael D Kinney <michael.d.kinney@intel.com= >
=E4=B8=BB=E9=A2=98: Re: [edk2-devel] [edk2-platforms PATCH] Ext4Pkg: Add uninit= ialized extents support
<= /p>

 

<= div>

It's been over two weeks and a quick Rb would= be great, since this patch is relatively trivial and it would fix a bug. A= gain, if I'm doing anything wrong, please let me know.

 

 

<= span lang=3DEN-US>Thanks,

Pedro

=  

On Mon, Nov= 1, 2021 at 9:29 PM Pedro Falcato <pedro.falcato@gmail.com> wrote:

Quick PS: I CC'd t= he edk2-platforms stewards on the patch because there's no co-maintainer, a= nd from what I gathered, that's what I'm supposed to do. If I'm mistaken, p= lease let me know.

&nbs= p;

Thanks,

Pedro=

 

=

On Fri, Oct 29, 2021 at 2:04 AM Pedro Falcat= o via groups.io <pedr= o.falcato=3Dgmail.= com@groups.io> wrote:

Uninitialized extents are special extents that have blocks al= located,
but are specified as uninitialized and therefore, reads behave = the
same as file holes (reads 0), while writes already have blocks alloc= ated.

Cc: Leif Lindholm <leif@nuviainc.com>
Cc: Michael D Kinney <michael.d.kinney@= intel.com>
Signed-off-by: Pedro Falcato <pedro.falcato@gmail.com>
= ---
 Features/Ext4Pkg/Ext4Dxe/Ext4Disk.h |  8 ++++++++
&nbs= p;Features/Ext4Pkg/Ext4Dxe/Ext4Dxe.h  | 21 +++++++++++++++++++++
&n= bsp;Features/Ext4Pkg/Ext4Dxe/Extents.c  | 24 ++++++++++++++++++++++--<= br> Features/Ext4Pkg/Ext4Dxe/Inode.c    | 14 +++++++++++---<= br> 4 files changed, 62 insertions(+), 5 deletions(-)

diff --gi= t a/Features/Ext4Pkg/Ext4Dxe/Ext4Disk.h b/Features/Ext4Pkg/Ext4Dxe/Ext4Disk= .h
index 070eb5a9c8..756b1bbe10 100644
--- a/Features/Ext4Pkg/Ext4Dxe= /Ext4Disk.h
+++ b/Features/Ext4Pkg/Ext4Dxe/Ext4Disk.h
@@ -448,6 +448,= 14 @@ typedef struct {
   UINT32    eb_checksum;
=  } EXT4_EXTENT_TAIL;

+/**
+ * EXT4 has this feature called u= ninitialized extents:
+ * An extent has a maximum of 32768 blocks (2^15 = or 1 << 15).
+ * When we find an extent with > 32768 blocks, th= is extent is called uninitialized.
+ * Long story short, it's an extent = that behaves as a file hole but has blocks already allocated.
+ */
+#= define EXT4_EXTENT_MAX_INITIALIZED  (1 << 15)
+
 type= def UINT64  EXT4_BLOCK_NR;
 typedef UINT32  EXT4_INO_NR;<= br>
diff --git a/Features/Ext4Pkg/Ext4Dxe/Ext4Dxe.h b/Features/Ext4Pkg/E= xt4Dxe/Ext4Dxe.h
index a9b932ed52..1d9a4ac6ba 100644
--- a/Features/E= xt4Pkg/Ext4Dxe/Ext4Dxe.h
+++ b/Features/Ext4Pkg/Ext4Dxe/Ext4Dxe.h
@@ = -1131,4 +1131,25 @@ Ext4SuperblockCheckMagic (
   IN EFI_BLOCK= _IO_PROTOCOL  *BlockIo
   );

+/**
+   = ;Check if the extent is uninitialized
+
+   @param[in] Exte= nt    Pointer to the EXT4_EXTENT
+
+   @returns T= rue if uninitialized, else false.
+**/
+#define EXT4_EXTENT_IS_UNINIT= IALIZED(Extent) ((Extent)->ee_len > EXT4_EXTENT_MAX_INITIALIZED)
+=
+/**
+   Retrieves the extent's length, dealing with unini= tialized extents in the process.
+
+   @param[in] Extent&nb= sp;     Pointer to the EXT4_EXTENT
+
+   @returns= Extent's length, in filesystem blocks.
+**/
+EXT4_BLOCK_NR
+Ext4G= etExtentLength (
+  IN CONST EXT4_EXTENT  *Extent
+  )= ;
+
 #endif
diff --git a/Features/Ext4Pkg/Ext4Dxe/Extents.c b= /Features/Ext4Pkg/Ext4Dxe/Extents.c
index 5fa2fe098d..1ae175f417 100644<= br>--- a/Features/Ext4Pkg/Ext4Dxe/Extents.c
+++ b/Features/Ext4Pkg/Ext4D= xe/Extents.c
@@ -332,7 +332,7 @@ Ext4GetExtent (
     = return EFI_NO_MAPPING;
   }

-  if (!(LogicalBlock = >=3D Ext->ee_block && Ext->ee_block + Ext->ee_len > = LogicalBlock)) {
+  if (!(LogicalBlock >=3D Ext->ee_block &am= p;& Ext->ee_block + Ext4GetExtentLength (Ext) > LogicalBlock)) {<= br>     // This extent does not cover the block
  &n= bsp;  if (Buffer !=3D NULL) {
       FreePool (= Buffer);
@@ -413,7 +413,7 @@ Ext4ExtentsMapKeyCompare (
   = Extent =3D UserStruct;
   Block  =3D (UINT32)(UINTN)Stand= aloneKey;

-  if (Block >=3D Extent->ee_block && B= lock < Extent->ee_block + Extent->ee_len) {
+  if (Block &= gt;=3D Extent->ee_block && Block < Extent->ee_block + Ext4= GetExtentLength (Extent)) {
     return 0;
  &nbs= p;}

@@ -593,3 +593,23 @@ Ext4CheckExtentChecksum (

  &nb= sp;return Tail->eb_checksum =3D=3D Ext4CalculateExtentChecksum (ExtHeade= r, File);
 }
+
+/**
+   Retrieves the extent's l= ength, dealing with uninitialized extents in the process.
+
+  &= nbsp;@param[in] Extent      Pointer to the EXT4_EXTENT
+<= br>+   @returns Extent's length, in filesystem blocks.
+**/+EXT4_BLOCK_NR
+Ext4GetExtentLength (
+  IN CONST EXT4_EXTENT&n= bsp; *Extent
+  )
+{
+  // If it's an unintialized exten= t, the true length is ee_len - 2^15
+  if (EXT4_EXTENT_IS_UNINITIAL= IZED (Extent)) {
+    return Extent->ee_len - EXT4_EXTENT_M= AX_INITIALIZED;
+  }
+
+  return Extent->ee_len;
+= }
diff --git a/Features/Ext4Pkg/Ext4Dxe/Inode.c b/Features/Ext4Pkg/Ext4D= xe/Inode.c
index 63cecec1f7..48bfe026a3 100644
--- a/Features/Ext4Pkg= /Ext4Dxe/Inode.c
+++ b/Features/Ext4Pkg/Ext4Dxe/Inode.c
@@ -144,11 +1= 44,19 @@ Ext4Read (

     HasBackingExtent =3D Status = !=3D EFI_NO_MAPPING;

-    if (!HasBackingExtent) {
+&nb= sp;   if (!HasBackingExtent || EXT4_EXTENT_IS_UNINITIALIZED (&Exte= nt)) {
+
       HoleOff =3D BlockOff;
-  =     HoleLen =3D Partition->BlockSize - HoleOff;
+
+ = ;     if (!HasBackingExtent) {
+        Ho= leLen =3D Partition->BlockSize - HoleOff;
+      } els= e {
+        // Uninitialized extents behave exactly= the same as file holes.
+        HoleLen =3D Ext4Ge= tExtentLength (&Extent) - HoleOff;
+      }
+
&= nbsp;      WasRead =3D HoleLen > RemainingRead ? Remainin= gRead : HoleLen;
-      // Potential improvement: In the = future, we could get the hole's tota
+      // Potential = improvement: In the future, we could get the file hole's total
  &n= bsp;    // size and memset all that
       = ;SetMem (Buffer, WasRead, 0);
     } else {
--
2.3= 3.1.windows.1



------------
Groups.io Links: You receive a= ll messages sent to this group.
View/Reply Online (#82879): https://edk2= .groups.io/g/devel/message/82879
Mute This Topic: https://groups.io/mt/8666= 7035/5946980
Group Owner: devel+owner@edk2.groups.io
Unsubscribe: https://edk2= .groups.io/g/devel/unsub [pedro.falcato@gmail.com]
------------


 

<= /div>

--

<= span lang=3DEN-US>Pedro Falcato



--

Pedro Falcato



--

Pedro Falcato

=
_._,_._,_

G= roups.io Links:

You receive all messages sent to this group.

Vi= ew/Reply Online (#83923) | | Mute This Topic | New Topic
Your Subscription | Contact Group Owner | Unsubscribe [importer@patchew.org]
_._,_._,_=20 ------=_NextPart_000_00BC_01D7E06C.22F5E8B0--