mirror of
https://git.kernel.org/pub/scm/linux/kernel/git/next/linux-next.git
synced 2025-01-06 14:05:39 +00:00
block: refactor to use helper
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>
This commit is contained in:
parent
81ada09cc2
commit
8f63fef586
@ -199,7 +199,6 @@ bool bio_integrity_prep(struct bio *bio)
|
|||||||
unsigned long start, end;
|
unsigned long start, end;
|
||||||
unsigned int len, nr_pages;
|
unsigned int len, nr_pages;
|
||||||
unsigned int bytes, offset, i;
|
unsigned int bytes, offset, i;
|
||||||
unsigned int intervals;
|
|
||||||
blk_status_t status;
|
blk_status_t status;
|
||||||
|
|
||||||
if (!bi)
|
if (!bi)
|
||||||
@ -224,10 +223,9 @@ bool bio_integrity_prep(struct bio *bio)
|
|||||||
!(bi->flags & BLK_INTEGRITY_GENERATE))
|
!(bi->flags & BLK_INTEGRITY_GENERATE))
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
intervals = bio_integrity_intervals(bi, bio_sectors(bio));
|
|
||||||
|
|
||||||
/* Allocate kernel buffer for protection data */
|
/* Allocate kernel buffer for protection data */
|
||||||
len = intervals * bi->tuple_size;
|
len = bio_integrity_bytes(bi, bio_sectors(bio));
|
||||||
buf = kmalloc(len, GFP_NOIO);
|
buf = kmalloc(len, GFP_NOIO);
|
||||||
status = BLK_STS_RESOURCE;
|
status = BLK_STS_RESOURCE;
|
||||||
if (unlikely(buf == NULL)) {
|
if (unlikely(buf == NULL)) {
|
||||||
|
Loading…
Reference in New Issue
Block a user