]> git.ipfire.org Git - thirdparty/linux.git/commitdiff
writeback: cleanup writeback_chunk_size
authorChristoph Hellwig <hch@lst.de>
Fri, 17 Oct 2025 03:45:47 +0000 (05:45 +0200)
committerChristian Brauner <brauner@kernel.org>
Wed, 29 Oct 2025 14:54:31 +0000 (15:54 +0100)
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>
Link: https://patch.msgid.link/20251017034611.651385-2-hch@lst.de
Reviewed-by: Damien Le Moal <dlemoal@kernel.org>
Reviewed-by: Darrick J. Wong <djwong@kernel.org>
Reviewed-by: Nirjhar Roy (IBM) <nirjhar.roy.lists@gmail.com>
Reviewed-by: Jan Kara <jack@suse.cz>
Signed-off-by: Christian Brauner <brauner@kernel.org>
fs/fs-writeback.c

index 4448de35ec8bc27f5062f8eeb8cbfba5b598c4b1..30de37865fa12ae9dfe274efea7076602031b036 100644 (file)
@@ -1908,16 +1908,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);
 }
 
 /*