03 Jul, 2020

1 commit


24 Jun, 2020

1 commit


03 Jun, 2020

1 commit

  • commit e7bf90e5afe3 ("block/bio-integrity: fix a memory leak bug") added
    a kfree() for 'buf' if bio_integrity_add_page() returns '0'. However,
    the object will be freed in bio_integrity_free() since 'bio->bi_opf' and
    'bio->bi_integrity' were set previousy in bio_integrity_alloc().

    Fixes: commit e7bf90e5afe3 ("block/bio-integrity: fix a memory leak bug")
    Signed-off-by: yu kuai
    Reviewed-by: Ming Lei
    Reviewed-by: Bob Liu
    Acked-by: Martin K. Petersen
    Signed-off-by: Jens Axboe

    yu kuai
     

14 May, 2020

1 commit

  • Whenever a device supports blk-integrity, make the kernel pretend that
    the device doesn't support inline encryption (essentially by setting the
    keyslot manager in the request queue to NULL).

    There's no hardware currently that supports both integrity and inline
    encryption. However, it seems possible that there will be such hardware
    in the near future (like the NVMe key per I/O support that might support
    both inline encryption and PI).

    But properly integrating both features is not trivial, and without
    real hardware that implements both, it is difficult to tell if it will
    be done correctly by the majority of hardware that support both.
    So it seems best not to support both features together right now, and
    to decide what to do at probe time.

    Signed-off-by: Satya Tangirala
    Reviewed-by: Eric Biggers
    Reviewed-by: Christoph Hellwig
    Signed-off-by: Jens Axboe

    Satya Tangirala
     

06 Dec, 2019

1 commit

  • 7c20f11680a4 ("bio-integrity: stop abusing bi_end_io") moves
    bio_integrity_free from bio_uninit() to bio_integrity_verify_fn()
    and bio_endio(). This way looks wrong because bio may be freed
    without calling bio_endio(), for example, blk_rq_unprep_clone() is
    called from dm_mq_queue_rq() when the underlying queue of dm-mpath
    is busy.

    So memory leak of bio integrity data is caused by commit 7c20f11680a4.

    Fixes this issue by re-adding bio_integrity_free() to bio_uninit().

    Fixes: 7c20f11680a4 ("bio-integrity: stop abusing bi_end_io")
    Reviewed-by: Christoph Hellwig
    Signed-off-by Justin Tee

    Add commit log, and simplify/fix the original patch wroten by Justin.

    Signed-off-by: Ming Lei
    Signed-off-by: Jens Axboe

    Justin Tee
     

12 Jul, 2019

1 commit

  • In bio_integrity_prep(), a kernel buffer is allocated through kmalloc() to
    hold integrity metadata. Later on, the buffer will be attached to the bio
    structure through bio_integrity_add_page(), which returns the number of
    bytes of integrity metadata attached. Due to unexpected situations,
    bio_integrity_add_page() may return 0. As a result, bio_integrity_prep()
    needs to be terminated with 'false' returned to indicate this error.
    However, the allocated kernel buffer is not freed on this execution path,
    leading to a memory leak.

    To fix this issue, free the allocated buffer before returning from
    bio_integrity_prep().

    Reviewed-by: Ming Lei
    Acked-by: Martin K. Petersen
    Signed-off-by: Wenwen Wang
    Signed-off-by: Jens Axboe

    Wenwen Wang
     

16 May, 2019

1 commit


01 May, 2019

1 commit


16 Dec, 2018

2 commits


07 Sep, 2018

1 commit

  • It is pointed that bio_rewind_iter() is one very bad API[1]:

    1) bio size may not be restored after rewinding

    2) it causes some bogus change, such as 5151842b9d8732 (block: reset
    bi_iter.bi_done after splitting bio)

    3) rewinding really makes things complicated wrt. bio splitting

    4) unnecessary updating of .bi_done in fast path

    [1] https://marc.info/?t=153549924200005&r=1&w=2

    So this patch takes Kent's suggestion to restore one bio into its original
    state via saving bio iterator(struct bvec_iter) in bio_integrity_prep(),
    given now bio_rewind_iter() is only used by bio integrity code.

    Cc: Dmitry Monakhov
    Cc: Hannes Reinecke
    Suggested-by: Kent Overstreet
    Acked-by: Kent Overstreet
    Reviewed-by: Christoph Hellwig
    Signed-off-by: Ming Lei
    Signed-off-by: Jens Axboe

    Ming Lei
     

