Re: [PATCH 03/12] blkcg: convert blkg_lookup_create to find closest blkg

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

 



Hello,

On Thu, Sep 06, 2018 at 05:10:36PM -0400, Dennis Zhou wrote:
> @@ -2021,9 +2021,7 @@ int bio_associate_blkg(struct bio *bio, struct blkcg_gq *blkg)
>  {
>  	if (unlikely(bio->bi_blkg))
>  		return -EBUSY;
> +	bio->bi_blkg = blkg_try_get_closest(blkg);
>  	return 0;

It prolly would be a good idea to point out that the associated blkg
might not be the same one passed in.  Maybe this gets cleared up later
in the series?

> @@ -298,14 +297,23 @@ struct blkcg_gq *__blkg_lookup_create(struct blkcg *blkcg,
>  	while (true) {
>  		struct blkcg *pos = blkcg;
>  		struct blkcg *parent = blkcg_parent(blkcg);
> -
> -		while (parent && !__blkg_lookup(parent, q, false)) {
> +		struct blkcg_gq *ret_blkg = NULL;
> +
> +		while (parent) {
> +			blkg = __blkg_lookup(parent, q, false);
> +			if (blkg) {
> +				/* remember closest blkg */
> +				ret_blkg = blkg;
> +				break;
> +			}
>  			pos = parent;
>  			parent = blkcg_parent(parent);
>  		}
>  
>  		blkg = blkg_create(pos, q, NULL);
> -		if (pos == blkcg || IS_ERR(blkg))
> +		if (IS_ERR(blkg))
> +			return ret_blkg ?: q->root_blkg;

Why not ret_blkg here?

Thanks.

-- 
tejun



[Index of Archives]     [Linux RAID]     [Linux SCSI]     [Linux ATA RAID]     [IDE]     [Linux Wireless]     [Linux Kernel]     [ATH6KL]     [Linux Bluetooth]     [Linux Netdev]     [Kernel Newbies]     [Security]     [Git]     [Netfilter]     [Bugtraq]     [Yosemite News]     [MIPS Linux]     [ARM Linux]     [Linux Security]     [Device Mapper]

  Powered by Linux