Skip to content

Commit 0b2186d

Browse files
tobluxkdave
authored andcommitted
btrfs: scrub: replace max_t()/min_t() with clamp_t() in scrub_throttle_dev_io()
Replace max_t() followed by min_t() with a single clamp_t(). Manually casting 'bwlimit / (16 * 1024 * 1024)' to u32 is also redundant when using max_t(u32,,) or clamp_t(u32,,) and can be removed. No functional changes intended. Signed-off-by: Thorsten Blum <[email protected]> Reviewed-by: David Sterba <[email protected]> Signed-off-by: David Sterba <[email protected]>
1 parent c184005 commit 0b2186d

File tree

1 file changed

+1
-2
lines changed

1 file changed

+1
-2
lines changed

fs/btrfs/scrub.c

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1369,8 +1369,7 @@ static void scrub_throttle_dev_io(struct scrub_ctx *sctx, struct btrfs_device *d
13691369
* Slice is divided into intervals when the IO is submitted, adjust by
13701370
* bwlimit and maximum of 64 intervals.
13711371
*/
1372-
div = max_t(u32, 1, (u32)(bwlimit / (16 * 1024 * 1024)));
1373-
div = min_t(u32, 64, div);
1372+
div = clamp_t(u32, bwlimit / (16 * 1024 * 1024), 1, 64);
13741373

13751374
/* Start new epoch, set deadline */
13761375
now = ktime_get();

0 commit comments

Comments
 (0)