From: Christoph Hellwig <hch@lst.de>
To: "Alexander V. Buev" <a.buev@yadro.com>
Cc: linux-block@vger.kernel.org, Jens Axboe <axboe@kernel.dk>,
Christoph Hellwig <hch@lst.de>,
"Martin K . Petersen" <martin.petersen@oracle.com>,
Mikhail Malygin <m.malygin@yadro.com>,
linux@yadro.com
Subject: Re: [PATCH 1/3] block: bio-integrity: add PI iovec to bio
Date: Thu, 28 Oct 2021 17:16:28 +0200 [thread overview]
Message-ID: <20211028151628.GA9468@lst.de> (raw)
In-Reply-To: <20211028112406.101314-2-a.buev@yadro.com>
On Thu, Oct 28, 2021 at 02:24:04PM +0300, Alexander V. Buev wrote:
> * Written by: Martin K. Petersen <martin.petersen@oracle.com>
> */
> -
> #include <linux/blkdev.h>
Spurious whitespace change.
> +void bio_integrity_payload_release_pages(struct bio_integrity_payload *bip)
> +{
> + unsigned short i;
> + struct bio_vec *bv;
> +
> + for (i = 0; i < bip->bip_vcnt; ++i) {
> + bv = bip->bip_vec + i;
> + put_page(bv->bv_page);
> + }
The bv declaration can move into the loop (or we can just nuke the
single use local variable entirely).
> + nr_vec_page = (pi_iov->iov_len + PAGE_SIZE - 1) >> PAGE_SHIFT;
> + nr_vec_page += 1; // we need this die to data of size N pages can be pinned to N+1 page
Pleae avoid overly long line and //-style comments.
> + size = iov_iter_get_pages(&pi_iter, pi_page, LONG_MAX, nr_vec_page, &offset);
> + if (unlikely(size < 0)) {
> + pr_err("Failed to pin PI buffer to page");
> + ret = -EFAULT;
> + goto exit;
> + }
Instead of the local page this should use the same scheme as
__bio_iov_iter_get_pages.
> +
> + // calc count of pined pages
> + if (size > (PAGE_SIZE-offset)) {
> + size = DIV_ROUND_UP(size - (PAGE_SIZE-offset), PAGE_SIZE)+1;
> + } else
No need for braces around single line statements, please always
put whitespaces around your operators.
> +EXPORT_SYMBOL(bio_integrity_add_pi_iovec);
EXPORT_SYMBOL_GPL, please.
next prev parent reply other threads:[~2021-10-28 15:16 UTC|newest]
Thread overview: 24+ messages / expand[flat|nested] mbox.gz Atom feed top
2021-10-28 11:24 [PATCH 0/3] implement direct IO with integrity Alexander V. Buev
2021-10-28 11:24 ` [PATCH 1/3] block: bio-integrity: add PI iovec to bio Alexander V. Buev
2021-10-28 15:16 ` Christoph Hellwig [this message]
2021-10-29 0:11 ` Chaitanya Kulkarni
2021-10-29 4:27 ` Martin K. Petersen
2021-10-29 10:59 ` Alexander V. Buev
2021-10-29 8:40 ` kernel test robot
2021-10-29 8:53 ` kernel test robot
2021-10-29 9:48 ` kernel test robot
2021-10-28 11:24 ` [PATCH 2/3] block: io_uring: add IO_WITH_PI flag to SQE Alexander V. Buev
2021-10-28 11:24 ` [PATCH 3/3] block: fops: handle IOCB_USE_PI in direct IO Alexander V. Buev
2021-10-28 15:17 ` Christoph Hellwig
2021-10-29 9:04 ` kernel test robot
2021-10-28 15:13 ` [PATCH 0/3] implement direct IO with integrity Jens Axboe
2021-10-28 15:18 ` Christoph Hellwig
2021-10-28 15:20 ` Jens Axboe
2021-10-28 15:44 ` Mikhail Malygin
2021-10-28 15:50 ` Jens Axboe
2021-10-28 15:56 ` Pavel Begunkov
2021-10-28 16:22 ` Jens Axboe
2021-10-28 17:11 ` Pavel Begunkov
2021-10-28 17:45 ` Jens Axboe
2021-10-29 3:39 ` Martin K. Petersen
2021-10-28 15:25 ` 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=20211028151628.GA9468@lst.de \
--to=hch@lst.de \
--cc=a.buev@yadro.com \
--cc=axboe@kernel.dk \
--cc=linux-block@vger.kernel.org \
--cc=linux@yadro.com \
--cc=m.malygin@yadro.com \
--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;
as well as URLs for NNTP newsgroup(s).