^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1) // SPDX-License-Identifier: GPL-2.0
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 2) /*
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 3) * blk-integrity.c - Block layer data integrity extensions
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 4) *
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 5) * Copyright (C) 2007, 2008 Oracle Corporation
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 6) * Written by: Martin K. Petersen <martin.petersen@oracle.com>
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 7) */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 8)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 9) #include <linux/blkdev.h>
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 10) #include <linux/backing-dev.h>
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 11) #include <linux/mempool.h>
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 12) #include <linux/bio.h>
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 13) #include <linux/scatterlist.h>
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 14) #include <linux/export.h>
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 15) #include <linux/slab.h>
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 16)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 17) #include "blk.h"
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 18)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 19) /**
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 20) * blk_rq_count_integrity_sg - Count number of integrity scatterlist elements
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 21) * @q: request queue
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 22) * @bio: bio with integrity metadata attached
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 23) *
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 24) * Description: Returns the number of elements required in a
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 25) * scatterlist corresponding to the integrity metadata in a bio.
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 26) */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 27) int blk_rq_count_integrity_sg(struct request_queue *q, struct bio *bio)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 28) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 29) struct bio_vec iv, ivprv = { NULL };
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 30) unsigned int segments = 0;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 31) unsigned int seg_size = 0;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 32) struct bvec_iter iter;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 33) int prev = 0;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 34)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 35) bio_for_each_integrity_vec(iv, bio, iter) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 36)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 37) if (prev) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 38) if (!biovec_phys_mergeable(q, &ivprv, &iv))
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 39) goto new_segment;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 40) if (seg_size + iv.bv_len > queue_max_segment_size(q))
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 41) goto new_segment;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 42)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 43) seg_size += iv.bv_len;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 44) } else {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 45) new_segment:
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 46) segments++;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 47) seg_size = iv.bv_len;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 48) }
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 49)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 50) prev = 1;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 51) ivprv = iv;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 52) }
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 53)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 54) return segments;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 55) }
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 56) EXPORT_SYMBOL(blk_rq_count_integrity_sg);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 57)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 58) /**
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 59) * blk_rq_map_integrity_sg - Map integrity metadata into a scatterlist
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 60) * @q: request queue
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 61) * @bio: bio with integrity metadata attached
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 62) * @sglist: target scatterlist
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 63) *
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 64) * Description: Map the integrity vectors in request into a
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 65) * scatterlist. The scatterlist must be big enough to hold all
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 66) * elements. I.e. sized using blk_rq_count_integrity_sg().
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 67) */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 68) int blk_rq_map_integrity_sg(struct request_queue *q, struct bio *bio,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 69) struct scatterlist *sglist)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 70) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 71) struct bio_vec iv, ivprv = { NULL };
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 72) struct scatterlist *sg = NULL;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 73) unsigned int segments = 0;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 74) struct bvec_iter iter;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 75) int prev = 0;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 76)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 77) bio_for_each_integrity_vec(iv, bio, iter) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 78)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 79) if (prev) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 80) if (!biovec_phys_mergeable(q, &ivprv, &iv))
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 81) goto new_segment;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 82) if (sg->length + iv.bv_len > queue_max_segment_size(q))
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 83) goto new_segment;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 84)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 85) sg->length += iv.bv_len;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 86) } else {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 87) new_segment:
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 88) if (!sg)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 89) sg = sglist;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 90) else {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 91) sg_unmark_end(sg);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 92) sg = sg_next(sg);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 93) }
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 94)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 95) sg_set_page(sg, iv.bv_page, iv.bv_len, iv.bv_offset);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 96) segments++;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 97) }
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 98)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 99) prev = 1;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 100) ivprv = iv;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 101) }
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 102)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 103) if (sg)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 104) sg_mark_end(sg);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 105)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 106) return segments;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 107) }
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 108) EXPORT_SYMBOL(blk_rq_map_integrity_sg);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 109)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 110) /**
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 111) * blk_integrity_compare - Compare integrity profile of two disks
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 112) * @gd1: Disk to compare
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 113) * @gd2: Disk to compare
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 114) *
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 115) * Description: Meta-devices like DM and MD need to verify that all
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 116) * sub-devices use the same integrity format before advertising to
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 117) * upper layers that they can send/receive integrity metadata. This
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 118) * function can be used to check whether two gendisk devices have
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 119) * compatible integrity formats.
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 120) */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 121) int blk_integrity_compare(struct gendisk *gd1, struct gendisk *gd2)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 122) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 123) struct blk_integrity *b1 = &gd1->queue->integrity;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 124) struct blk_integrity *b2 = &gd2->queue->integrity;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 125)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 126) if (!b1->profile && !b2->profile)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 127) return 0;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 128)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 129) if (!b1->profile || !b2->profile)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 130) return -1;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 131)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 132) if (b1->interval_exp != b2->interval_exp) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 133) pr_err("%s: %s/%s protection interval %u != %u\n",
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 134) __func__, gd1->disk_name, gd2->disk_name,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 135) 1 << b1->interval_exp, 1 << b2->interval_exp);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 136) return -1;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 137) }
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 138)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 139) if (b1->tuple_size != b2->tuple_size) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 140) pr_err("%s: %s/%s tuple sz %u != %u\n", __func__,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 141) gd1->disk_name, gd2->disk_name,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 142) b1->tuple_size, b2->tuple_size);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 143) return -1;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 144) }
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 145)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 146) if (b1->tag_size && b2->tag_size && (b1->tag_size != b2->tag_size)) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 147) pr_err("%s: %s/%s tag sz %u != %u\n", __func__,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 148) gd1->disk_name, gd2->disk_name,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 149) b1->tag_size, b2->tag_size);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 150) return -1;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 151) }
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 152)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 153) if (b1->profile != b2->profile) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 154) pr_err("%s: %s/%s type %s != %s\n", __func__,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 155) gd1->disk_name, gd2->disk_name,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 156) b1->profile->name, b2->profile->name);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 157) return -1;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 158) }
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 159)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 160) return 0;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 161) }
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 162) EXPORT_SYMBOL(blk_integrity_compare);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 163)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 164) bool blk_integrity_merge_rq(struct request_queue *q, struct request *req,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 165) struct request *next)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 166) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 167) if (blk_integrity_rq(req) == 0 && blk_integrity_rq(next) == 0)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 168) return true;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 169)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 170) if (blk_integrity_rq(req) == 0 || blk_integrity_rq(next) == 0)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 171) return false;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 172)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 173) if (bio_integrity(req->bio)->bip_flags !=
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 174) bio_integrity(next->bio)->bip_flags)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 175) return false;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 176)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 177) if (req->nr_integrity_segments + next->nr_integrity_segments >
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 178) q->limits.max_integrity_segments)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 179) return false;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 180)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 181) if (integrity_req_gap_back_merge(req, next->bio))
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 182) return false;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 183)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 184) return true;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 185) }
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 186)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 187) bool blk_integrity_merge_bio(struct request_queue *q, struct request *req,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 188) struct bio *bio)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 189) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 190) int nr_integrity_segs;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 191) struct bio *next = bio->bi_next;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 192)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 193) if (blk_integrity_rq(req) == 0 && bio_integrity(bio) == NULL)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 194) return true;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 195)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 196) if (blk_integrity_rq(req) == 0 || bio_integrity(bio) == NULL)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 197) return false;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 198)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 199) if (bio_integrity(req->bio)->bip_flags != bio_integrity(bio)->bip_flags)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 200) return false;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 201)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 202) bio->bi_next = NULL;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 203) nr_integrity_segs = blk_rq_count_integrity_sg(q, bio);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 204) bio->bi_next = next;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 205)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 206) if (req->nr_integrity_segments + nr_integrity_segs >
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 207) q->limits.max_integrity_segments)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 208) return false;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 209)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 210) req->nr_integrity_segments += nr_integrity_segs;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 211)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 212) return true;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 213) }
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 214)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 215) struct integrity_sysfs_entry {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 216) struct attribute attr;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 217) ssize_t (*show)(struct blk_integrity *, char *);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 218) ssize_t (*store)(struct blk_integrity *, const char *, size_t);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 219) };
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 220)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 221) static ssize_t integrity_attr_show(struct kobject *kobj, struct attribute *attr,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 222) char *page)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 223) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 224) struct gendisk *disk = container_of(kobj, struct gendisk, integrity_kobj);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 225) struct blk_integrity *bi = &disk->queue->integrity;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 226) struct integrity_sysfs_entry *entry =
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 227) container_of(attr, struct integrity_sysfs_entry, attr);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 228)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 229) return entry->show(bi, page);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 230) }
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 231)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 232) static ssize_t integrity_attr_store(struct kobject *kobj,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 233) struct attribute *attr, const char *page,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 234) size_t count)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 235) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 236) struct gendisk *disk = container_of(kobj, struct gendisk, integrity_kobj);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 237) struct blk_integrity *bi = &disk->queue->integrity;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 238) struct integrity_sysfs_entry *entry =
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 239) container_of(attr, struct integrity_sysfs_entry, attr);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 240) ssize_t ret = 0;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 241)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 242) if (entry->store)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 243) ret = entry->store(bi, page, count);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 244)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 245) return ret;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 246) }
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 247)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 248) static ssize_t integrity_format_show(struct blk_integrity *bi, char *page)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 249) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 250) if (bi->profile && bi->profile->name)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 251) return sprintf(page, "%s\n", bi->profile->name);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 252) else
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 253) return sprintf(page, "none\n");
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 254) }
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 255)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 256) static ssize_t integrity_tag_size_show(struct blk_integrity *bi, char *page)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 257) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 258) return sprintf(page, "%u\n", bi->tag_size);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 259) }
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 260)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 261) static ssize_t integrity_interval_show(struct blk_integrity *bi, char *page)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 262) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 263) return sprintf(page, "%u\n",
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 264) bi->interval_exp ? 1 << bi->interval_exp : 0);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 265) }
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 266)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 267) static ssize_t integrity_verify_store(struct blk_integrity *bi,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 268) const char *page, size_t count)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 269) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 270) char *p = (char *) page;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 271) unsigned long val = simple_strtoul(p, &p, 10);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 272)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 273) if (val)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 274) bi->flags |= BLK_INTEGRITY_VERIFY;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 275) else
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 276) bi->flags &= ~BLK_INTEGRITY_VERIFY;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 277)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 278) return count;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 279) }
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 280)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 281) static ssize_t integrity_verify_show(struct blk_integrity *bi, char *page)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 282) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 283) return sprintf(page, "%d\n", (bi->flags & BLK_INTEGRITY_VERIFY) != 0);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 284) }
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 285)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 286) static ssize_t integrity_generate_store(struct blk_integrity *bi,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 287) const char *page, size_t count)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 288) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 289) char *p = (char *) page;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 290) unsigned long val = simple_strtoul(p, &p, 10);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 291)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 292) if (val)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 293) bi->flags |= BLK_INTEGRITY_GENERATE;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 294) else
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 295) bi->flags &= ~BLK_INTEGRITY_GENERATE;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 296)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 297) return count;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 298) }
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 299)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 300) static ssize_t integrity_generate_show(struct blk_integrity *bi, char *page)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 301) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 302) return sprintf(page, "%d\n", (bi->flags & BLK_INTEGRITY_GENERATE) != 0);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 303) }
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 304)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 305) static ssize_t integrity_device_show(struct blk_integrity *bi, char *page)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 306) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 307) return sprintf(page, "%u\n",
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 308) (bi->flags & BLK_INTEGRITY_DEVICE_CAPABLE) != 0);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 309) }
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 310)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 311) static struct integrity_sysfs_entry integrity_format_entry = {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 312) .attr = { .name = "format", .mode = 0444 },
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 313) .show = integrity_format_show,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 314) };
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 315)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 316) static struct integrity_sysfs_entry integrity_tag_size_entry = {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 317) .attr = { .name = "tag_size", .mode = 0444 },
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 318) .show = integrity_tag_size_show,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 319) };
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 320)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 321) static struct integrity_sysfs_entry integrity_interval_entry = {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 322) .attr = { .name = "protection_interval_bytes", .mode = 0444 },
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 323) .show = integrity_interval_show,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 324) };
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 325)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 326) static struct integrity_sysfs_entry integrity_verify_entry = {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 327) .attr = { .name = "read_verify", .mode = 0644 },
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 328) .show = integrity_verify_show,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 329) .store = integrity_verify_store,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 330) };
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 331)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 332) static struct integrity_sysfs_entry integrity_generate_entry = {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 333) .attr = { .name = "write_generate", .mode = 0644 },
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 334) .show = integrity_generate_show,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 335) .store = integrity_generate_store,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 336) };
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 337)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 338) static struct integrity_sysfs_entry integrity_device_entry = {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 339) .attr = { .name = "device_is_integrity_capable", .mode = 0444 },
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 340) .show = integrity_device_show,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 341) };
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 342)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 343) static struct attribute *integrity_attrs[] = {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 344) &integrity_format_entry.attr,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 345) &integrity_tag_size_entry.attr,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 346) &integrity_interval_entry.attr,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 347) &integrity_verify_entry.attr,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 348) &integrity_generate_entry.attr,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 349) &integrity_device_entry.attr,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 350) NULL,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 351) };
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 352) ATTRIBUTE_GROUPS(integrity);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 353)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 354) static const struct sysfs_ops integrity_ops = {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 355) .show = &integrity_attr_show,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 356) .store = &integrity_attr_store,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 357) };
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 358)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 359) static struct kobj_type integrity_ktype = {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 360) .default_groups = integrity_groups,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 361) .sysfs_ops = &integrity_ops,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 362) };
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 363)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 364) static blk_status_t blk_integrity_nop_fn(struct blk_integrity_iter *iter)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 365) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 366) return BLK_STS_OK;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 367) }
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 368)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 369) static void blk_integrity_nop_prepare(struct request *rq)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 370) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 371) }
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 372)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 373) static void blk_integrity_nop_complete(struct request *rq,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 374) unsigned int nr_bytes)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 375) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 376) }
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 377)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 378) static const struct blk_integrity_profile nop_profile = {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 379) .name = "nop",
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 380) .generate_fn = blk_integrity_nop_fn,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 381) .verify_fn = blk_integrity_nop_fn,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 382) .prepare_fn = blk_integrity_nop_prepare,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 383) .complete_fn = blk_integrity_nop_complete,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 384) };
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 385)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 386) /**
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 387) * blk_integrity_register - Register a gendisk as being integrity-capable
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 388) * @disk: struct gendisk pointer to make integrity-aware
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 389) * @template: block integrity profile to register
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 390) *
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 391) * Description: When a device needs to advertise itself as being able to
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 392) * send/receive integrity metadata it must use this function to register
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 393) * the capability with the block layer. The template is a blk_integrity
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 394) * struct with values appropriate for the underlying hardware. See
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 395) * Documentation/block/data-integrity.rst.
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 396) */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 397) void blk_integrity_register(struct gendisk *disk, struct blk_integrity *template)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 398) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 399) struct blk_integrity *bi = &disk->queue->integrity;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 400)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 401) bi->flags = BLK_INTEGRITY_VERIFY | BLK_INTEGRITY_GENERATE |
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 402) template->flags;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 403) bi->interval_exp = template->interval_exp ? :
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 404) ilog2(queue_logical_block_size(disk->queue));
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 405) bi->profile = template->profile ? template->profile : &nop_profile;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 406) bi->tuple_size = template->tuple_size;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 407) bi->tag_size = template->tag_size;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 408)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 409) blk_queue_flag_set(QUEUE_FLAG_STABLE_WRITES, disk->queue);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 410)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 411) #ifdef CONFIG_BLK_INLINE_ENCRYPTION
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 412) if (disk->queue->ksm) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 413) pr_warn("blk-integrity: Integrity and hardware inline encryption are not supported together. Disabling hardware inline encryption.\n");
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 414) blk_ksm_unregister(disk->queue);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 415) }
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 416) #endif
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 417) }
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 418) EXPORT_SYMBOL(blk_integrity_register);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 419)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 420) /**
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 421) * blk_integrity_unregister - Unregister block integrity profile
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 422) * @disk: disk whose integrity profile to unregister
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 423) *
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 424) * Description: This function unregisters the integrity capability from
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 425) * a block device.
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 426) */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 427) void blk_integrity_unregister(struct gendisk *disk)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 428) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 429) struct blk_integrity *bi = &disk->queue->integrity;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 430)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 431) if (!bi->profile)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 432) return;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 433)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 434) /* ensure all bios are off the integrity workqueue */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 435) blk_flush_integrity();
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 436) blk_queue_flag_clear(QUEUE_FLAG_STABLE_WRITES, disk->queue);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 437) memset(bi, 0, sizeof(*bi));
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 438) }
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 439) EXPORT_SYMBOL(blk_integrity_unregister);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 440)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 441) void blk_integrity_add(struct gendisk *disk)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 442) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 443) if (kobject_init_and_add(&disk->integrity_kobj, &integrity_ktype,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 444) &disk_to_dev(disk)->kobj, "%s", "integrity"))
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 445) return;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 446)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 447) kobject_uevent(&disk->integrity_kobj, KOBJ_ADD);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 448) }
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 449)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 450) void blk_integrity_del(struct gendisk *disk)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 451) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 452) kobject_uevent(&disk->integrity_kobj, KOBJ_REMOVE);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 453) kobject_del(&disk->integrity_kobj);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 454) kobject_put(&disk->integrity_kobj);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 455) }