[LU-17042] e2freefrag say "Inappropriate ioctl for device while calling fsmap" Created: 21/Aug/23  Updated: 29/Aug/23

Status: Open
Project: Lustre
Component/s: None
Affects Version/s: Lustre 2.16.0
Fix Version/s: None

Type: Bug Priority: Minor
Reporter: Shuichi Ihara Assignee: WC Triage
Resolution: Unresolved Votes: 0
Labels: None

Issue Links:
Related
Severity: 3
Epic: e2fsprogs
Rank (Obsolete): 9223372036854775807

 Description   

Tested on RHEL8.7 patched kernel.

# e2freefrag /dev/sda 
Device: /dev/sda
Blocksize: 4096 bytes
/dev/sda: Inappropriate ioctl for device while calling fsmap
Total blocks: 7482638336
Free blocks: 7452679685 (99.6%)

Min. free extent: 4 KB 
Max. free extent: 135160 KB
Avg. free extent: 4624 KB
Num. free extent: 215369

HISTOGRAM OF FREE EXTENT SIZES:
Extent Size Range :  Free extents   Free Blocks  Percent
    4K...    8K-  :           386           386    0.00%
    8K...   16K-  :           247           598    0.00%
   16K...   32K-  :            89           443    0.00%
   32K...   64K-  :            23           215    0.00%
  256K...  512K-  :          1813        222094    0.00%
    1M...    2M-  :           292        111545    0.00%
    2M...    4M-  :          2995       2821591    0.04%
    4M...    8M-  :        208582     215511377    2.89%
    8M...   16M-  :            23         59123    0.00%
   64M...  128M-  :           494      16100776    0.22%
  128M...  256M-  :           425      14159177    0.19%


 Comments   
Comment by Andreas Dilger [ 21/Aug/23 ]

The summary at the start of e2freefrag is also based on the superblock block counts, (which is not updated while mounted) and not the actual free block counters in the group descriptors. It would be better to use the actual block counts.

Comment by Dongyang Li [ 29/Aug/23 ]

Andreas, the free block counters are based on the result from the ioctl when doing online scanning,
we only use the free blocks from superblock when doing offline scan, which means device is umounted anyway. So I think it's fine here.
We are seeing the ioctl error is because we don't pass through the ioctl to ldiskfs on server, I got a patch for this.

Comment by Gerrit Updater [ 29/Aug/23 ]

"Li Dongyang <dongyangli@ddn.com>" uploaded a new patch: https://review.whamcloud.com/c/fs/lustre-release/+/52147
Subject: LU-17042 target: allow fsmap ioctl
Project: fs/lustre-release
Branch: master
Current Patch Set: 1
Commit: 9cc7567fc163369a060c3f14be944042c1f4d676

Generated at Sat Feb 10 03:32:08 UTC 2024 using Jira 9.4.14#940014-sha1:734e6822bbf0d45eff9af51f82432957f73aa32c.