mirror of
https://mirrors.bfsu.edu.cn/git/linux.git
synced 2024-11-13 14:24:11 +08:00
nvdimm: remove nd_integrity_init
nd_integrity_init is only called from a single place. Open code it there, and use IS_ENABLED to remove the need for an extra stub. Signed-off-by: Christoph Hellwig <hch@lst.de> Link: https://lore.kernel.org/r/20240306142739.237234-2-hch@lst.de Signed-off-by: Ira Weiny <ira.weiny@intel.com>
This commit is contained in:
parent
2c720b492c
commit
9566b89295
@ -6,6 +6,7 @@
|
|||||||
#include <linux/highmem.h>
|
#include <linux/highmem.h>
|
||||||
#include <linux/debugfs.h>
|
#include <linux/debugfs.h>
|
||||||
#include <linux/blkdev.h>
|
#include <linux/blkdev.h>
|
||||||
|
#include <linux/blk-integrity.h>
|
||||||
#include <linux/pagemap.h>
|
#include <linux/pagemap.h>
|
||||||
#include <linux/module.h>
|
#include <linux/module.h>
|
||||||
#include <linux/device.h>
|
#include <linux/device.h>
|
||||||
@ -1514,10 +1515,13 @@ static int btt_blk_init(struct btt *btt)
|
|||||||
blk_queue_flag_set(QUEUE_FLAG_NONROT, btt->btt_disk->queue);
|
blk_queue_flag_set(QUEUE_FLAG_NONROT, btt->btt_disk->queue);
|
||||||
blk_queue_flag_set(QUEUE_FLAG_SYNCHRONOUS, btt->btt_disk->queue);
|
blk_queue_flag_set(QUEUE_FLAG_SYNCHRONOUS, btt->btt_disk->queue);
|
||||||
|
|
||||||
if (btt_meta_size(btt)) {
|
if (btt_meta_size(btt) && IS_ENABLED(CONFIG_BLK_DEV_INTEGRITY)) {
|
||||||
rc = nd_integrity_init(btt->btt_disk, btt_meta_size(btt));
|
struct blk_integrity bi = {
|
||||||
if (rc)
|
.tuple_size = btt_meta_size(btt),
|
||||||
goto out_cleanup_disk;
|
.tag_size = btt_meta_size(btt),
|
||||||
|
};
|
||||||
|
blk_integrity_register(btt->btt_disk, &bi);
|
||||||
|
blk_queue_max_integrity_segments(btt->btt_disk->queue, 1);
|
||||||
}
|
}
|
||||||
|
|
||||||
set_capacity(btt->btt_disk, btt->nlba * btt->sector_size >> 9);
|
set_capacity(btt->btt_disk, btt->nlba * btt->sector_size >> 9);
|
||||||
|
@ -7,7 +7,6 @@
|
|||||||
#include <linux/export.h>
|
#include <linux/export.h>
|
||||||
#include <linux/module.h>
|
#include <linux/module.h>
|
||||||
#include <linux/blkdev.h>
|
#include <linux/blkdev.h>
|
||||||
#include <linux/blk-integrity.h>
|
|
||||||
#include <linux/device.h>
|
#include <linux/device.h>
|
||||||
#include <linux/ctype.h>
|
#include <linux/ctype.h>
|
||||||
#include <linux/ndctl.h>
|
#include <linux/ndctl.h>
|
||||||
@ -508,35 +507,6 @@ int nvdimm_bus_add_badrange(struct nvdimm_bus *nvdimm_bus, u64 addr, u64 length)
|
|||||||
}
|
}
|
||||||
EXPORT_SYMBOL_GPL(nvdimm_bus_add_badrange);
|
EXPORT_SYMBOL_GPL(nvdimm_bus_add_badrange);
|
||||||
|
|
||||||
#ifdef CONFIG_BLK_DEV_INTEGRITY
|
|
||||||
int nd_integrity_init(struct gendisk *disk, unsigned long meta_size)
|
|
||||||
{
|
|
||||||
struct blk_integrity bi;
|
|
||||||
|
|
||||||
if (meta_size == 0)
|
|
||||||
return 0;
|
|
||||||
|
|
||||||
memset(&bi, 0, sizeof(bi));
|
|
||||||
|
|
||||||
bi.tuple_size = meta_size;
|
|
||||||
bi.tag_size = meta_size;
|
|
||||||
|
|
||||||
blk_integrity_register(disk, &bi);
|
|
||||||
blk_queue_max_integrity_segments(disk->queue, 1);
|
|
||||||
|
|
||||||
return 0;
|
|
||||||
}
|
|
||||||
EXPORT_SYMBOL(nd_integrity_init);
|
|
||||||
|
|
||||||
#else /* CONFIG_BLK_DEV_INTEGRITY */
|
|
||||||
int nd_integrity_init(struct gendisk *disk, unsigned long meta_size)
|
|
||||||
{
|
|
||||||
return 0;
|
|
||||||
}
|
|
||||||
EXPORT_SYMBOL(nd_integrity_init);
|
|
||||||
|
|
||||||
#endif
|
|
||||||
|
|
||||||
static __init int libnvdimm_init(void)
|
static __init int libnvdimm_init(void)
|
||||||
{
|
{
|
||||||
int rc;
|
int rc;
|
||||||
|
@ -489,7 +489,6 @@ enum nd_async_mode {
|
|||||||
ND_ASYNC,
|
ND_ASYNC,
|
||||||
};
|
};
|
||||||
|
|
||||||
int nd_integrity_init(struct gendisk *disk, unsigned long meta_size);
|
|
||||||
void wait_nvdimm_bus_probe_idle(struct device *dev);
|
void wait_nvdimm_bus_probe_idle(struct device *dev);
|
||||||
void nd_device_register(struct device *dev);
|
void nd_device_register(struct device *dev);
|
||||||
void nd_device_unregister(struct device *dev, enum nd_async_mode mode);
|
void nd_device_unregister(struct device *dev, enum nd_async_mode mode);
|
||||||
|
Loading…
Reference in New Issue
Block a user