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] [day] [month] [year] [list]
Date:   Mon, 20 Aug 2018 11:49:16 +0000
From:   Javier Gonzalez <javier@...xlabs.com>
To:     Matias Bjørling <mb@...htnvm.io>
CC:     "Konopko, Igor J" <igor.j.konopko@...el.com>,
        "marcin.dziegielewski@...el.com" <marcin.dziegielewski@...el.com>,
        Hans Holmberg <hans.holmberg@...xlabs.com>,
        Heiner Litz <hlitz@...c.edu>,
        Young Tack Tack Jin <youngtack.jin@...cuitblvd.com>,
        "linux-block@...r.kernel.org" <linux-block@...r.kernel.org>,
        "linux-kernel@...r.kernel.org" <linux-kernel@...r.kernel.org>
Subject: Re: [PATCH] lightnvm: pblk: refactor put line fn on read completion

> On 20 Aug 2018, at 13.43, Matias Bjørling <mb@...htnvm.io> wrote:
> 
> The read completion path uses the put_line variable to decide whether
> the reference on a line should be released. The function name used for
> that is pblk_read_put_rqd_kref, which could lead one to believe that it
> is the rqd that is releasing the reference, while it is the line
> reference that is put.
> 
> Rename and also split the function in two to account for either rqd or
> single ppa callers.
> 
> Signed-off-by: Matias Bjørling <mb@...htnvm.io>
> ---
> drivers/lightnvm/pblk-read.c | 23 +++++++++++++----------
> 1 file changed, 13 insertions(+), 10 deletions(-)
> 
> diff --git a/drivers/lightnvm/pblk-read.c b/drivers/lightnvm/pblk-read.c
> index cd2f61eed6a0..16858eaf694a 100644
> --- a/drivers/lightnvm/pblk-read.c
> +++ b/drivers/lightnvm/pblk-read.c
> @@ -165,20 +165,23 @@ static void pblk_read_check_rand(struct pblk *pblk, struct nvm_rq *rqd,
> 	WARN_ONCE(j != rqd->nr_ppas, "pblk: corrupted random request\n");
> }
> 
> -static void pblk_read_put_rqd_kref(struct pblk *pblk, struct nvm_rq *rqd)
> +static void __pblk_read_put_line(struct pblk *pblk, struct ppa_addr ppa)
> {
> -	struct ppa_addr *ppa_list;
> -	int i;
> -
> -	ppa_list = (rqd->nr_ppas > 1) ? rqd->ppa_list : &rqd->ppa_addr;
> -
> -	for (i = 0; i < rqd->nr_ppas; i++) {
> -		struct ppa_addr ppa = ppa_list[i];
> 		struct pblk_line *line;
> 
> 		line = &pblk->lines[pblk_ppa_to_line(ppa)];
> 		kref_put(&line->ref, pblk_line_put_wq);
> -	}
> +}
> +
> +static void pblk_read_put_line(struct pblk *pblk, struct nvm_rq *rqd)
> +{
> +	struct ppa_addr *ppa_list;
> +	int i;
> +
> +	ppa_list = (rqd->nr_ppas > 1) ? rqd->ppa_list : &rqd->ppa_addr;
> +
> +	for (i = 0; i < rqd->nr_ppas; i++)
> +		__pblk_read_put_line(pblk, ppa_list[i]);
> }
> 
> static void pblk_end_user_read(struct bio *bio)
> @@ -208,7 +211,7 @@ static void __pblk_end_io_read(struct pblk *pblk, struct nvm_rq *rqd,
> 		bio_put(int_bio);
> 
> 	if (put_line)
> -		pblk_read_put_rqd_kref(pblk, rqd);
> +		pblk_read_put_line(pblk, rqd);
> 
> #ifdef CONFIG_NVM_PBLK_DEBUG
> 	atomic_long_add(rqd->nr_ppas, &pblk->sync_reads);
> --
> 2.11.0

Looks good to me

Reviewed-by: Javier González <javier@...xlabs.com>


Download attachment "signature.asc" of type "application/pgp-signature" (834 bytes)

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