27 Jul, 2018

1 commit


15 May, 2018

1 commit


18 Jan, 2018

1 commit


07 Oct, 2017

1 commit

  • mempool_destroy() already checks for a NULL value being passed in, this
    eliminates duplicate checks.

    This was caught by running make coccicheck M=block/ on linus' tree on
    commit 77ede3a014a32746002f7889211f0cecf4803163 (current head as of this
    patch).

    Reviewed-by: Kyle Fortin
    Acked-by: Martin K. Petersen
    Signed-off-by: Tim Hansen
    Signed-off-by: Jens Axboe

    Tim Hansen
     

08 Sep, 2017

1 commit

  • Pull block layer updates from Jens Axboe:
    "This is the first pull request for 4.14, containing most of the code
    changes. It's a quiet series this round, which I think we needed after
    the churn of the last few series. This contains:

    - Fix for a registration race in loop, from Anton Volkov.

    - Overflow complaint fix from Arnd for DAC960.

    - Series of drbd changes from the usual suspects.

    - Conversion of the stec/skd driver to blk-mq. From Bart.

    - A few BFQ improvements/fixes from Paolo.

    - CFQ improvement from Ritesh, allowing idling for group idle.

    - A few fixes found by Dan's smatch, courtesy of Dan.

    - A warning fixup for a race between changing the IO scheduler and
    device remova. From David Jeffery.

    - A few nbd fixes from Josef.

    - Support for cgroup info in blktrace, from Shaohua.

    - Also from Shaohua, new features in the null_blk driver to allow it
    to actually hold data, among other things.

    - Various corner cases and error handling fixes from Weiping Zhang.

    - Improvements to the IO stats tracking for blk-mq from me. Can
    drastically improve performance for fast devices and/or big
    machines.

    - Series from Christoph removing bi_bdev as being needed for IO
    submission, in preparation for nvme multipathing code.

    - Series from Bart, including various cleanups and fixes for switch
    fall through case complaints"

    * 'for-4.14/block' of git://git.kernel.dk/linux-block: (162 commits)
    kernfs: checking for IS_ERR() instead of NULL
    drbd: remove BIOSET_NEED_RESCUER flag from drbd_{md_,}io_bio_set
    drbd: Fix allyesconfig build, fix recent commit
    drbd: switch from kmalloc() to kmalloc_array()
    drbd: abort drbd_start_resync if there is no connection
    drbd: move global variables to drbd namespace and make some static
    drbd: rename "usermode_helper" to "drbd_usermode_helper"
    drbd: fix race between handshake and admin disconnect/down
    drbd: fix potential deadlock when trying to detach during handshake
    drbd: A single dot should be put into a sequence.
    drbd: fix rmmod cleanup, remove _all_ debugfs entries
    drbd: Use setup_timer() instead of init_timer() to simplify the code.
    drbd: fix potential get_ldev/put_ldev refcount imbalance during attach
    drbd: new disk-option disable-write-same
    drbd: Fix resource role for newly created resources in events2
    drbd: mark symbols static where possible
    drbd: Send P_NEG_ACK upon write error in protocol != C
    drbd: add explicit plugging when submitting batches
    drbd: change list_for_each_safe to while(list_first_entry_or_null)
    drbd: introduce drbd_recv_header_maybe_unplug
    ...

    Linus Torvalds
     

24 Aug, 2017

