forked from torvalds/linux
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Browse files
Browse the repository at this point in the history
loop: don't print warnings if the underlying filesystem doesn't suppo…
…rt discard On Tue, 12 Oct 2021, Christoph Hellwig wrote: > On Mon, Oct 04, 2021 at 09:01:33AM -0400, Mikulas Patocka wrote: > > Do you want this patch? > > Yes, this looks like what I want. Minor nitpicks below: > > > + .fallocate_flags = BLKDEV_FALLOC_FL_SUPPORTED, > > I'd probably call this fallocate_supported_flags. > > > + .fallocate_flags = FALLOC_FL_KEEP_SIZE | FALLOC_FL_PUNCH_HOLE | FALLOC_FL_ZERO_RANGE, > > Please avoid over 80 lines for a plain list of flags. OK. Here I'm sending a new version of the patch. BTW. for some filesystems (cifs, ext4, fuse, ...), the supported falloc flags vary dynamically - for example, ext4 can do COLLAPSE_RANGE and INSERT_RANGE operations only if the filesystem is not ext2 or ext3 and if the file is not encrypted. Should we add a new flag FALLOC_FL_RETURN_SUPORTED_FLAGS that will return the supported flags instead of using a static field in the file_operations structure? Mikulas From: Mikulas Patocka <mpatocka@redhat.com> The loop driver checks for the fallocate method and if it is present, it assumes that the filesystem can do FALLOC_FL_ZERO_RANGE and FALLOC_FL_PUNCH_HOLE requests. However, some filesystems (such as fat, or tmpfs) have the fallocate method, but lack the capability to do FALLOC_FL_ZERO_RANGE and/or FALLOC_FL_PUNCH_HOLE. This results in syslog warnings "blk_update_request: operation not supported error, dev loop0, sector 0 op 0x9:(WRITE_ZEROES) flags 0x800800 phys_seg 0 prio class 0". The error can be reproduced with this command: "truncate -s 1GiB /tmp/file; losetup /dev/loop0 /tmp/file; blkdiscard -z /dev/loop0" This patch introduces a field "fallocate_supported_flags" in struct file_operations that specifies the flags that are supported by the fallocate methods. The loopback driver will check this field to determine if FALLOC_FL_PUNCH_HOLE or FALLOC_FL_ZERO_RANGE is supported Signed-off-by: Mikulas Patocka <mpatocka@redhat.com>
- Loading branch information
1 parent
a54cbb6
commit c381403
Showing
19 changed files
with
53 additions
and
2 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters