Commit 6466b211 authored by Christoph Hellwig's avatar Christoph Hellwig Committed by Jens Axboe
Browse files

zloop: improve the unaligned write pointer warning



Use the IS_ALIGNED helper and avoid extra conversions, and tell the
user what the unaligned size is.

Signed-off-by: default avatarChristoph Hellwig <hch@lst.de>
Reviewed-by: default avatarDamien Le Moal <dlemoal@kernel.org>
Reviewed-by: default avatarJohannes Thumshirn <johannes.thumshirn@wdc.com>
Link: https://patch.msgid.link/20260414081811.549755-4-hch@lst.de


Signed-off-by: default avatarJens Axboe <axboe@kernel.dk>
parent 14e00779
Loading
Loading
Loading
Loading
+3 −3
Original line number Diff line number Diff line
@@ -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;
	}