As reported in [0], we may get an infinite loop in __blkdev_issue_write_zeroes() for making an XFS FS on a raid0 config. Fix __blkdev_issue_write_zeroes() limit handling by reading the write zeroes limit outside the loop. Also include a change to drop the unnecessary NULL queue check in bdev_write_zeroes_sectors(). [0] https://lore.kernel.org/linux-block/20240815062112.GA14067@xxxxxx/T/#m14ed5d882f9390a46cfe2fcfa2b51218aafbd32e John Garry (2): block: Read max write zeroes once for __blkdev_issue_write_zeroes() block: Drop NULL check in bdev_write_zeroes_sectors() block/blk-lib.c | 22 +++++++++++++++------- include/linux/blkdev.h | 7 +------ 2 files changed, 16 insertions(+), 13 deletions(-) -- 2.31.1