Commit 880eda54 authored by Matias Bjørling's avatar Matias Bjørling Committed by Jens Axboe
Browse files

lightnvm: move NVM_DEBUG to pblk



There is no users of CONFIG_NVM_DEBUG in the LightNVM subsystem. All
users are in pblk. Rename NVM_DEBUG to NVM_PBLK_DEBUG and enable
only for pblk.

Also fix up the CONFIG_NVM_PBLK entry to follow the code style for
Kconfig files.

Signed-off-by: default avatarMatias Bjørling <mb@lightnvm.io>
Reviewed-by: default avatarJavier González <javier@cnexlabs.com>
Signed-off-by: default avatarJens Axboe <axboe@kernel.dk>
parent ffc03fb7
Loading
Loading
Loading
Loading
+16 −14
Original line number Diff line number Diff line
@@ -17,23 +17,25 @@ menuconfig NVM

if NVM

config NVM_DEBUG
	bool "Open-Channel SSD debugging support"
	default n
	---help---
	Exposes a debug management interface to create/remove targets at:

	  /sys/module/lnvm/parameters/configure_debug

	It is required to create/remove targets without IOCTLs.

config NVM_PBLK
	tristate "Physical Block Device Open-Channel SSD target"
	---help---
	help
	  Allows an open-channel SSD to be exposed as a block device to the
	  host. The target assumes the device exposes raw flash and must be
	  explicitly managed by the host.

	  Please note the disk format is considered EXPERIMENTAL for now.

if NVM_PBLK

config NVM_PBLK_DEBUG
	bool "PBlk Debug Support"
	default n
	help
	  Enables debug support for pblk. This includes extra checks, more
	  vocal error messages, and extra tracking fields in the pblk sysfs
	  entries.

endif # NVM_PBLK_DEBUG

endif # NVM
+2 −2
Original line number Diff line number Diff line
@@ -67,7 +67,7 @@ retry:

	atomic64_add(nr_entries, &pblk->user_wa);

#ifdef CONFIG_NVM_DEBUG
#ifdef CONFIG_NVM_PBLK_DEBUG
	atomic_long_add(nr_entries, &pblk->inflight_writes);
	atomic_long_add(nr_entries, &pblk->req_writes);
#endif
@@ -123,7 +123,7 @@ retry:

	atomic64_add(valid_entries, &pblk->gc_wa);

#ifdef CONFIG_NVM_DEBUG
#ifdef CONFIG_NVM_PBLK_DEBUG
	atomic_long_add(valid_entries, &pblk->inflight_writes);
	atomic_long_add(valid_entries, &pblk->recov_gc_writes);
#endif
+13 −13
Original line number Diff line number Diff line
@@ -194,7 +194,7 @@ void pblk_map_invalidate(struct pblk *pblk, struct ppa_addr ppa)
	u64 paddr;
	int line_id;

#ifdef CONFIG_NVM_DEBUG
#ifdef CONFIG_NVM_PBLK_DEBUG
	/* Callers must ensure that the ppa points to a device address */
	BUG_ON(pblk_addr_in_cache(ppa));
	BUG_ON(pblk_ppa_empty(ppa));
@@ -430,7 +430,7 @@ void pblk_discard(struct pblk *pblk, struct bio *bio)
void pblk_log_write_err(struct pblk *pblk, struct nvm_rq *rqd)
{
	atomic_long_inc(&pblk->write_failed);
#ifdef CONFIG_NVM_DEBUG
#ifdef CONFIG_NVM_PBLK_DEBUG
	pblk_print_failed_rqd(pblk, rqd, rqd->error);
#endif
}
@@ -454,7 +454,7 @@ void pblk_log_read_err(struct pblk *pblk, struct nvm_rq *rqd)
	default:
		pr_err("pblk: unknown read error:%d\n", rqd->error);
	}
#ifdef CONFIG_NVM_DEBUG
#ifdef CONFIG_NVM_PBLK_DEBUG
	pblk_print_failed_rqd(pblk, rqd, rqd->error);
#endif
}
@@ -470,7 +470,7 @@ int pblk_submit_io(struct pblk *pblk, struct nvm_rq *rqd)

	atomic_inc(&pblk->inflight_io);

#ifdef CONFIG_NVM_DEBUG
#ifdef CONFIG_NVM_PBLK_DEBUG
	if (pblk_check_io(pblk, rqd))
		return NVM_IO_ERR;
#endif
@@ -484,7 +484,7 @@ int pblk_submit_io_sync(struct pblk *pblk, struct nvm_rq *rqd)

	atomic_inc(&pblk->inflight_io);

#ifdef CONFIG_NVM_DEBUG
#ifdef CONFIG_NVM_PBLK_DEBUG
	if (pblk_check_io(pblk, rqd))
		return NVM_IO_ERR;
#endif
@@ -1726,7 +1726,7 @@ void pblk_line_close(struct pblk *pblk, struct pblk_line *line)
	struct list_head *move_list;
	int i;

#ifdef CONFIG_NVM_DEBUG
#ifdef CONFIG_NVM_PBLK_DEBUG
	WARN(!bitmap_full(line->map_bitmap, lm->sec_per_line),
				"pblk: corrupt closed line %d\n", line->id);
