Re: [PATCH 09/14] iomap: Change iomap_write_begin calling convention

Matthew Wilcox
2020-10-14T17:42:01Z

On Wed, Oct 14, 2020 at 09:47:44AM -0700, Darrick J. Wong wrote:
> > -static int
> > -iomap_write_begin(struct inode *inode, loff_t pos, unsigned len, unsigned flags,
> > - struct page **pagep, struct iomap *iomap, struct iomap *srcmap)
> > +static ssize_t iomap_write_begin(struct inode *inode, loff_t pos, loff_t len,
> > + unsigned flags, struct page **pagep, struct iomap *iomap,
>
> loff_t len? You've been using size_t (ssize_t?) for length elsewhere,
> can't return more than ssize_t, and afaik MAX_RW_COUNT will never go
> larger than 2GB so I'm confused about types here...?

Yes, you're right. This one should be size_t.

> > if (page_ops && page_ops->page_prepare) {
> > + if (len > UINT_MAX)
> > + len = UINT_MAX;
>
> I'm not especially familiar with page_prepare (since it's a gfs2 thing);
> why do you clamp len to UINT_MAX here?

The len parameter of ->page_prepare is an unsigned int. I don't want
a 1<<32+1 byte I/O to be seen as a 1 byte I/O. We could upgrade the
parameter to size_t from unsigned int?