2 commits

  • In dm-integrity target we register integrity profile that have
    both generate_fn and verify_fn callbacks set to NULL.

    This is used if dm-integrity is stacked under a dm-crypt device
    for authenticated encryption (integrity payload contains authentication
    tag and IV seed).

    In this case the verification is done through own crypto API
    processing inside dm-crypt; integrity profile is only holder
    of these data. (And memory is owned by dm-crypt as well.)

    After the commit (and previous changes)
    Commit 7c20f11680a441df09de7235206f70115fbf6290
    Author: Christoph Hellwig
    Date: Mon Jul 3 16:58:43 2017 -0600

    bio-integrity: stop abusing bi_end_io

    we get this crash:

    : BUG: unable to handle kernel NULL pointer dereference at (null)
    : IP: (null)
    : *pde = 00000000
    ...
    :
    : Workqueue: kintegrityd bio_integrity_verify_fn
    : task: f48ae180 task.stack: f4b5c000
    : EIP: (null)
    : EFLAGS: 00210286 CPU: 0
    : EAX: f4b5debc EBX: 00001000 ECX: 00000001 EDX: 00000000
    : ESI: 00001000 EDI: ed25f000 EBP: f4b5dee8 ESP: f4b5dea4
    : DS: 007b ES: 007b FS: 00d8 GS: 00e0 SS: 0068
    : CR0: 80050033 CR2: 00000000 CR3: 32823000 CR4: 001406d0
    : Call Trace:
    : ? bio_integrity_process+0xe3/0x1e0
    : bio_integrity_verify_fn+0xea/0x150
    : process_one_work+0x1c7/0x5c0
    : worker_thread+0x39/0x380
    : kthread+0xd6/0x110
    : ? process_one_work+0x5c0/0x5c0
    : ? kthread_worker_fn+0x100/0x100
    : ? kthread_worker_fn+0x100/0x100
    : ret_from_fork+0x19/0x24
    : Code: Bad EIP value.
    : EIP: (null) SS:ESP: 0068:f4b5dea4
    : CR2: 0000000000000000

    Patch just skip the whole verify workqueue if verify_fn is set to NULL.

    Fixes: 7c20f116 ("bio-integrity: stop abusing bi_end_io")
    Signed-off-by: Milan Broz
    [hch: trivial whitespace fix]
    Signed-off-by: Christoph Hellwig
    Signed-off-by: Jens Axboe

    Milan Broz
     
  • This way we don't need a block_device structure to submit I/O. The
    block_device has different life time rules from the gendisk and
    request_queue and is usually only available when the block device node
    is open. Other callers need to explicitly create one (e.g. the lightnvm
    passthrough code, or the new nvme multipathing code).

    For the actual I/O path all that we need is the gendisk, which exists
    once per block device. But given that the block layer also does
    partition remapping we additionally need a partition index, which is
    used for said remapping in generic_make_request.

    Note that all the block drivers generally want request_queue or
    sometimes the gendisk, so this removes a layer of indirection all
    over the stack.

    Signed-off-by: Christoph Hellwig
    Signed-off-by: Jens Axboe

    Christoph Hellwig
     

10 Aug, 2017

3 commits

  • This gets us back to the behavior in 4.12 and earlier.

    Signed-off-by: Christoph Hellwig
    Fixes: 7c20f116 ("bio-integrity: stop abusing bi_end_io")
    Signed-off-by: Jens Axboe

    Christoph Hellwig
     
  • In dm-integrity target we register integrity profile that have
    both generate_fn and verify_fn callbacks set to NULL.

    This is used if dm-integrity is stacked under a dm-crypt device
    for authenticated encryption (integrity payload contains authentication
    tag and IV seed).

    In this case the verification is done through own crypto API
    processing inside dm-crypt; integrity profile is only holder
    of these data. (And memory is owned by dm-crypt as well.)

    After the commit (and previous changes)
    Commit 7c20f11680a441df09de7235206f70115fbf6290
    Author: Christoph Hellwig
    Date: Mon Jul 3 16:58:43 2017 -0600

    bio-integrity: stop abusing bi_end_io

    we get this crash:

    : BUG: unable to handle kernel NULL pointer dereference at (null)
    : IP: (null)
    : *pde = 00000000
    ...
    :
    : Workqueue: kintegrityd bio_integrity_verify_fn
    : task: f48ae180 task.stack: f4b5c000
    : EIP: (null)
    : EFLAGS: 00210286 CPU: 0
    : EAX: f4b5debc EBX: 00001000 ECX: 00000001 EDX: 00000000
    : ESI: 00001000 EDI: ed25f000 EBP: f4b5dee8 ESP: f4b5dea4
    : DS: 007b ES: 007b FS: 00d8 GS: 00e0 SS: 0068
    : CR0: 80050033 CR2: 00000000 CR3: 32823000 CR4: 001406d0
    : Call Trace:
    : ? bio_integrity_process+0xe3/0x1e0
    : bio_integrity_verify_fn+0xea/0x150
    : process_one_work+0x1c7/0x5c0
    : worker_thread+0x39/0x380
    : kthread+0xd6/0x110
    : ? process_one_work+0x5c0/0x5c0
    : ? kthread_worker_fn+0x100/0x100
    : ? kthread_worker_fn+0x100/0x100
    : ret_from_fork+0x19/0x24
    : Code: Bad EIP value.
    : EIP: (null) SS:ESP: 0068:f4b5dea4
    : CR2: 0000000000000000

    Patch just skip the whole verify workqueue if verify_fn is set to NULL.

    Fixes: 7c20f116 ("bio-integrity: stop abusing bi_end_io")
    Signed-off-by: Milan Broz
    [hch: trivial whitespace fix]
    Signed-off-by: Christoph Hellwig
    Signed-off-by: Jens Axboe

    Milan Broz
     
  • This makes the code more obvious, and moves the most likely branch first
    in the function.

    Signed-off-by: Christoph Hellwig
    Signed-off-by: Jens Axboe

    Christoph Hellwig
     

