lightnvm: pblk: spare double cpu_to_le64 calc.
authorJavier González <jg@lightnvm.io>
Mon, 26 Jun 2017 09:57:12 +0000 (11:57 +0200)
committerJens Axboe <axboe@kernel.dk>
Mon, 26 Jun 2017 22:24:53 +0000 (16:24 -0600)
Spare a double calculation on the fast write path.

Signed-off-by: Javier González <javier@cnexlabs.com>
Signed-off-by: Matias Bjørling <matias@cnexlabs.com>
Signed-off-by: Jens Axboe <axboe@kernel.dk>
drivers/lightnvm/pblk-map.c
drivers/lightnvm/pblk-recovery.c

index 17c16955284da854fddcaf238eb00d4c3c567d02..18291c238930224546983559890c738fd07fc01c 100644 (file)
@@ -53,8 +53,9 @@ static void pblk_map_page_data(struct pblk *pblk, unsigned int sentry,
                        lba_list[paddr] = cpu_to_le64(w_ctx->lba);
                        le64_add_cpu(&line->emeta->nr_valid_lbas, 1);
                } else {
-                       meta_list[i].lba = cpu_to_le64(ADDR_EMPTY);
-                       lba_list[paddr] = cpu_to_le64(ADDR_EMPTY);
+                       u64 addr_empty = cpu_to_le64(ADDR_EMPTY);
+
+                       lba_list[paddr] = meta_list[i].lba = addr_empty;
                        pblk_map_pad_invalidate(pblk, line, paddr);
                }
        }
index f8f85087cd3c2bab3342158638405e8f4b76d642..82787006b865af4655487fd2e583d0a28fedde77 100644 (file)
@@ -390,12 +390,12 @@ next_pad_rq:
 
                for (j = 0; j < pblk->min_write_pgs; j++, i++, w_ptr++) {
                        struct ppa_addr dev_ppa;
+                       u64 addr_empty = cpu_to_le64(ADDR_EMPTY);
 
                        dev_ppa = addr_to_gen_ppa(pblk, w_ptr, line->id);
 
                        pblk_map_invalidate(pblk, dev_ppa);
-                       meta_list[i].lba = cpu_to_le64(ADDR_EMPTY);
-                       lba_list[w_ptr] = cpu_to_le64(ADDR_EMPTY);
+                       lba_list[w_ptr] = meta_list[i].lba = addr_empty;
                        rqd->ppa_list[i] = dev_ppa;
                }
        }