Re: [PATCH 09/17] blk-iocost: simplify ioc_name

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

 



On Wed, Sep 21, 2022 at 08:04:53PM +0200, Christoph Hellwig wrote:
> Just directly dereference the disk name instead of going through multiple
> hoops to find the same value.
> 
> Signed-off-by: Christoph Hellwig <hch@xxxxxx>
> ---
>  block/blk-iocost.c | 14 +++++---------
>  1 file changed, 5 insertions(+), 9 deletions(-)

Reviewed-by: Andreas Herrmann <aherrmann@xxxxxxx>

> diff --git a/block/blk-iocost.c b/block/blk-iocost.c
> index 7936e5f5821c7..cba9d3ad58e16 100644
> --- a/block/blk-iocost.c
> +++ b/block/blk-iocost.c
> @@ -664,17 +664,13 @@ static struct ioc *q_to_ioc(struct request_queue *q)
>  	return rqos_to_ioc(rq_qos_id(q, RQ_QOS_COST));
>  }
>  
> -static const char *q_name(struct request_queue *q)
> -{
> -	if (blk_queue_registered(q))
> -		return kobject_name(q->kobj.parent);
> -	else
> -		return "<unknown>";
> -}
> -
>  static const char __maybe_unused *ioc_name(struct ioc *ioc)
>  {
> -	return q_name(ioc->rqos.q);
> +	struct gendisk *disk = ioc->rqos.q->disk;
> +
> +	if (!disk)
> +		return "<unknown>";
> +	return disk->disk_name;
>  }
>  
>  static struct ioc_gq *pd_to_iocg(struct blkg_policy_data *pd)
> -- 
> 2.30.2
> 

-- 
Regards,
Andreas

SUSE Software Solutions Germany GmbH
Frankenstrasse 146, 90461 Nürnberg, Germany
GF: Ivo Totev, Andrew Myers, Andrew McDonald, Martje Boudien Moerman
(HRB 36809, AG Nürnberg)



[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