Re: [PATCH 1/3] writeback: cleanup writeback_chunk_size

Jan Kara
2025-10-20T08:56:49Z

On Fri 17-10-25 05:45:47, Christoph Hellwig wrote:
> Return the pages directly when calculated instead of first assigning
> them back to a variable, and directly return for the data integrity /
> tagged case instead of going through an else clause.
>
> Signed-off-by: Christoph Hellwig <hch@lst.de>
> Reviewed-by: Damien Le Moal <dlemoal@kernel.org>
> Reviewed-by: "Darrick J. Wong" <djwong@kernel.org>

I think I've already given my tag to this patch but anyway, feel free to
add:

Reviewed-by: Jan Kara <jack@suse.cz>

Honza
> ---
> fs/fs-writeback.c | 14 +++++---------
> 1 file changed, 5 insertions(+), 9 deletions(-)
>
> diff --git a/fs/fs-writeback.c b/fs/fs-writeback.c
> index 2b35e80037fe..11fd08a0efb8 100644
> --- a/fs/fs-writeback.c
> +++ b/fs/fs-writeback.c
> @@ -1893,16 +1893,12 @@ static long writeback_chunk_size(struct bdi_writeback *wb,
> * (maybe slowly) sync all tagged pages
> */
> if (work->sync_mode == WB_SYNC_ALL || work->tagged_writepages)
> - pages = LONG_MAX;
> - else {
> - pages = min(wb->avg_write_bandwidth / 2,
> - global_wb_domain.dirty_limit / DIRTY_SCOPE);
> - pages = min(pages, work->nr_pages);
> - pages = round_down(pages + MIN_WRITEBACK_PAGES,
> - MIN_WRITEBACK_PAGES);
> - }
> + return LONG_MAX;
>
> - return pages;
> + pages = min(wb->avg_write_bandwidth / 2,
> + global_wb_domain.dirty_limit / DIRTY_SCOPE);
> + pages = min(pages, work->nr_pages);
> + return round_down(pages + MIN_WRITEBACK_PAGES, MIN_WRITEBACK_PAGES);
> }
>
> /*
> --
> 2.47.3
>
--
Jan Kara <jack@suse.com>
SUSE Labs, CR