05 Jul, 2017

1 commit

  • block/bio-integrity.c:318:10-11: WARNING: return of 0/1 in function 'bio_integrity_prep' with return type bool

    Return statements in functions returning bool should use
    true/false instead of 1/0.
    Generated by: scripts/coccinelle/misc/boolreturn.cocci

    Fixes: e23947bd76f0 ("bio-integrity: fold bio_integrity_enabled to bio_integrity_prep")
    CC: Dmitry Monakhov
    Signed-off-by: Fengguang Wu
    Signed-off-by: Jens Axboe

    kbuild test robot
     

04 Jul, 2017

5 commits

  • And instead call directly into the integrity code from bio_end_io.

    Signed-off-by: Christoph Hellwig
    Signed-off-by: Jens Axboe

    Christoph Hellwig
     
  • Currently ->verify_fn not woks at all because at the moment it is called
    bio->bi_iter.bi_size == 0, so we do not iterate integrity bvecs at all.

    In order to perform verification we need to know original data vector,
    with new bvec rewind API this is trivial.

    testcase: https://github.com/dmonakhov/xfstests/commit/3c6509eaa83b9c17cd0bc95d73fcdd76e1c54a85

    Reviewed-by: Hannes Reinecke
    Reviewed-by: Christoph Hellwig
    Signed-off-by: Dmitry Monakhov
    [hch: adopted for new status values]
    Signed-off-by: Christoph Hellwig
    Signed-off-by: Jens Axboe

    Dmitry Monakhov
     
  • Currently all integrity prep hooks are open-coded, and if prepare fails
    we ignore it's code and fail bio with EIO. Let's return real error to
    upper layer, so later caller may react accordingly.

    In fact no one want to use bio_integrity_prep() w/o bio_integrity_enabled,
    so it is reasonable to fold it in to one function.

    Signed-off-by: Dmitry Monakhov
    Reviewed-by: Martin K. Petersen
    [hch: merged with the latest block tree,
    return bool from bio_integrity_prep]
    Signed-off-by: Christoph Hellwig
    Signed-off-by: Jens Axboe

    Dmitry Monakhov
     
  • bio_integrity_trim inherent it's interface from bio_trim and accept
    offset and size, but this API is error prone because data offset
    must always be insync with bio's data offset. That is why we have
    integrity update hook in bio_advance()

    So only meaningful values are: offset == 0, sectors == bio_sectors(bio)
    Let's just remove them completely.

    Reviewed-by: Hannes Reinecke
    Reviewed-by: Christoph Hellwig
    Reviewed-by: Martin K. Petersen
    Signed-off-by: Dmitry Monakhov
    Signed-off-by: Christoph Hellwig
    Signed-off-by: Jens Axboe

    Dmitry Monakhov
     
  • SCSI drivers do care about bip_seed so we must update it accordingly.

    Reviewed-by: Hannes Reinecke
    Reviewed-by: Christoph Hellwig
    Reviewed-by: Martin K. Petersen
    Signed-off-by: Dmitry Monakhov
    Signed-off-by: Christoph Hellwig
    Signed-off-by: Jens Axboe

    Dmitry Monakhov
     

12 Jun, 2017

1 commit

  • We've already got a few conflicts and upcoming work depends on some of the
    changes that have gone into mainline as regression fixes for this series.

    Pull in 4.12-rc5 to resolve these conflicts and make it easier on down stream
    trees to continue working on 4.13 changes.

    Signed-off-by: Jens Axboe

    Jens Axboe
     

09 Jun, 2017

1 commit

  • Replace bi_error with a new bi_status to allow for a clear conversion.
    Note that device mapper overloaded bi_error with a private value, which
    we'll have to keep arround at least for now and thus propagate to a
    proper blk_status_t value.

    Signed-off-by: Christoph Hellwig
    Signed-off-by: Jens Axboe

    Christoph Hellwig
     

03 Jun, 2017

