Re: [PATCH v2 8/8] writeback: factor out balance_wb_limits to remove repeated code

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Hello,

On Tue, May 14, 2024 at 08:52:54PM +0800, Kemeng Shi wrote:
> +static void balance_wb_limits(struct dirty_throttle_control *dtc,
> +			      bool strictlimit)
> +{
> +	wb_dirty_freerun(dtc, strictlimit);
> +	if (dtc->freerun)
> +		return;
> +
> +	wb_dirty_exceeded(dtc, strictlimit);
> +	wb_position_ratio(dtc);
> +}
...
> @@ -1869,12 +1880,9 @@ static int balance_dirty_pages(struct bdi_writeback *wb,
>  		 * Calculate global domain's pos_ratio and select the
>  		 * global dtc by default.
>  		 */
> -		wb_dirty_freerun(gdtc, strictlimit);
> +		balance_wb_limits(gdtc, strictlimit);
>  		if (gdtc->freerun)
>  			goto free_running;
> -
> -		wb_dirty_exceeded(gdtc, strictlimit);
> -		wb_position_ratio(gdtc);
>  		sdtc = gdtc;

Isn't this a bit nasty? The helper skips updating states because it knows
the caller is not going to use them? I'm not sure the slight code reduction
justifies the added subtlety.

Thanks.

-- 
tejun




[Index of Archives]     [Linux Ext4 Filesystem]     [Union Filesystem]     [Filesystem Testing]     [Ceph Users]     [Ecryptfs]     [NTFS 3]     [AutoFS]     [Kernel Newbies]     [Share Photos]     [Security]     [Netfilter]     [Bugtraq]     [Yosemite News]     [MIPS Linux]     [ARM Linux]     [Linux Security]     [Linux Cachefs]     [Reiser Filesystem]     [Linux RAID]     [NTFS 3]     [Samba]     [Device Mapper]     [CEPH Development]

  Powered by Linux