]> git.ipfire.org Git - thirdparty/kernel/linux.git/commitdiff
zloop: improve the unaligned write pointer warning
authorChristoph Hellwig <hch@lst.de>
Tue, 14 Apr 2026 08:17:48 +0000 (10:17 +0200)
committerJens Axboe <axboe@kernel.dk>
Wed, 15 Apr 2026 19:58:36 +0000 (13:58 -0600)
Use the IS_ALIGNED helper and avoid extra conversions, and tell the
user what the unaligned size is.

Signed-off-by: Christoph Hellwig <hch@lst.de>
Reviewed-by: Damien Le Moal <dlemoal@kernel.org>
Reviewed-by: Johannes Thumshirn <johannes.thumshirn@wdc.com>
Link: https://patch.msgid.link/20260414081811.549755-4-hch@lst.de
Signed-off-by: Jens Axboe <axboe@kernel.dk>
drivers/block/zloop.c

index fc54480ed62d3991a36a0e145819f5507f0ed0b9..a738f8629062042ed70c3d54c52ee964b4b1b36d 100644 (file)
@@ -313,9 +313,9 @@ static int zloop_update_seq_zone(struct zloop_device *zlo, unsigned int zone_no)
                return -EINVAL;
        }
 
-       if (file_sectors & ((zlo->block_size >> SECTOR_SHIFT) - 1)) {
-               pr_err("Zone %u file size not aligned to block size %u\n",
-                      zone_no, zlo->block_size);
+       if (!IS_ALIGNED(stat.size, zlo->block_size)) {
+               pr_err("Zone %u file size (%llu) not aligned to block size %u\n",
+                      zone_no, stat.size, zlo->block_size);
                return -EINVAL;
        }