1 commit

  • If bio has no data, such as ones from blkdev_issue_flush(),
    then we have nothing to protect.

    This patch prevent bugon like follows:

    kfree_debugcheck: out of range ptr ac1fa1d106742a5ah
    kernel BUG at mm/slab.c:2773!
    invalid opcode: 0000 [#1] SMP
    Modules linked in: bcache
    CPU: 0 PID: 4428 Comm: xfs_io Tainted: G W 4.11.0-rc4-ext4-00041-g2ef0043-dirty #43
    Hardware name: Virtuozzo KVM, BIOS seabios-1.7.5-11.vz7.4 04/01/2014
    task: ffff880137786440 task.stack: ffffc90000ba8000
    RIP: 0010:kfree_debugcheck+0x25/0x2a
    RSP: 0018:ffffc90000babde0 EFLAGS: 00010082
    RAX: 0000000000000034 RBX: ac1fa1d106742a5a RCX: 0000000000000007
    RDX: 0000000000000000 RSI: 0000000000000000 RDI: ffff88013f3ccb40
    RBP: ffffc90000babde8 R08: 0000000000000000 R09: 0000000000000000
    R10: 00000000fcb76420 R11: 00000000725172ed R12: 0000000000000282
    R13: ffffffff8150e766 R14: ffff88013a145e00 R15: 0000000000000001
    FS: 00007fb09384bf40(0000) GS:ffff88013f200000(0000) knlGS:0000000000000000
    CS: 0010 DS: 0000 ES: 0000 CR0: 0000000080050033
    CR2: 00007fd0172f9e40 CR3: 0000000137fa9000 CR4: 00000000000006f0
    Call Trace:
    kfree+0xc8/0x1b3
    bio_integrity_free+0xc3/0x16b
    bio_free+0x25/0x66
    bio_put+0x14/0x26
    blkdev_issue_flush+0x7a/0x85
    blkdev_fsync+0x35/0x42
    vfs_fsync_range+0x8e/0x9f
    vfs_fsync+0x1c/0x1e
    do_fsync+0x31/0x4a
    SyS_fsync+0x10/0x14
    entry_SYSCALL_64_fastpath+0x1f/0xc2

    Reviewed-by: Christoph Hellwig
    Reviewed-by: Hannes Reinecke
    Reviewed-by: Martin K. Petersen
    Signed-off-by: Dmitry Monakhov
    Signed-off-by: Jens Axboe

    Dmitry Monakhov
     

28 Oct, 2016

1 commit

  • With the addition of the zoned operations the tests in this function
    became incorrect. But I think it's much better to just open code the
    allow operations in the only caller anyway.

    Signed-off-by: Christoph Hellwig
    Reviewed-by: Shaun Tancheff
    Signed-off-by: Jens Axboe

    Christoph Hellwig
     

08 Aug, 2016

1 commit

  • Since commit 63a4cc24867d, bio->bi_rw contains flags in the lower
    portion and the op code in the higher portions. This means that
    old code that relies on manually setting bi_rw is most likely
    going to be broken. Instead of letting that brokeness linger,
    rename the member, to force old and out-of-tree code to break
    at compile time instead of at runtime.

    No intended functional changes in this commit.

    Signed-off-by: Jens Axboe

    Jens Axboe
     

27 Jul, 2016

1 commit

  • Pull block driver updates from Jens Axboe:
    "This branch also contains core changes. I've come to the conclusion
    that from 4.9 and forward, I'll be doing just a single branch. We
    often have dependencies between core and drivers, and it's hard to
    always split them up appropriately without pulling core into drivers
    when that happens.

    That said, this contains:

    - separate secure erase type for the core block layer, from
    Christoph.

    - set of discard fixes, from Christoph.

    - bio shrinking fixes from Christoph, as a followup up to the
    op/flags change in the core branch.

    - map and append request fixes from Christoph.

    - NVMeF (NVMe over Fabrics) code from Christoph. This is pretty
    exciting!

    - nvme-loop fixes from Arnd.

    - removal of ->driverfs_dev from Dan, after providing a
    device_add_disk() helper.

    - bcache fixes from Bhaktipriya and Yijing.

    - cdrom subchannel read fix from Vchannaiah.

    - set of lightnvm updates from Wenwei, Matias, Johannes, and Javier.

    - set of drbd updates and fixes from Fabian, Lars, and Philipp.

    - mg_disk error path fix from Bart.

    - user notification for failed device add for loop, from Minfei.

    - NVMe in general:
    + NVMe delay quirk from Guilherme.
    + SR-IOV support and command retry limits from Keith.
    + fix for memory-less NUMA node from Masayoshi.
    + use UINT_MAX for discard sectors, from Minfei.
    + cancel IO fixes from Ming.
    + don't allocate unused major, from Neil.
    + error code fixup from Dan.
    + use constants for PSDT/FUSE from James.
    + variable init fix from Jay.
    + fabrics fixes from Ming, Sagi, and Wei.
    + various fixes"

    * 'for-4.8/drivers' of git://git.kernel.dk/linux-block: (115 commits)
    nvme/pci: Provide SR-IOV support
    nvme: initialize variable before logical OR'ing it
    block: unexport various bio mapping helpers
    scsi/osd: open code blk_make_request
    target: stop using blk_make_request
    block: simplify and export blk_rq_append_bio
    block: ensure bios return from blk_get_request are properly initialized
    virtio_blk: use blk_rq_map_kern
    memstick: don't allow REQ_TYPE_BLOCK_PC requests
    block: shrink bio size again
    block: simplify and cleanup bvec pool handling
    block: get rid of bio_rw and READA
    block: don't ignore -EOPNOTSUPP blkdev_issue_write_same
    block: introduce BLKDEV_DISCARD_ZERO to fix zeroout
    NVMe: don't allocate unused nvme_major
    nvme: avoid crashes when node 0 is memoryless node.
    nvme: Limit command retries
    loop: Make user notify for adding loop device failed
    nvme-loop: fix nvme-loop Kconfig dependencies
    nvmet: fix return value check in nvmet_subsys_alloc()
    ...

    Linus Torvalds
     

21 Jul, 2016

1 commit

  • Instead of a flag and an index just make sure an index of 0 means
    no need to free the bvec array. Also move the constants related
    to the bvec pools together and use a consistent naming scheme for
    them.

    Signed-off-by: Christoph Hellwig
    Reviewed-by: Johannes Thumshirn
    Reviewed-by: Mike Christie
    Signed-off-by: Jens Axboe

    Christoph Hellwig
     

14 Jun, 2016

1 commit


09 Dec, 2015

1 commit


04 Dec, 2015

1 commit

  • This patch moves the blk_integrity_payload definition outside the
    CONFIG_BLK_DEV_INTERITY dependency and provides empty function
    implementations when the kernel configuration disables integrity
    extensions. This simplifies drivers that make use of these to map user
    data so they don't need to repeat the same configuration checks.

    Signed-off-by: Keith Busch

    Updated by Jens to pass an error pointer return from
    bio_integrity_alloc(), otherwise if CONFIG_BLK_DEV_INTEGRITY isn't
    set, we return a weird ENOMEM from __nvme_submit_user_cmd()
    if a meta buffer is set.

    Signed-off-by: Jens Axboe

    Keith Busch
     

22 Oct, 2015

3 commits

  • Since they lack requests to pin the request_queue active, synchronous
    bio-based drivers may have in-flight integrity work from
    bio_integrity_endio() that is not flushed by blk_freeze_queue(). Flush
    that work to prevent races to free the queue and the final usage of the
    blk_integrity profile.

    This is temporary unless/until bio-based drivers start to generically
    take a q_usage_counter reference while a bio is in-flight.

    Cc: Martin K. Petersen
    [martin: fix the CONFIG_BLK_DEV_INTEGRITY=n case]
    Tested-by: Ross Zwisler
    Signed-off-by: Dan Williams
    Signed-off-by: Jens Axboe

    Dan Williams
     
  • The per-device properties in the blk_integrity structure were previously
    unsigned short. However, most of the values fit inside a char. The only
    exception is the data interval size and we can work around that by
    storing it as a power of two.

    This cuts the size of the dynamic portion of blk_integrity in half.

    Signed-off-by: Martin K. Petersen
    Reported-by: Christoph Hellwig
    Reviewed-by: Sagi Grimberg
    Signed-off-by: Dan Williams
    Signed-off-by: Jens Axboe

    Martin K. Petersen
     
  • We previously made a complete copy of a device's data integrity profile
    even though several of the fields inside the blk_integrity struct are
    pointers to fixed template entries in t10-pi.c.

    Split the static and per-device portions so that we can reference the
    template directly.

    Signed-off-by: Martin K. Petersen
    Reported-by: Christoph Hellwig
    Reviewed-by: Sagi Grimberg
    Cc: Dan Williams
    Signed-off-by: Dan Williams
    Signed-off-by: Jens Axboe

    Martin K. Petersen