The write pointer is absolute and in sector units, so we need to
convert it to a relative byte address first.
Fixes: c505448748f7 ("zloop: forget write cache on force removal")
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-2-hch@lst.de
Signed-off-by: Jens Axboe <axboe@kernel.dk>
zlo->disk->part0, ret);
continue;
}
- if (old_wp < zone->wp)
- zloop_truncate(file, old_wp);
+
+ if (old_wp > zone->wp)
+ continue;
+ /*
+ * This should not happen, if we recored a full zone, it can't
+ * be active.
+ */
+ if (WARN_ON_ONCE(old_wp == ULLONG_MAX))
+ continue;
+
+ zloop_truncate(file, (old_wp - zone->start) << SECTOR_SHIFT);
}
}