]> git.proxmox.com Git - mirror_ubuntu-jammy-kernel.git/commit
f2fs: improve discard handling with multi-device volumes
authorDamien Le Moal <damien.lemoal@wdc.com>
Sat, 16 Mar 2019 00:13:08 +0000 (09:13 +0900)
committerJaegeuk Kim <jaegeuk@kernel.org>
Fri, 5 Apr 2019 16:33:55 +0000 (09:33 -0700)
commit7f3d7719c1888f98f12b584bcd6058e2c23d1961
tree308a957eaa2551365c2849a5d298d769f3580e84
parent95175dafc4399ab5b9e937da205b2a6927b19227
f2fs: improve discard handling with multi-device volumes

f2fs_hw_support_discard() only tests if the super block device supports
discard. However, for a multi-device volume, not all disks used may
support discard. Improve the check performed to test all devices of
the volume and report discard as supported if at least one device of
the volume supports discard. To implement this, introduce the helper
function f2fs_bdev_support_discard(), which returns true for zoned block
devices (where discard is processed as a zone reset) and for regular
disks supporting the discard command.

f2fs_bdev_support_discard() is also used in __queue_discard_cmd() to
handle discard command issuing for a particular device of the volume.
That is, prevent issuing a discard command for block devices that do
not support it.

Signed-off-by: Damien Le Moal <damien.lemoal@wdc.com>
Reviewed-by: Chao Yu <yuchao0@huawei.com>
Signed-off-by: Jaegeuk Kim <jaegeuk@kernel.org>
fs/f2fs/f2fs.h
fs/f2fs/segment.c