Re: [RFC PATCH v1 1/3] blk-cgroup: add helpers for bio cgroup state

Christoph Hellwig <[email protected]> Tue, 4 Aug 2026 15:25:27 +0200
Newsgroups dev.linux.lists.dm-devel,dev.linux.lists.gfs2,dev.linux.lists.nvdimm,dev.linux.lists.virtualization,org.kernel.vger.cgroups,org.kernel.vger.linux-bcache,org.kernel.vger.linux-block,org.kernel.vger.linux-doc,org.kernel.vger.linux-fsdevel,org.kernel.vger.linux-kernel,org.kernel.vger.linux-raid,org.kvack.linux-mm
Message-ID <[email protected]>
On Tue, Aug 04, 2026 at 12:52:16PM +0200, Jan Kara wrote:
> Mostly looks good. Just I think bio_blkcg() should gracefully handle the
> case where bio->bi_blkg is NULL (and return NULL in that case). That way
> you can also get rid of somewhat odd pattern:
> 
> 	if (!bio_blkg(bio))
> 		return ...;
> 	do something with bio_blkcg(bio)
> 
> You can then just check bio_blkcg(bio) directly which is much more obvious.

Yes.  Looking at the whole series I'm also not sure that this makes too
much sense as a split out patch as the next one touches more than half
of the callsite anyway.