Skip to content

Commit a754bd5

Browse files
herbertxaxboe
authored andcommittedJan 7, 2020
block: Allow t10-pi to be modular
Currently t10-pi can only be built into the block layer which via crc-t10dif pulls in a whole chunk of the Crypto API. In fact all users of t10-pi work as modules and there is no reason for it to always be built-in. This patch adds a new hidden option for t10-pi that is selected automatically based on BLK_DEV_INTEGRITY and whether the users of t10-pi are built-in or not. Signed-off-by: Herbert Xu <[email protected]> Signed-off-by: Jens Axboe <[email protected]>
1 parent 95ed0c5 commit a754bd5

File tree

5 files changed

+12
-2
lines changed

5 files changed

+12
-2
lines changed
 

‎block/Kconfig

+5-1
Original file line numberDiff line numberDiff line change
@@ -66,7 +66,6 @@ config BLK_DEV_BSGLIB
6666

6767
config BLK_DEV_INTEGRITY
6868
bool "Block layer data integrity support"
69-
select CRC_T10DIF if BLK_DEV_INTEGRITY
7069
---help---
7170
Some storage devices allow extra information to be
7271
stored/retrieved to help protect the data. The block layer
@@ -77,6 +76,11 @@ config BLK_DEV_INTEGRITY
7776
T10/SCSI Data Integrity Field or the T13/ATA External Path
7877
Protection. If in doubt, say N.
7978

79+
config BLK_DEV_INTEGRITY_T10
80+
tristate
81+
depends on BLK_DEV_INTEGRITY
82+
select CRC_T10DIF
83+
8084
config BLK_DEV_ZONED
8185
bool "Zoned block device support"
8286
select MQ_IOSCHED_DEADLINE

‎block/Makefile

+2-1
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,8 @@ obj-$(CONFIG_IOSCHED_BFQ) += bfq.o
2727

2828
obj-$(CONFIG_BLOCK_COMPAT) += compat_ioctl.o
2929
obj-$(CONFIG_BLK_CMDLINE_PARSER) += cmdline-parser.o
30-
obj-$(CONFIG_BLK_DEV_INTEGRITY) += bio-integrity.o blk-integrity.o t10-pi.o
30+
obj-$(CONFIG_BLK_DEV_INTEGRITY) += bio-integrity.o blk-integrity.o
31+
obj-$(CONFIG_BLK_DEV_INTEGRITY_T10) += t10-pi.o
3132
obj-$(CONFIG_BLK_MQ_PCI) += blk-mq-pci.o
3233
obj-$(CONFIG_BLK_MQ_VIRTIO) += blk-mq-virtio.o
3334
obj-$(CONFIG_BLK_MQ_RDMA) += blk-mq-rdma.o

‎block/t10-pi.c

+3
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,7 @@
77
#include <linux/t10-pi.h>
88
#include <linux/blkdev.h>
99
#include <linux/crc-t10dif.h>
10+
#include <linux/module.h>
1011
#include <net/checksum.h>
1112

1213
typedef __be16 (csum_fn) (void *, unsigned int);
@@ -280,3 +281,5 @@ const struct blk_integrity_profile t10_pi_type3_ip = {
280281
.complete_fn = t10_pi_type3_complete,
281282
};
282283
EXPORT_SYMBOL(t10_pi_type3_ip);
284+
285+
MODULE_LICENSE("GPL");

‎drivers/nvme/host/Kconfig

+1
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
# SPDX-License-Identifier: GPL-2.0-only
22
config NVME_CORE
33
tristate
4+
select BLK_DEV_INTEGRITY_T10 if BLK_DEV_INTEGRITY
45

56
config BLK_DEV_NVME
67
tristate "NVM Express block device"

‎drivers/scsi/Kconfig

+1
Original file line numberDiff line numberDiff line change
@@ -68,6 +68,7 @@ comment "SCSI support type (disk, tape, CD-ROM)"
6868
config BLK_DEV_SD
6969
tristate "SCSI disk support"
7070
depends on SCSI
71+
select BLK_DEV_INTEGRITY_T10 if BLK_DEV_INTEGRITY
7172
---help---
7273
If you want to use SCSI hard disks, Fibre Channel disks,
7374
Serial ATA (SATA) or Parallel ATA (PATA) hard disks,

0 commit comments

Comments
 (0)
Please sign in to comment.