[LU-14186] fallocate does not extend uninitialized PFL components Created: 05/Dec/20 Updated: 13/Dec/20 Resolved: 13/Dec/20 |
|
| Status: | Resolved |
| Project: | Lustre |
| Component/s: | None |
| Affects Version/s: | Lustre 2.14.0 |
| Fix Version/s: | Lustre 2.14.0 |
| Type: | Bug | Priority: | Minor |
| Reporter: | Andreas Dilger | Assignee: | Wang Shilong (Inactive) |
| Resolution: | Fixed | Votes: | 0 |
| Labels: | None | ||
| Issue Links: |
|
||||
| Severity: | 3 | ||||
| Rank (Obsolete): | 9223372036854775807 | ||||
| Description |
|
I was testing "fallocate" as a fast way to allocate space in the file, but I found that it only allocated space on the first (initialized) component of a PFL file. It does not allocate space for any of the later components if those components are uninitialized. # lfs setstripe -E1M -c1 -E16M -c3 -Eeof -c 4 /mnt/testfs/pflfile
# ls -l /mnt/testfs/pflfile
0 -rw-r--r--. 1 root 0 Dec 5 13:24 /mnt/testfs/pflfile
# fallocate -l $((1048576 * 1024)) /mnt/testfs/pflfile
# ls -l /mnt/testfs/pflfile
1024 -rw-r--r--. 1 root 1048576 Dec 5 13:33 /mnt/testfs/pflfile
# lfs getstripe /mnt/testfs/pflfile
/mnt/testfs/pflfile
lcm_layout_gen: 3
lcm_mirror_count: 1
lcm_entry_count: 3
lcme_id: 1
lcme_mirror_id: 0
lcme_flags: init
lcme_extent.e_start: 0
lcme_extent.e_end: 1048576
lmm_stripe_count: 1
lmm_stripe_size: 1048576
lmm_pattern: raid0
lmm_layout_gen: 0
lmm_stripe_offset: 3
lmm_objects:
- 0: { l_ost_idx: 3, l_fid: [0x100030000:0x60a:0x0] }
lcme_id: 2
lcme_mirror_id: 0
lcme_flags: 0
lcme_extent.e_start: 1048576
lcme_extent.e_end: 16777216
lmm_stripe_count: 3
lmm_stripe_size: 1048576
lmm_pattern: raid0
lmm_layout_gen: 0
lmm_stripe_offset: -1
lcme_id: 3
lcme_mirror_id: 0
lcme_flags: 0
lcme_extent.e_start: 16777216
lcme_extent.e_end: 1073741824
lmm_stripe_count: 4
lmm_stripe_size: 2097152
lmm_pattern: raid0
lmm_layout_gen: 0
lmm_stripe_offset: -1
If the file is truncated, the later components are initialized: # truncate -s 1023M /mnt/testfs/pflfile
# lfs getstripe /mnt/testfs/pflfile
/mnt/testfs/pflfile
lcm_layout_gen: 4
lcm_mirror_count: 1
lcm_entry_count: 3
lcme_id: 1
lcme_mirror_id: 0
lcme_flags: init
lcme_extent.e_start: 0
lcme_extent.e_end: 1048576
lmm_stripe_count: 1
lmm_stripe_size: 1048576
lmm_pattern: raid0
lmm_layout_gen: 0
lmm_stripe_offset: 3
lmm_objects:
- 0: { l_ost_idx: 3, l_fid: [0x100030000:0x60a:0x0] }
lcme_id: 2
lcme_mirror_id: 0
lcme_flags: init
lcme_extent.e_start: 1048576
lcme_extent.e_end: 16777216
lmm_stripe_count: 3
lmm_stripe_size: 1048576
lmm_pattern: raid0
lmm_layout_gen: 65535
lmm_stripe_offset: 0
lmm_objects:
- 0: { l_ost_idx: 0, l_fid: [0x100000000:0x1ca:0x0] }
- 1: { l_ost_idx: 1, l_fid: [0x100010000:0x8aa:0x0] }
- 2: { l_ost_idx: 2, l_fid: [0x100020000:0x6aa:0x0] }
lcme_id: 3
lcme_mirror_id: 0
lcme_flags: init
lcme_extent.e_start: 16777216
lcme_extent.e_end: 1073741824
lmm_stripe_count: 4
lmm_stripe_size: 2097152
lmm_pattern: raid0
lmm_layout_gen: 65535
lmm_stripe_offset: 0
lmm_objects:
- 0: { l_ost_idx: 0, l_fid: [0x100000000:0x1cb:0x0] }
- 1: { l_ost_idx: 1, l_fid: [0x100010000:0x8ab:0x0] }
- 2: { l_ost_idx: 2, l_fid: [0x100020000:0x6ab:0x0] }
- 3: { l_ost_idx: 3, l_fid: [0x100030000:0x60b:0x0] }
# lfs df
UUID 1K-blocks Used Available Use% Mounted on
testfs-MDT0000_UUID 125368 2596 111536 3% /mnt/testfs[MDT:0]
testfs-MDT0001_UUID 125368 3112 111020 3% /mnt/testfs[MDT:1]
testfs-OST0000_UUID 325368 13796 284412 5% /mnt/testfs[OST:0]
testfs-OST0001_UUID 325368 14304 283904 5% /mnt/testfs[OST:1]
testfs-OST0002_UUID 325368 13664 284544 5% /mnt/testfs[OST:2]
testfs-OST0003_UUID 325368 14692 283516 5% /mnt/testfs[OST:3]
filesystem_summary: 1301472 56456 1136376 5% /mnt/testfs
If the fallocate is run again, this time the space is allocated: # fallocate -l $((1048576 * 1024)) /mnt/testfs/pflfile # ls -l /mnt/testfs/pflfile 1048576 -rw-r--r--. 1 root 1073741824 Dec 5 13:37 /mnt/testfs/pflfile # lfs df UUID 1K-blocks Used Available Use% Mounted on testfs-MDT0000_UUID 125368 2596 111536 3% /mnt/testfs[MDT:0] testfs-MDT0001_UUID 125368 3112 111020 3% /mnt/testfs[MDT:1] testfs-OST0000_UUID 325368 276964 21244 93% /mnt/testfs[OST:0] testfs-OST0001_UUID 325368 277472 20736 94% /mnt/testfs[OST:1] testfs-OST0002_UUID 325368 276832 21376 93% /mnt/testfs[OST:2] testfs-OST0003_UUID 325368 272740 25468 92% /mnt/testfs[OST:3] filesystem_summary: 1301472 1104008 88824 93% /mnt/testfs |
| Comments |
| Comment by Andreas Dilger [ 05/Dec/20 ] |
|
I suspect what is missing is that fallocate() needs to internally get the intent lock with the MDS for the full range of data, like a write() or truncate() call, which will cause it to initialize those components. Then, the later RPCs to the OSTs will "just work". The initialization of later components is probably not needed for PUNCH_HOLE|KEEP_SIZE, but is needed if PUNCH_HOLE by itself acts like truncate() to extend the size, since the size of the file is determined by the size of the OST objects themselves. |
| Comment by Gerrit Updater [ 07/Dec/20 ] |
|
Wang Shilong (wshilong@whamcloud.com) uploaded a new patch: https://review.whamcloud.com/40885 |
| Comment by Gerrit Updater [ 13/Dec/20 ] |
|
Oleg Drokin (green@whamcloud.com) merged in patch https://review.whamcloud.com/40885/ |
| Comment by Peter Jones [ 13/Dec/20 ] |
|
Landed for 2.14 |