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

Pankaj Raghav
2023-06-12T13:59:04Z

[-- Attachment #1: Type: text/plain, Size: 911 bytes --]

Minor nit:

> +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))
> +{
> + int ret = 0;
> +
> + if (!folio_test_dirty(folio))
> + return ret;
Either this could be changed to `goto out`

OR

> +
> + /* if dirty, punch up to offset */
> + if (start_byte > *punch_start_byte) {
> + ret = punch(inode, *punch_start_byte,
> + start_byte - *punch_start_byte);
> + if (ret)
> + goto out;

This could be changed to `return ret` and we could get rid of the `out`
label.
> + }
> + /*
> + * 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);
> +
> +out:
> + return ret;
> +}
> +

[-- Attachment #2: Type: text/plain, Size: 0 bytes --]