Re: [PATCHv9 4/6] iomap: Refactor iomap_write_delalloc_punch() function out

Ritesh Harjani
2023-06-12T14:03:37Z

Matthew Wilcox <willy@infradead.org> writes:

> On Sat, Jun 10, 2023 at 05:09:05PM +0530, Ritesh Harjani (IBM) wrote:
>> +static int iomap_write_delalloc_punch(struct inode *inode, struct folio *folio,
>> + loff_t *punch_start_byte, loff_t start_byte, loff_t end_byte,
>> + int (*punch)(struct inode *inode, loff_t offset, loff_t length))
>
> I can't help but feel that a
>
> typedef iomap_punch_t(struct inode *, loff_t offset, loff_t length);
>
> would make all of this easier to read.
>

Sure. Make sense.

>> + /*
>> + * Make sure the next punch start is correctly bound to
>> + * the end of this data range, not the end of the folio.
>> + */
>> + *punch_start_byte = min_t(loff_t, end_byte,
>> + folio_next_index(folio) << PAGE_SHIFT);
>
> *punch_start_byte = min(end_byte, folio_pos(folio) + folio_size(folio));

Current code was also correct only. But I guess this just avoids
min_t/loff_t thing. No other reason right?

-ritesh