Skip to contentSkip to conversation

xfs: return FIEMAP_EXTENT_UNKNOWN for delayed allocation extent

PATCH In review Jeff Liu 2 participants 4 messages Jun 6, 2013 – Jun 19, 2013 XFS filesystem

lore
Share & tools
lore

Jeff Liu

author
#0 lore raw

PATCH 1/1 xfs: return FIEMAP_EXTENT_UNKNOWN for delayed allocation extent

From: Jie Liu <[email protected]>

For FIEMAP ioctl(2), if an extent is in delayed allocation state, we need to return the FIEMAP_EXTENT_UNKNOWN flag except the FIEMAP_EXTENT_DELALLOC because its data location is unknown.

---
 fs/xfs/xfs_iops.c |    3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)
fs/xfs/xfs_iops.c +2 -1
index d82efaa..53ddbdb 100644
@@ -970,7 +970,8 @@ xfs_fiemap_format(
 	if (bmv->bmv_oflags & BMV_OF_PREALLOC)
 		fiemap_flags |= FIEMAP_EXTENT_UNWRITTEN;
 	else if (bmv->bmv_oflags & BMV_OF_DELALLOC) {
-		fiemap_flags |= FIEMAP_EXTENT_DELALLOC;
+		fiemap_flags |= (FIEMAP_EXTENT_DELALLOC |
+				 FIEMAP_EXTENT_UNKNOWN);
 		physical = 0;   /* no block yet */
 	}
 	if (bmv->bmv_oflags & BMV_OF_LAST)
Signature · 6 lines
1.7.9.5

_______________________________________________
xfs mailing list
[email protected]
http://oss.sgi.com/mailman/listinfo/xfs
Reviewed-by on v1 1/1
#1 lore raw

Hey Jeff,

Quoted 7 lines · Jeff Liu

From: Jie Liu <[email protected]>

For FIEMAP ioctl(2), if an extent is in delayed allocation state, we need to return the FIEMAP_EXTENT_UNKNOWN flag except the FIEMAP_EXTENT_DELALLOC because its data location is unknown.

Looks fine. Is there an email thread I can reference?

Thanks,
Ben

_______________________________________________
xfs mailing list
[email protected]
http://oss.sgi.com/mailman/listinfo/xfs

author
#2 lore raw

Hi Ben,

Quoted 5 lines · Ben Myers

Hey Jeff,

Quoted 2 lines · Jeff Liu

From: Jie Liu <[email protected]>

Quoted 7 lines
Quoted 5 lines

For FIEMAP ioctl(2), if an extent is in delayed allocation state, we need to return the FIEMAP_EXTENT_UNKNOWN flag except the FIEMAP_EXTENT_DELALLOC because its data location is unknown.

Looks fine. Is there an email thread I can reference?

I can't found an email thread to verify that, but according to the specification of fiemap interface in kernel doc:
Documentation/filesystems/fiemap.txt

* FIEMAP_EXTENT_UNKNOWN
The location of this extent is currently unknown. This may indicate the data is stored on an inaccessible volume or that no storage has been allocated for the file yet.

* FIEMAP_EXTENT_DELALLOC
- This will also set FIEMAP_EXTENT_UNKNOWN. ^^^^^ <-- so the unknown flags should be set as well.

Delayed allocation - while there is data for this extent, its physical location has not been allocated yet.

Also, Btrfs did it.

Thanks,
-Jeff

_______________________________________________
xfs mailing list
[email protected]
http://oss.sgi.com/mailman/listinfo/xfs

#3 lore raw

Hey Jeff,

Quoted 21 lines · Jeff Liu
Quoted 10 lines · Ben Myers
Quoted 7 lines · Jeff Liu

From: Jie Liu <[email protected]>

For FIEMAP ioctl(2), if an extent is in delayed allocation state, we need to return the FIEMAP_EXTENT_UNKNOWN flag except the FIEMAP_EXTENT_DELALLOC because its data location is unknown.

Looks fine. Is there an email thread I can reference?

I can't found an email thread to verify that, but according to the specification of fiemap interface in kernel doc:
Documentation/filesystems/fiemap.txt

* FIEMAP_EXTENT_UNKNOWN
The location of this extent is currently unknown. This may indicate the data is stored on an inaccessible volume or that no storage has been allocated for the file yet.

Quoted 6 lines

* FIEMAP_EXTENT_DELALLOC
- This will also set FIEMAP_EXTENT_UNKNOWN. ^^^^^ <-- so the unknown flags should be set as well.

Delayed allocation - while there is data for this extent, its physical location has not been allocated yet.

Thanks. That's just what I needed. Applied.

Quoted 1 line

Also, Btrfs did it.

Heh. Must be right then! ;)

Regards,
Ben

_______________________________________________
xfs mailing list
[email protected]
http://oss.sgi.com/mailman/listinfo/xfs