Damien Le Moal 0916878da3 f2fs: Fix use of number of devices
For a single device mount using a zoned block device, the zone
information for the device is stored in the sbi->devs single entry
array and sbi->s_ndevs is set to 1. This differs from a single device
mount using a regular block device which does not allocate sbi->devs
and sets sbi->s_ndevs to 0.

However, sbi->s_devs == 0 condition is used throughout the code to
differentiate a single device mount from a multi-device mount where
sbi->s_ndevs is always larger than 1. This results in problems with
single zoned block device volumes as these are treated as multi-device
mounts but do not have the start_blk and end_blk information set. One
of the problem observed is skipping of zone discard issuing resulting in
write commands being issued to full zones or unaligned to a zone write
pointer.

Fix this problem by simply treating the cases sbi->s_ndevs == 0 (single
regular block device mount) and sbi->s_ndevs == 1 (single zoned block
device mount) in the same manner. This is done by introducing the
helper function f2fs_is_multi_device() and using this helper in place
of direct tests of sbi->s_ndevs value, improving code readability.

Fixes: 7bb3a371d199 ("f2fs: Fix zoned block device support")
Cc: <stable@vger.kernel.org>
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>
2019-04-05 09:33:54 -07:00
..
2019-03-17 09:10:56 -07:00
2019-03-28 08:54:20 -07:00
2019-03-26 10:32:13 -07:00
2019-03-09 10:54:24 -08:00
\n
2019-03-07 09:01:33 -08:00
2019-04-05 09:33:54 -07:00
2019-03-12 14:46:26 -07:00
2018-11-30 14:56:14 -08:00
2018-08-17 16:20:28 -07:00
2018-09-29 22:47:48 -04:00
2019-03-18 10:44:48 -06:00
2018-10-29 14:29:58 -07:00
2019-03-01 17:24:48 -08:00
2019-03-07 18:32:01 -08:00
2019-03-08 14:48:40 -08:00
2019-03-18 10:44:48 -06:00
2019-01-30 17:44:07 -05:00
2019-02-07 16:38:35 +01:00