[PATCH 00/15] Change the integrity configuration method in block

Jinyoung CHOI j-young.choi at samsung.com
Wed May 3 02:49:12 PDT 2023


In the case of NVMe, it has an integrity payload consisting of one segment.
So, rather than configuring SG_LIST, it was changed by direct DMA mapping.

The page-merge is not performed for the struct bio_vec when creating 
a integrity payload in block.
As a result, when creating an integrity paylaod beyond one page, each 
struct bio_vec is generated, and its bv_len does not exceed the PAGESIZE.

To solve it, bio_integrity_add_page() should just add to the existing 
bvec, similar to bio_add_page() and friends. 
As the bip configuration changed, the code related to sg_list was
also modified.

(ref: https://lore.kernel.org/linux-nvme/yq18rewbmay.fsf@ca-mkp.ca.oracle.com/T/#t)


Tested like this:

- Format (support pi)
$ sudo nvme format /dev/nvme2n1 --force -n 1 -i 1 -p 0 -m 0 -l 1 -r

- Run FIO
[global]
ioengine=libaio
group_reporting

[job]
bs=512k
iodepth=256
rw=write
numjobs=8
direct=1
runtime=10s
filename=/dev/nvme2n1

- Result
...
[   93.496218] nvme2n1: I/O Cmd(0x1) @ LBA 62464, 1024 blocks, I/O Error (sct 0x2 / sc 0x82) MORE
[   93.496227] protection error, dev nvme2n1, sector 62464 op 0x1:(WRITE) flags 0x18800 phys_seg 3 prio class 2
[   93.538788] nvme2n1: I/O Cmd(0x1) @ LBA 6144, 1024 blocks, I/O Error (sct 0x2 / sc 0x82) MORE
[   93.538798] protection error, dev nvme2n1, sector 6144 op 0x1:(WRITE) flags 0x18800 phys_seg 3 prio class 2
[   93.566231] nvme2n1: I/O Cmd(0x1) @ LBA 124928, 1024 blocks, I/O Error (sct 0x0 / sc 0x4)
[   93.566241] I/O error, dev nvme2n1, sector 124928 op 0x1:(WRITE) flags 0x18800 phys_seg 3 prio class 2
[   93.694147] nvme2n1: I/O Cmd(0x1) @ LBA 64512, 1024 blocks, I/O Error (sct 0x2 / sc 0x82) MORE
[   93.694155] protection error, dev nvme2n1, sector 64512 op 0x1:(WRITE) flags 0x18800 phys_seg 3 prio class 2
[   93.694299] nvme2n1: I/O Cmd(0x1) @ LBA 5120, 1024 blocks, I/O Error (sct 0x2 / sc 0x82) MORE
[   93.694305] protection error, dev nvme2n1, sector 5120 op 0x1:(WRITE) flags 0x18800 phys_seg 3 prio class 2
...


Jinyoung Choi (15):
  block: bio: rename page_is_mergeable to bio_page_is_mergeable and make
    non-static
  block: blk-integiry: add helper functions for bio_integrity_add_page
  block: bio-integrity: modify bio_integrity_add_page()
  block: bio-integiry: cleanup bio_integrity_prep
  block: fix not to apply bip information in blk_rq_bio_prep()
  block: blk-merge: fix to add the number of integrity segments to the
    request twice
  block: blk-merge: fix merging two requests in ll_merge_requests_fn
  block: add helper function to get the number of integrity segments
  scsi: add scsi_alloc_integrity_sgtables() for integrity process
  scsi: change to use blk_rq_nr_integrity_segments() instead of
    blk_rq_count_integrity_sg()
  block: blk-integrity: change how to find the number of integrity of
    bio
  nvme: rdma: change how to find the number of integrity of request
  block: add helper function for iteration of bip's bvec
  block: blk-integrity: change sg-table configuration method for
    integrity
  block: blk-integrity: remove blk_rq_count_integrity_sg()

 block/bio-integrity.c         | 106 +++++++++++++++++++++------
 block/bio.c                   |   8 +--
 block/blk-integrity.c         | 132 +++++++++-------------------------
 block/blk-merge.c             |  66 +++++++++++++++--
 block/blk.h                   |   7 ++
 drivers/nvme/host/rdma.c      |   2 +-
 drivers/scsi/scsi_lib.c       |  67 ++++++++---------
 include/linux/bio.h           |   7 ++
 include/linux/blk-integrity.h |  10 ++-
 include/linux/blk-mq.h        |   5 ++
 include/linux/bvec.h          |   6 ++
 11 files changed, 251 insertions(+), 165 deletions(-)

-- 
2.34.1



More information about the Linux-nvme mailing list