#endif
@@ -1856,7 +1856,7 @@ static void __pblk_down_page(struct pblk *pblk, struct ppa_addr *ppa_list,
	 * Only send one inflight I/O per LUN. Since we map at a page
	 * granurality, all ppas in the I/O will map to the same LUN
	 */
#ifdef CONFIG_NVM_DEBUG
#ifdef CONFIG_NVM_PBLK_DEBUG
	int i;

	for (i = 1; i < nr_ppas; i++)
@@ -1901,7 +1901,7 @@ void pblk_up_page(struct pblk *pblk, struct ppa_addr *ppa_list, int nr_ppas)
	struct pblk_lun *rlun;
	int pos = pblk_ppa_to_pos(geo, ppa_list[0]);

#ifdef CONFIG_NVM_DEBUG
#ifdef CONFIG_NVM_PBLK_DEBUG
	int i;

	for (i = 1; i < nr_ppas; i++)
@@ -1951,7 +1951,7 @@ void pblk_update_map(struct pblk *pblk, sector_t lba, struct ppa_addr ppa)
void pblk_update_map_cache(struct pblk *pblk, sector_t lba, struct ppa_addr ppa)
{

#ifdef CONFIG_NVM_DEBUG
#ifdef CONFIG_NVM_PBLK_DEBUG
	/* Callers must ensure that the ppa points to a cache address */
	BUG_ON(!pblk_addr_in_cache(ppa));
	BUG_ON(pblk_rb_pos_oob(&pblk->rwb, pblk_addr_to_cacheline(ppa)));
@@ -1966,7 +1966,7 @@ int pblk_update_map_gc(struct pblk *pblk, sector_t lba, struct ppa_addr ppa_new,
	struct ppa_addr ppa_l2p, ppa_gc;
	int ret = 1;

#ifdef CONFIG_NVM_DEBUG
#ifdef CONFIG_NVM_PBLK_DEBUG
	/* Callers must ensure that the ppa points to a cache address */
	BUG_ON(!pblk_addr_in_cache(ppa_new));
	BUG_ON(pblk_rb_pos_oob(&pblk->rwb, pblk_addr_to_cacheline(ppa_new)));
@@ -2003,14 +2003,14 @@ void pblk_update_map_dev(struct pblk *pblk, sector_t lba,
{
	struct ppa_addr ppa_l2p;

#ifdef CONFIG_NVM_DEBUG
#ifdef CONFIG_NVM_PBLK_DEBUG
	/* Callers must ensure that the ppa points to a device address */
	BUG_ON(pblk_addr_in_cache(ppa_mapped));
#endif
	/* Invalidate and discard padded entries */
	if (lba == ADDR_EMPTY) {
		atomic64_inc(&pblk->pad_wa);
#ifdef CONFIG_NVM_DEBUG
#ifdef CONFIG_NVM_PBLK_DEBUG
		atomic_long_inc(&pblk->padded_wb);
#endif
		if (!pblk_ppa_empty(ppa_mapped))
@@ -2036,7 +2036,7 @@ void pblk_update_map_dev(struct pblk *pblk, sector_t lba,
		goto out;
	}

#ifdef CONFIG_NVM_DEBUG
#ifdef CONFIG_NVM_PBLK_DEBUG
	WARN_ON(!pblk_addr_in_cache(ppa_l2p) && !pblk_ppa_empty(ppa_l2p));
#endif

+1 −1
Original line number Diff line number Diff line
@@ -522,7 +522,7 @@ static int pblk_gc_reader_ts(void *data)
		io_schedule();
	}

#ifdef CONFIG_NVM_DEBUG
#ifdef CONFIG_NVM_PBLK_DEBUG
	pr_info("pblk: flushing gc pipeline, %d lines left\n",
		atomic_read(&gc->pipeline_gc));
#endif
+4 −4
Original line number Diff line number Diff line
@@ -91,7 +91,7 @@ static size_t pblk_trans_map_size(struct pblk *pblk)
	return entry_size * pblk->rl.nr_secs;
}

#ifdef CONFIG_NVM_DEBUG
#ifdef CONFIG_NVM_PBLK_DEBUG
static u32 pblk_l2p_crc(struct pblk *pblk)
{
	size_t map_size;
@@ -122,7 +122,7 @@ static int pblk_l2p_recover(struct pblk *pblk, bool factory_init)
		}
	}

#ifdef CONFIG_NVM_DEBUG
#ifdef CONFIG_NVM_PBLK_DEBUG
	pr_info("pblk init: L2P CRC: %x\n", pblk_l2p_crc(pblk));
#endif

@@ -1166,7 +1166,7 @@ static void pblk_exit(void *private, bool graceful)
	pblk_gc_exit(pblk, graceful);
	pblk_tear_down(pblk, graceful);

#ifdef CONFIG_NVM_DEBUG
#ifdef CONFIG_NVM_PBLK_DEBUG
	pr_info("pblk exit: L2P CRC: %x\n", pblk_l2p_crc(pblk));
#endif

@@ -1217,7 +1217,7 @@ static void *pblk_init(struct nvm_tgt_dev *dev, struct gendisk *tdisk,
	spin_lock_init(&pblk->trans_lock);
	spin_lock_init(&pblk->lock);

#ifdef CONFIG_NVM_DEBUG
#ifdef CONFIG_NVM_PBLK_DEBUG
	atomic_long_set(&pblk->inflight_writes, 0);
	atomic_long_set(&pblk->padded_writes, 0);
	atomic_long_set(&pblk->padded_wb, 0);
Loading