lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <20180530155432.GK1351649@devbig577.frc2.facebook.com>
Date:   Wed, 30 May 2018 08:54:32 -0700
From:   Tejun Heo <tj@...nel.org>
To:     Josef Bacik <josef@...icpanda.com>
Cc:     axboe@...nel.dk, kernel-team@...com, linux-block@...r.kernel.org,
        akpm@...ux-foundation.org, linux-mm@...ck.org, hannes@...xchg.org,
        linux-kernel@...r.kernel.org, linux-fsdevel@...r.kernel.org,
        Josef Bacik <jbacik@...com>
Subject: Re: [PATCH 03/13] blk-cgroup: allow controllers to output their own
 stats

On Tue, May 29, 2018 at 05:17:14PM -0400, Josef Bacik wrote:
...
> +		mutex_lock(&blkcg_pol_mutex);
> +		for (i = 0; i < BLKCG_MAX_POLS; i++) {
> +			struct blkcg_policy *pol = blkcg_policy[i];
> +
> +			if (!blkg->pd[i] || !pol->pd_stat_fn)
> +				continue;
> +
> +			count = pol->pd_stat_fn(blkg->pd[i], buf, size);

Wouldn't it be easier to simply pass in the seq_file?

> +			if (count >= size)
> +				continue;
> +			buf += count;
> +			total += count;
> +			size -= count + 1;
> +		}
> +		mutex_unlock(&blkcg_pol_mutex);
> +		if (total) {
> +			count = snprintf(buf, size, "\n");
> +			if (count >= size)
> +				continue;

scnprintf() might make this less painful.

> +			total += count;
> +			seq_commit(sf, total);
> +		}

Thanks.

-- 
tejun

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