From: Dan Carpenter <error27@gmail.com>
To: "Martin K. Petersen" <martin.petersen@oracle.com>
Cc: Jens Axboe <jens.axboe@oracle.com>,
Chuck Ebbert <cebbert@redhat.com>,
linux-fsdevel@vger.kernel.org,
Alexander Viro <viro@zeniv.linux.org.uk>,
kernel-janitors@vger.kernel.org
Subject: [patch v2] bio-integrity: use hardware sectors instead of block
Date: Fri, 07 May 2010 09:54:14 +0000 [thread overview]
Message-ID: <20100507095414.GH27064@bicker> (raw)
In-Reply-To: <20100507082928.GT27064@bicker>
Smatch tagged this code as suspicious because we never use the
"nr_sectors" variable. Looking at the code, we did intend to use
"nr_sectors" instead of "sectors" when we call bio_integrity_mark_tail().
The difference between "sectors" and "nr_sectors" is that "sectors" is in
terms of 512 byte sectors and "nr_sectors" is in terms of hardware
sectors. They are only different for 4k sector devices.
Also I changed the name because as Jamie Lokier points out, "that code is
so asking for the variable to be called 'hw_sectors'."
Signed-off-by: Dan Carpenter <error27@gmail.com>
diff --git a/fs/bio-integrity.c b/fs/bio-integrity.c
index 612a5c3..d8cd1e2 100644
--- a/fs/bio-integrity.c
+++ b/fs/bio-integrity.c
@@ -667,16 +667,16 @@ void bio_integrity_trim(struct bio *bio, unsigned int offset,
{
struct bio_integrity_payload *bip = bio->bi_integrity;
struct blk_integrity *bi = bdev_get_integrity(bio->bi_bdev);
- unsigned int nr_sectors;
+ unsigned int hw_sectors;
BUG_ON(bip = NULL);
BUG_ON(bi = NULL);
BUG_ON(!bio_flagged(bio, BIO_CLONED));
- nr_sectors = bio_integrity_hw_sectors(bi, sectors);
+ hw_sectors = bio_integrity_hw_sectors(bi, sectors);
bip->bip_sector = bip->bip_sector + offset;
bio_integrity_mark_head(bip, offset * bi->tuple_size);
- bio_integrity_mark_tail(bip, sectors * bi->tuple_size);
+ bio_integrity_mark_tail(bip, hw_sectors * bi->tuple_size);
}
EXPORT_SYMBOL(bio_integrity_trim);
next parent reply other threads:[~2010-05-07 9:54 UTC|newest]
Thread overview: 3+ messages / expand[flat|nested] mbox.gz Atom feed top
[not found] <20100507082928.GT27064@bicker>
2010-05-07 9:54 ` Dan Carpenter [this message]
2010-05-17 19:06 ` [patch v2] bio-integrity: use hardware sectors instead of block layer sectors Martin K. Petersen
2011-04-05 20:35 ` [patch v2] bio-integrity: use hardware sectors instead of block Jonathan Nieder
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=20100507095414.GH27064@bicker \
--to=error27@gmail.com \
--cc=cebbert@redhat.com \
--cc=jens.axboe@oracle.com \
--cc=kernel-janitors@vger.kernel.org \
--cc=linux-fsdevel@vger.kernel.org \
--cc=martin.petersen@oracle.com \
--cc=viro@zeniv.linux.org.uk \
/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).