[LU-3606] Implement fallocate() support for ldiskfs Lustre Created: 17/Jul/13  Updated: 30/Nov/23  Resolved: 27/Nov/20

Status: Resolved
Project: Lustre
Component/s: None
Affects Version/s: None
Fix Version/s: Lustre 2.14.0

Type: New Feature Priority: Major
Reporter: Andreas Dilger Assignee: Arshad Hussain
Resolution: Fixed Votes: 0
Labels: medium, patch

Attachments: PDF File fallocate_hld-2013-12-09.pdf    
Issue Links:
Cloners
is cloned by LU-14157 Implement fallocate() support for zfs... Open
Related
is related to LU-14160 Implement fallocate FALLOCATE_FL_PUNC... Resolved
is related to LU-14333 ASSERTION( oinfo->loi_lvb.lvb_size >=... Resolved
is related to LU-15167 fallocate does not increase quota usage Resolved
is related to LU-15519 fallocate does not increase projid qu... Resolved
is related to LU-10370 "truncate" does not update blocks cou... Resolved
is related to LU-8699 Further fsx improvements Open
is related to LU-13155 "lfs migrate" and "lfs mirror" should... Open
is related to LU-17055 Implement FALLOC_FL_ZERO_RANGE Open
is related to LU-17326 Implement FALLOC_FL_COLLAPSE_RANGE an... Open
is related to LUDOC-487 Document llite.*.fallocate_zero_block... Open
is related to LU-14382 Implement fallocate() support at MDT Resolved
is related to LU-10810 SEEK_HOLE and SEEK_DATA support for l... Resolved
is related to LU-14287 Add 'fallocate' to racer Resolved
Rank (Obsolete): 9150

 Description   

The sys_fallocate() syscall was introduced to the linux kernel in the 2.6.24 kernel. There is also an ext4_fallocate() method added in this same kernel release. This has been available in vendor kernels since RHEL 5.4.

We need to implement an fallocate() method for llite, and transport this to the OSTs to interface with the underlying OSD's fallocate() code (for ldiskfs, ZFS has no such method).

The FALLOC_FL_PUNCH_HOLE functionality of fallocate() fits very nicely with the OST_PUNCH RPC, since this was anticipated in Lustre from the beginning. The actual space reservation might also use OST_PUNCH or OST_WRITE, or we might consider a new OST_PREALLOC RPC, depending on what fits best.



 Comments   
Comment by Andreas Dilger [ 17/Jul/13 ]

The fallocate() API has been added to newer versions of the Lustre kernel to provide both persistent space reservation (block preallocation for a file, possibly beyond the file size, without having to write zeroes to the whole file), and for the reverse operation of hole punching (freeing allocated blocks in the middle or end of a file). However, Lustre predates these APIs and has not yet added support for them. Being able to preallocate space for a file is very useful for HPC applications that know the size of the output file in advance, and helps Lustre make better allocation decisions based on the file size.

This project will touch all of the layers of the Lustre IO stack, from the Linux client VFS interface, through the file layout to the RPC interface, over to the storage server, and then interfacing with the back-end filesystems to use the space reservation (ext4 only) and hole punch (both ext4 and ZFS) methods. As a stretch goal, an ioctl() pass-through interface from the server mountpoint to the underlying filesystem would allow direct passing of FITRIM ioctl commands to the storage so that SSD-based filesystems can optimize their internal space management.

Comment by Swapnil Pimpale (Inactive) [ 14/Feb/14 ]

I have uploaded the first patchset here: http://review.whamcloud.com/#/c/9275/

Comment by Jinshan Xiong (Inactive) [ 16/Feb/14 ]

I will track the state of this ticket.

Comment by Andreas Dilger [ 07/May/15 ]

Jinshan, can you see what is needed to get this patch across the finish line? Swap il is no longer available to work on it.

Comment by Abrar-ahmed [ 31/May/17 ]

andreas.dilger@intel.com I worked on the patch and have it working, including newer kernel versions. Most review comments against last patch addressed. Can post it against the same change-id if that works.

Comment by Andreas Dilger [ 01/Jun/17 ]

Yes, please reuse the same Change-Id. That will allow comparing the new patch against the old one, and the old one is hopelessly outdated and not useful.

Comment by Gerrit Updater [ 18/Jan/20 ]

Arshad Hussain (arshad.super@gmail.com) uploaded a new patch: https://review.whamcloud.com/37273
Subject: LU-3606 fsx: Add fallocate operation to fsx
Project: fs/lustre-release
Branch: master
Current Patch Set: 1
Commit: 2269c370864bd42a5fbf0608afecba0ec8f010db

Comment by Gerrit Updater [ 19/Jan/20 ]

Arshad Hussain (arshad.super@gmail.com) uploaded a new patch: https://review.whamcloud.com/37277
Subject: LU-3606 lustre: Reserve fallocate opcode
Project: fs/lustre-release
Branch: master
Current Patch Set: 1
Commit: a52c11c2c0935ce1b741dfde703bbaeb93c7c499

Comment by Gerrit Updater [ 28/Jan/20 ]

Oleg Drokin (green@whamcloud.com) merged in patch https://review.whamcloud.com/37273/
Subject: LU-3606 fsx: Add fallocate operation to fsx
Project: fs/lustre-release
Branch: master
Current Patch Set:
Commit: 853d180121a6e313ffe678bbe5c107d7afc601d5

Comment by Gerrit Updater [ 28/Jan/20 ]

Oleg Drokin (green@whamcloud.com) merged in patch https://review.whamcloud.com/37277/
Subject: LU-3606 lustre: Reserve OST_FALLOCATE(fallocate) opcode
Project: fs/lustre-release
Branch: master
Current Patch Set:
Commit: 46a11df089c92f0d18e6f3224eca76abfcd0ac67

Comment by Gerrit Updater [ 14/May/20 ]

Oleg Drokin (green@whamcloud.com) merged in patch https://review.whamcloud.com/9275/
Subject: LU-3606 fallocate: Implement fallocate preallocate operation
Project: fs/lustre-release
Branch: master
Current Patch Set:
Commit: 48457868a02ae5a0407f304c9028f7e80e7fb574

Comment by Peter Jones [ 26/Nov/20 ]

Do I understand correctly that fallocate support for ldiskfs has landed for 2.14 but fallocate support for ZFS needs more work? If so, shall we track the latter under a new ticket so that it is clear what capabilities are in each release?

Comment by Andreas Dilger [ 27/Nov/20 ]

Yes, the patch https://review.whamcloud.com/36506 "LU-3606 zfs-osd: Add fallocate functionality for ZFS" needs to be refreshed. There also needs to be a separate patch to implement FALLOCATE_FL_PUNCH_HOLE.

Comment by Peter Jones [ 27/Nov/20 ]

Opened LU-14157 to track fallocate support for zfs. Marking as fixed in 2.14 for ldiskfs support

Comment by Arshad Hussain [ 30/Nov/20 ]

Thanks Andreas, Peter.

>Opened LU-14157 to track fallocate support for zfs. Marking as fixed in 2.14 for ldiskfs support
LU-14160 opened for ldiskfs fallocate punch support.

Generated at Sat Feb 10 01:35:21 UTC 2024 using Jira 9.4.14#940014-sha1:734e6822bbf0d45eff9af51f82432957f73aa32c.