summaryrefslogtreecommitdiff
path: root/block
diff options
context:
space:
mode:
authorNitesh Shetty <nj.shetty@samsung.com>2023-07-19 17:46:08 +0530
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>2024-08-03 08:48:53 +0200
commit5e0cde523f226ec7a78a4d930c9300e1de5b9d04 (patch)
tree6ded51934a46f170055246068bd7f96518916e9f /block
parentec85cb2895c815526ad92aa4d579a6d2e0220592 (diff)
downloadlinux-5e0cde523f226ec7a78a4d930c9300e1de5b9d04.tar.gz
linux-5e0cde523f226ec7a78a4d930c9300e1de5b9d04.tar.bz2
linux-5e0cde523f226ec7a78a4d930c9300e1de5b9d04.zip
block: refactor to use helper
[ Upstream commit 8f63fef5867fb5e8c29d9c14b6d739bfc1869d32 ] Reduce some code by making use of bio_integrity_bytes(). Signed-off-by: Nitesh Shetty <nj.shetty@samsung.com> Reviewed-by: "Martin K. Petersen" <martin.petersen@oracle.com> Link: https://lore.kernel.org/r/20230719121608.32105-1-nj.shetty@samsung.com Signed-off-by: Jens Axboe <axboe@kernel.dk> Stable-dep-of: 899ee2c3829c ("block: initialize integrity buffer to zero before writing it to media") Signed-off-by: Sasha Levin <sashal@kernel.org>
Diffstat (limited to 'block')
-rw-r--r--block/bio-integrity.c4
1 files changed, 1 insertions, 3 deletions
diff --git a/block/bio-integrity.c b/block/bio-integrity.c
index 4533eb491661..8f0af7ac8573 100644
--- a/block/bio-integrity.c
+++ b/block/bio-integrity.c
@@ -199,7 +199,6 @@ bool bio_integrity_prep(struct bio *bio)
unsigned long start, end;
unsigned int len, nr_pages;
unsigned int bytes, offset, i;
- unsigned int intervals;
blk_status_t status;
if (!bi)
@@ -224,10 +223,9 @@ bool bio_integrity_prep(struct bio *bio)
!(bi->flags & BLK_INTEGRITY_GENERATE))
return true;
}
- intervals = bio_integrity_intervals(bi, bio_sectors(bio));
/* Allocate kernel buffer for protection data */
- len = intervals * bi->tuple_size;
+ len = bio_integrity_bytes(bi, bio_sectors(bio));
buf = kmalloc(len, GFP_NOIO);
status = BLK_STS_RESOURCE;
if (unlikely(buf == NULL)) {