]> asedeno.scripts.mit.edu Git - linux.git/blobdiff - drivers/lightnvm/pblk-rb.c
lightnvm: pblk: add SPDX license tag
[linux.git] / drivers / lightnvm / pblk-rb.c
index 55e9442a99e2bfd664932d50a7a5b5ece9b9c9a8..c26eab2ba8bd0aa574af0f1b508ac2377ca40c6e 100644 (file)
@@ -1,3 +1,4 @@
+// SPDX-License-Identifier: GPL-2.0
 /*
  * Copyright (C) 2016 CNEX Labs
  * Initial release: Javier Gonzalez <javier@cnexlabs.com>
@@ -111,7 +112,7 @@ int pblk_rb_init(struct pblk_rb *rb, struct pblk_rb_entry *rb_entry_base,
        } while (iter > 0);
        up_write(&pblk_rb_lock);
 
-#ifdef CONFIG_NVM_DEBUG
+#ifdef CONFIG_NVM_PBLK_DEBUG
        atomic_set(&rb->inflight_flush_point, 0);
 #endif
 
@@ -225,7 +226,7 @@ static int __pblk_rb_update_l2p(struct pblk_rb *rb, unsigned int to_update)
                pblk_update_map_dev(pblk, w_ctx->lba, w_ctx->ppa,
                                                        entry->cacheline);
 
-               line = &pblk->lines[pblk_ppa_to_line(w_ctx->ppa)];
+               line = pblk_ppa_to_line(pblk, w_ctx->ppa);
                kref_put(&line->ref, pblk_line_put);
                clean_wctx(w_ctx);
                rb->l2p_update = (rb->l2p_update + 1) & (rb->nr_entries - 1);
@@ -308,7 +309,7 @@ void pblk_rb_write_entry_user(struct pblk_rb *rb, void *data,
 
        entry = &rb->entries[ring_pos];
        flags = READ_ONCE(entry->w_ctx.flags);
-#ifdef CONFIG_NVM_DEBUG
+#ifdef CONFIG_NVM_PBLK_DEBUG
        /* Caller must guarantee that the entry is free */
        BUG_ON(!(flags & PBLK_WRITABLE_ENTRY));
 #endif
@@ -332,7 +333,7 @@ void pblk_rb_write_entry_gc(struct pblk_rb *rb, void *data,
 
        entry = &rb->entries[ring_pos];
        flags = READ_ONCE(entry->w_ctx.flags);
-#ifdef CONFIG_NVM_DEBUG
+#ifdef CONFIG_NVM_PBLK_DEBUG
        /* Caller must guarantee that the entry is free */
        BUG_ON(!(flags & PBLK_WRITABLE_ENTRY));
 #endif
@@ -362,7 +363,7 @@ static int pblk_rb_flush_point_set(struct pblk_rb *rb, struct bio *bio,
                return 0;
        }
 
-#ifdef CONFIG_NVM_DEBUG
+#ifdef CONFIG_NVM_PBLK_DEBUG
        atomic_inc(&rb->inflight_flush_point);
 #endif
 
@@ -547,7 +548,7 @@ unsigned int pblk_rb_read_to_bio(struct pblk_rb *rb, struct nvm_rq *rqd,
 
                page = virt_to_page(entry->data);
                if (!page) {
-                       pr_err("pblk: could not allocate write bio page\n");
+                       pblk_err(pblk, "could not allocate write bio page\n");
                        flags &= ~PBLK_WRITTEN_DATA;
                        flags |= PBLK_SUBMITTED_ENTRY;
                        /* Release flags on context. Protect from writes */
@@ -557,7 +558,7 @@ unsigned int pblk_rb_read_to_bio(struct pblk_rb *rb, struct nvm_rq *rqd,
 
                if (bio_add_pc_page(q, bio, page, rb->seg_size, 0) !=
                                                                rb->seg_size) {
-                       pr_err("pblk: could not add page to write bio\n");
+                       pblk_err(pblk, "could not add page to write bio\n");
                        flags &= ~PBLK_WRITTEN_DATA;
                        flags |= PBLK_SUBMITTED_ENTRY;
                        /* Release flags on context. Protect from writes */
@@ -576,19 +577,19 @@ unsigned int pblk_rb_read_to_bio(struct pblk_rb *rb, struct nvm_rq *rqd,
 
        if (pad) {
                if (pblk_bio_add_pages(pblk, bio, GFP_KERNEL, pad)) {
-                       pr_err("pblk: could not pad page in write bio\n");
+                       pblk_err(pblk, "could not pad page in write bio\n");
                        return NVM_IO_ERR;
                }
 
                if (pad < pblk->min_write_pgs)
                        atomic64_inc(&pblk->pad_dist[pad - 1]);
                else
-                       pr_warn("pblk: padding more than min. sectors\n");
+                       pblk_warn(pblk, "padding more than min. sectors\n");
 
                atomic64_add(pad, &pblk->pad_wa);
        }
 
-#ifdef CONFIG_NVM_DEBUG
+#ifdef CONFIG_NVM_PBLK_DEBUG
        atomic_long_add(pad, &pblk->padded_writes);
 #endif
 
@@ -613,7 +614,7 @@ int pblk_rb_copy_to_bio(struct pblk_rb *rb, struct bio *bio, sector_t lba,
        int ret = 1;
 
 
-#ifdef CONFIG_NVM_DEBUG
+#ifdef CONFIG_NVM_PBLK_DEBUG
        /* Caller must ensure that the access will not cause an overflow */
        BUG_ON(pos >= rb->nr_entries);
 #endif
@@ -820,7 +821,7 @@ ssize_t pblk_rb_sysfs(struct pblk_rb *rb, char *buf)
                        rb->subm,
                        rb->sync,
                        rb->l2p_update,
-#ifdef CONFIG_NVM_DEBUG
+#ifdef CONFIG_NVM_PBLK_DEBUG
                        atomic_read(&rb->inflight_flush_point),
 #else
                        0,
@@ -838,7 +839,7 @@ ssize_t pblk_rb_sysfs(struct pblk_rb *rb, char *buf)
                        rb->subm,
                        rb->sync,
                        rb->l2p_update,
-#ifdef CONFIG_NVM_DEBUG
+#ifdef CONFIG_NVM_PBLK_DEBUG
                        atomic_read(&rb->inflight_flush_point),
 #else
                        0,