[V3 2/4] nvmet: remove extra variable in smart log nsid

Sagi Grimberg sagi at grimberg.me
Wed Jan 13 17:04:37 EST 2021


> @@ -86,23 +86,21 @@ static u16 nvmet_get_smart_log_nsid(struct nvmet_req *req,
>   	}
>   
>   	/* we don't have the right data for file backed ns */
> -	if (!ns->bdev)
> +	if (!req->ns->bdev)
>   		goto out;
>   
> -	host_reads = part_stat_read(ns->bdev, ios[READ]);
> +	host_reads = part_stat_read(req->ns->bdev, ios[READ]);
>   	data_units_read =
> -		DIV_ROUND_UP(part_stat_read(ns->bdev, sectors[READ]), 1000);
> -	host_writes = part_stat_read(ns->bdev, ios[WRITE]);
> +		DIV_ROUND_UP(part_stat_read(req->ns->bdev, sectors[READ]), 1000);
> +	host_writes = part_stat_read(req->ns->bdev, ios[WRITE]);
>   	data_units_written =
> -		DIV_ROUND_UP(part_stat_read(ns->bdev, sectors[WRITE]), 1000);
> +		DIV_ROUND_UP(part_stat_read(req->ns->bdev, sectors[WRITE]), 1000);
>   
>   	put_unaligned_le64(host_reads, &slog->host_reads[0]);
>   	put_unaligned_le64(data_units_read, &slog->data_units_read[0]);
>   	put_unaligned_le64(host_writes, &slog->host_writes[0]);
>   	put_unaligned_le64(data_units_written, &slog->data_units_written[0]);
>   out:
> -	nvmet_put_namespace(ns);
> -

I think the out label can also be eliminated now.



More information about the Linux-nvme mailing list