public inbox for linux-block@vger.kernel.org
 help / color / mirror / Atom feed
From: Christoph Hellwig <hch@lst.de>
To: Jens Axboe <axboe@kernel.dk>, Damien Le Moal <dlemoal@kernel.org>
Cc: linux-block@vger.kernel.org
Subject: [PATCH 3/6] zloop: improve the unaligned write pointer warning
Date: Tue, 14 Apr 2026 10:17:48 +0200	[thread overview]
Message-ID: <20260414081811.549755-4-hch@lst.de> (raw)
In-Reply-To: <20260414081811.549755-1-hch@lst.de>

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>
---
 drivers/block/zloop.c | 6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)

diff --git a/drivers/block/zloop.c b/drivers/block/zloop.c
index fc54480ed62d..a738f8629062 100644
--- a/drivers/block/zloop.c
+++ b/drivers/block/zloop.c
@@ -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;
 	}
 
-- 
2.53.0


  parent reply	other threads:[~2026-04-14  8:18 UTC|newest]

Thread overview: 15+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-04-14  8:17 zloop fixes Christoph Hellwig
2026-04-14  8:17 ` [PATCH 1/6] zloop: fix write pointer calculation in zloop_forget_cache Christoph Hellwig
2026-04-14  9:26   ` Damien Le Moal
2026-04-14  8:17 ` [PATCH 2/6] zloop: use vfs_truncate Christoph Hellwig
2026-04-14  9:26   ` Damien Le Moal
2026-04-14  8:17 ` Christoph Hellwig [this message]
2026-04-14  9:27   ` [PATCH 3/6] zloop: improve the unaligned write pointer warning Damien Le Moal
2026-04-14  8:17 ` [PATCH 4/6] zloop: set RQF_QUIET when completing requests on deleted devices Christoph Hellwig
2026-04-14  9:28   ` Damien Le Moal
2026-04-14  8:17 ` [PATCH 5/6] zloop: factor out zloop_mark_{full,empty} helpers Christoph Hellwig
2026-04-14  9:29   ` Damien Le Moal
2026-04-14  8:17 ` [PATCH 6/6] zloop: remove irq-safe locking Christoph Hellwig
2026-04-14  9:30   ` Damien Le Moal
2026-04-14 16:20 ` zloop fixes Johannes Thumshirn
2026-04-15 20:03 ` Jens Axboe

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20260414081811.549755-4-hch@lst.de \
    --to=hch@lst.de \
    --cc=axboe@kernel.dk \
    --cc=dlemoal@kernel.org \
    --cc=linux-block@vger.kernel.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox