From: Nitesh Shetty <nj.shetty@samsung.com>
To: Jens Axboe <axboe@kernel.dk>
Cc: martin.petersen@oracle.com, gost.dev@samsung.com,
Nitesh Shetty <nj.shetty@samsung.com>,
linux-block@vger.kernel.org, linux-kernel@vger.kernel.org
Subject: [PATCH] block: refactor to use helper
Date: Wed, 19 Jul 2023 17:46:08 +0530 [thread overview]
Message-ID: <20230719121608.32105-1-nj.shetty@samsung.com> (raw)
In-Reply-To: <CGME20230719121928epcas5p3c2af8016b8ffd5d4cb53238a5528eec8@epcas5p3.samsung.com>
Reduce some code by making use of bio_integrity_bytes().
Signed-off-by: Nitesh Shetty <nj.shetty@samsung.com>
---
block/bio-integrity.c | 4 +---
1 file changed, 1 insertion(+), 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)) {
--
2.34.1
next parent reply other threads:[~2023-07-19 12:36 UTC|newest]
Thread overview: 3+ messages / expand[flat|nested] mbox.gz Atom feed top
[not found] <CGME20230719121928epcas5p3c2af8016b8ffd5d4cb53238a5528eec8@epcas5p3.samsung.com>
2023-07-19 12:16 ` Nitesh Shetty [this message]
2023-07-20 2:58 ` Martin K. Petersen
2023-07-20 22:28 ` Jens Axboe
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20230719121608.32105-1-nj.shetty@samsung.com \
--to=nj.shetty@samsung.com \
--cc=axboe@kernel.dk \
--cc=gost.dev@samsung.com \
--cc=linux-block@vger.kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=martin.petersen@oracle.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox
all inboxes | Powered by JetHome®