On Wed, Jun 04, 2025 at 10:08:49AM +0800, Zhang Yi wrote: > @@ -856,6 +856,13 @@ static long blkdev_fallocate(struct file *file, int > mode, loff_t start, > /* Fail if we don't recognize the flags. */ > if (mode & ~BLKDEV_FALLOC_FL_SUPPORTED) > return -EOPNOTSUPP; > + /* > + * Don't allow writing zeroes if the device does not enable the > + * unmap write zeroes operation. > + */ > + if (!bdev_write_zeroes_unmap(bdev) && > + (mode & FALLOC_FL_WRITE_ZEROES))
Cosmetic nitpick, but I'd turn the check around to check the mode first as that's easier to read. The whole check also fits onto a single line: if ((mode & FALLOC_FL_WRITE_ZEROES) && !bdev_write_zeroes_unmap(bdev)) Otherwise looks good: Reviewed-by: Christoph Hellwig <h...@lst.de>