On Mon, Jul 19, 2021 at 12:34:56PM +0200, Christoph Hellwig wrote:
Signed-off-by: Christoph Hellwig <hch@lst.de>
/me wonders, does this have any significant effect on the generated
code?
It's probably a good idea to feed the optimizer as much usage info as we
can, though I would imagine that for such a simple function it can
probably tell that we don't change *iomap.
IMHO, constifiying functions is a good way to signal to /programmers/
that they're not intended to touch the arguments, so
Reviewed-by: Darrick J. Wong <djwong@kernel.org>
--D
quoted hunk ↗ jump to hunk
---
include/linux/iomap.h | 3 +--
1 file changed, 1 insertion(+), 2 deletions(-)
diff --git a/include/linux/iomap.h b/include/linux/iomap.h
index 093519d91cc9cc..f9c36df6a3061b 100644
--- a/include/linux/iomap.h
+++ b/include/linux/iomap.h
@@ -91,8 +91,7 @@ struct iomap {
const struct iomap_page_ops *page_ops;
};
-static inline sector_t
-iomap_sector(struct iomap *iomap, loff_t pos)
+static inline sector_t iomap_sector(const struct iomap *iomap, loff_t pos)
{
return (iomap->addr + pos - iomap->offset) >> SECTOR_SHIFT;
}--
2.30.2